minor adjustments

This commit is contained in:
2020-04-26 16:25:58 +02:00
parent 1fee46899e
commit 72a9b50298
4 changed files with 11 additions and 59 deletions

View File

@@ -20,9 +20,7 @@ enum PluginItemType {
}; };
enum PluginMenuType { enum PluginMenuType {
PLUGIN_MENU_TYPE_GLOBAL = 0, PLUGIN_MENU_TYPE_GLOBAL = 0
PLUGIN_MENU_TYPE_CHANNEL,
PLUGIN_MENU_TYPE_CLIENT
}; };
#define PLUGIN_MENU_BUFSZ 128 #define PLUGIN_MENU_BUFSZ 128

View File

@@ -39,10 +39,10 @@ void LEDHandler::sendColor(int R, int G, int B, int W, int t)
msg.append(3); msg.append(3);
msg.append((uint)t); msg.append((uint)t);
for (int n = 0; n < cLEDNUM; n++) { for (int n = 0; n < cLEDNUM; n++) {
msg.append((int)R * brightness/100); msg.append((int)R * mBrightness/100);
msg.append((int)G * brightness/100); msg.append((int)G * mBrightness/100);
msg.append((int)B * brightness/100); msg.append((int)B * mBrightness/100);
msg.append((int)W * brightness/100); msg.append((int)W * mBrightness/100);
} }
mSock->writeDatagram(msg, QHostAddress(cURL), cPORT); mSock->writeDatagram(msg, QHostAddress(cURL), cPORT);

View File

@@ -10,7 +10,7 @@ class LEDHandler : public QObject
public: public:
QString cURL = "10.0.0.222"; QString cURL = "10.0.0.222";
int cPORT = 21324; int cPORT = 21324;
int cLEDNUM = 26; int cLEDNUM = 90;
LEDHandler(QUdpSocket* sock, TS3Functions ts3Functions); LEDHandler(QUdpSocket* sock, TS3Functions ts3Functions);
@@ -27,7 +27,7 @@ public slots:
private: private:
QUdpSocket* mSock; QUdpSocket* mSock;
TS3Functions mTs3Functions; TS3Functions mTs3Functions;
int brightness = 80; int mBrightness = 80;
void sendColor(int R, int G, int B, int W, int t); void sendColor(int R, int G, int B, int W, int t);
}; };

View File

@@ -522,13 +522,7 @@ static struct PluginMenuItem* createMenuItem(enum PluginMenuType type, int id, c
* These IDs are freely choosable by the plugin author. It's not really needed to use an enum, it just looks prettier. * These IDs are freely choosable by the plugin author. It's not really needed to use an enum, it just looks prettier.
*/ */
enum { enum {
MENU_ID_CLIENT_1 = 1, MENU_ID_SETTINGS
MENU_ID_CLIENT_2,
MENU_ID_CHANNEL_1,
MENU_ID_CHANNEL_2,
MENU_ID_CHANNEL_3,
MENU_ID_GLOBAL_1,
MENU_ID_GLOBAL_2
}; };
/* /*
@@ -556,13 +550,7 @@ void ts3plugin_initMenus(struct PluginMenuItem*** menuItems, char** menuIcon) {
*/ */
BEGIN_CREATE_MENUS(0); /* IMPORTANT: Number of menu items must be correct! */ BEGIN_CREATE_MENUS(0); /* IMPORTANT: Number of menu items must be correct! */
//CREATE_MENU_ITEM(PLUGIN_MENU_TYPE_CLIENT, MENU_ID_CLIENT_1, "Client item 1", "1.png"); // CREATE_MENU_ITEM(PLUGIN_MENU_TYPE_GLOBAL, MENU_ID_SETTINGS, "LED Settings", "1.png");
//CREATE_MENU_ITEM(PLUGIN_MENU_TYPE_CLIENT, MENU_ID_CLIENT_2, "Client item 2", "2.png");
//CREATE_MENU_ITEM(PLUGIN_MENU_TYPE_CHANNEL, MENU_ID_CHANNEL_1, "Channel item 1", "1.png");
//CREATE_MENU_ITEM(PLUGIN_MENU_TYPE_CHANNEL, MENU_ID_CHANNEL_2, "Channel item 2", "2.png");
//CREATE_MENU_ITEM(PLUGIN_MENU_TYPE_CHANNEL, MENU_ID_CHANNEL_3, "Channel item 3", "3.png");
//CREATE_MENU_ITEM(PLUGIN_MENU_TYPE_GLOBAL, MENU_ID_GLOBAL_1, "Global item 1", "1.png");
//CREATE_MENU_ITEM(PLUGIN_MENU_TYPE_GLOBAL, MENU_ID_GLOBAL_2, "Global item 2", "2.png");
END_CREATE_MENUS; /* Includes an assert checking if the number of menu items matched */ END_CREATE_MENUS; /* Includes an assert checking if the number of menu items matched */
/* /*
@@ -822,47 +810,13 @@ void ts3plugin_onMenuItemEvent(uint64 serverConnectionHandlerID, enum PluginMenu
case PLUGIN_MENU_TYPE_GLOBAL: case PLUGIN_MENU_TYPE_GLOBAL:
/* Global menu item was triggered. selectedItemID is unused and set to zero. */ /* Global menu item was triggered. selectedItemID is unused and set to zero. */
switch(menuItemID) { switch(menuItemID) {
case MENU_ID_GLOBAL_1: case MENU_ID_SETTINGS:
/* Menu global 1 was triggered */ // TODO: show dialog
break;
case MENU_ID_GLOBAL_2:
/* Menu global 2 was triggered */
break; break;
default: default:
break; break;
} }
break; break;
case PLUGIN_MENU_TYPE_CHANNEL:
/* Channel contextmenu item was triggered. selectedItemID is the channelID of the selected channel */
switch(menuItemID) {
case MENU_ID_CHANNEL_1:
/* Menu channel 1 was triggered */
break;
case MENU_ID_CHANNEL_2:
/* Menu channel 2 was triggered */
break;
case MENU_ID_CHANNEL_3:
/* Menu channel 3 was triggered */
break;
default:
break;
}
break;
case PLUGIN_MENU_TYPE_CLIENT:
/* Client contextmenu item was triggered. selectedItemID is the clientID of the selected client */
switch(menuItemID) {
case MENU_ID_CLIENT_1:
/* Menu client 1 was triggered */
break;
case MENU_ID_CLIENT_2:
/* Menu client 2 was triggered */
break;
default:
break;
}
break;
default:
break;
} }
} }