diff --git a/OpenRGB.pro b/OpenRGB.pro index dde296ed..b4358ab2 100644 --- a/OpenRGB.pro +++ b/OpenRGB.pro @@ -235,6 +235,7 @@ HEADERS += qt/OpenRGBHardwareIDsDialog.h \ qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsEntry.h \ qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsPage.h \ + qt/OpenRGBFont.h \ qt/OpenRGBPluginContainer.h \ qt/OpenRGBPluginsPage/OpenRGBPluginsEntry.h \ qt/OpenRGBPluginsPage/OpenRGBPluginsList.h \ @@ -813,6 +814,7 @@ SOURCES += qt/OpenRGBHardwareIDsDialog.cpp \ qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsEntry.cpp \ qt/OpenRGBKasaSmartSettingsPage/OpenRGBKasaSmartSettingsPage.cpp \ + qt/OpenRGBFont.cpp \ qt/OpenRGBPluginContainer.cpp \ qt/OpenRGBPluginsPage/OpenRGBPluginsEntry.cpp \ qt/OpenRGBPluginsPage/OpenRGBPluginsList.cpp \ diff --git a/qt/OpenRGBDialog2.cpp b/qt/OpenRGBDialog2.cpp index 4c2e9a63..c1005af1 100644 --- a/qt/OpenRGBDialog2.cpp +++ b/qt/OpenRGBDialog2.cpp @@ -1,4 +1,4 @@ -#include +#include #include "OpenRGBDialog2.h" #include "LogManager.h" #include "PluginManager.h" @@ -17,6 +17,7 @@ #include #include #include +#include "OpenRGBFont.h" #ifdef __APPLE__ #include "macutils.h" @@ -24,82 +25,79 @@ using namespace Ui; -static QString GetIconString(device_type type, bool dark) +static int GetIcon(device_type type) { /*-----------------------------------------------------*\ - | Return the icon filename string for the given device | + | Return the icon int value for the given device | | type value | \*-----------------------------------------------------*/ - QString filename; + int icon; + switch(type) { case DEVICE_TYPE_ACCESSORY: - filename = "accessory"; + icon = OpenRGBFont::usb; break; case DEVICE_TYPE_MOTHERBOARD: - filename = "motherboard"; + icon = OpenRGBFont::mainboard; break; case DEVICE_TYPE_DRAM: - filename = "dram"; + icon = OpenRGBFont::dram; break; case DEVICE_TYPE_GPU: - filename = "gpu"; + icon = OpenRGBFont::gpu; break; case DEVICE_TYPE_COOLER: - filename = "fan"; + icon = OpenRGBFont::cooler; break; case DEVICE_TYPE_LEDSTRIP: - filename = "ledstrip"; + icon = OpenRGBFont::ledstrip; break; case DEVICE_TYPE_KEYBOARD: - filename = "keyboard"; + icon = OpenRGBFont::keyboard; break; case DEVICE_TYPE_MICROPHONE: - filename = "microphone"; + icon = OpenRGBFont::mic; break; case DEVICE_TYPE_MOUSE: - filename = "mouse"; + icon = OpenRGBFont::mouse; break; case DEVICE_TYPE_MOUSEMAT: - filename = "mousemat"; + icon = OpenRGBFont::mousemat; break; case DEVICE_TYPE_HEADSET: - filename = "headset"; + icon = OpenRGBFont::headset; break; case DEVICE_TYPE_HEADSET_STAND: - filename = "headsetstand"; + icon = OpenRGBFont::headsetstand; break; case DEVICE_TYPE_GAMEPAD: - filename = "gamepad"; + icon = OpenRGBFont::gamepad; break; case DEVICE_TYPE_LIGHT: - filename = "light"; + icon = OpenRGBFont::bulb; break; case DEVICE_TYPE_SPEAKER: - filename = "speaker"; + icon = OpenRGBFont::music_speaker; break; case DEVICE_TYPE_VIRTUAL: - filename = "virtual"; + icon = OpenRGBFont::virtual_controller; break; case DEVICE_TYPE_STORAGE: - filename = "storage"; + icon = OpenRGBFont::drive; break; case DEVICE_TYPE_CASE: - filename = "case"; + icon = OpenRGBFont::pc_case; break; case DEVICE_TYPE_KEYPAD: - filename = "keypad"; + icon = OpenRGBFont::keypad; break; default: - filename = "unknown"; + icon = OpenRGBFont::unknown; break; } - if(dark) - { - filename += "_dark"; - } - filename += ".png"; - return filename; + + return icon; } static void UpdateDeviceListCallback(void * this_ptr) @@ -652,21 +650,10 @@ void OpenRGBDialog2::AddPluginsPage() ui->SettingsTabBar->addTab(PluginsPage, ""); - QString PluginsLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - PluginsLabelString = "plugin_dark.png"; - } - else - { - PluginsLabelString = "plugin.png"; - } - /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* PluginTabLabel = new TabLabel(PluginsLabelString, tr("Plugins"), (char *)"Plugins", (char *)context); + TabLabel* PluginTabLabel = new TabLabel(OpenRGBFont::extension, tr("Plugins"), (char *)"Plugins", (char *)context); ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, PluginTabLabel); } @@ -680,21 +667,10 @@ void OpenRGBDialog2::AddSoftwareInfoPage() ui->InformationTabBar->addTab(SoftInfoPage, ""); - QString SoftwareLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - SoftwareLabelString = "software_dark.png"; - } - else - { - SoftwareLabelString = "software.png"; - } - /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* SoftwareTabLabel = new TabLabel(SoftwareLabelString, tr("Software"), (char *)"Software", (char *)context); + TabLabel* SoftwareTabLabel = new TabLabel(OpenRGBFont::info, tr("Software"), (char *)"Software", (char *)context); ui->InformationTabBar->tabBar()->setTabButton(ui->InformationTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SoftwareTabLabel); } @@ -708,26 +684,14 @@ void OpenRGBDialog2::AddSupportedDevicesPage() ui->SettingsTabBar->addTab(SupportedPage, ""); - QString SettingsLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - SettingsLabelString = "software_dark.png"; - } - else - { - SettingsLabelString = "software.png"; - } - /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* SupportedTabLabel = new TabLabel(SettingsLabelString, tr("Supported Devices"), (char *)"Supported Devices", (char *)context); + TabLabel* SupportedTabLabel = new TabLabel(OpenRGBFont::controller, tr("Supported Devices"), (char *)"Supported Devices", (char *)context); ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SupportedTabLabel); } - void OpenRGBDialog2::AddSettingsPage() { /*-----------------------------------------------------*\ @@ -737,21 +701,10 @@ void OpenRGBDialog2::AddSettingsPage() ui->SettingsTabBar->addTab(SettingsPage, ""); - QString SettingsLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - SettingsLabelString = "settings_dark.png"; - } - else - { - SettingsLabelString = "settings.png"; - } - /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, tr("General Settings"), (char *)"General Settings", (char *)context); + TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::options, tr("General Settings"), (char *)"General Settings", (char *)context); ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel); @@ -771,21 +724,10 @@ void OpenRGBDialog2::AddDMXSettingsPage() ui->SettingsTabBar->addTab(DMXSettingsPage, ""); - QString SettingsLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - SettingsLabelString = "serial_dark.png"; - } - else - { - SettingsLabelString = "serial.png"; - } - /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, tr("DMX Devices"), (char *)"DMX Devices", (char *)context); + TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::serial, tr("DMX Devices"), (char *)"DMX Devices", (char *)context); ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel); } @@ -799,21 +741,10 @@ void OpenRGBDialog2::AddE131SettingsPage() ui->SettingsTabBar->addTab(E131SettingsPage, ""); - QString SettingsLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - SettingsLabelString = "wireless_dark.png"; - } - else - { - SettingsLabelString = "wireless.png"; - } - /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, tr("E1.31 Devices"), (char *)"E1.31 Devices", (char *)context); + TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::data, tr("E1.31 Devices"), (char *)"E1.31 Devices", (char *)context); ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel); } @@ -841,7 +772,7 @@ void OpenRGBDialog2::AddKasaSmartSettingsPage() /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, tr("Kasa Smart Devices"), (char *)"Kasa Smart Devices", (char *)context); + TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Kasa Smart Devices"), (char *)"Kasa Smart Devices", (char *)context); ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel); } @@ -855,21 +786,10 @@ void OpenRGBDialog2::AddLIFXSettingsPage() ui->SettingsTabBar->addTab(LIFXSettingsPage, ""); - QString SettingsLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - SettingsLabelString = "light_dark.png"; - } - else - { - SettingsLabelString = "light.png"; - } - /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, tr("LIFX Devices"), (char *)"LIFX Devices", (char *)context); + TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("LIFX Devices"), (char *)"LIFX Devices", (char *)context); ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel); } @@ -883,21 +803,10 @@ void OpenRGBDialog2::AddPhilipsHueSettingsPage() ui->SettingsTabBar->addTab(PhilipsHueSettingsPage, ""); - QString SettingsLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - SettingsLabelString = "light_dark.png"; - } - else - { - SettingsLabelString = "light.png"; - } - /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, tr("Philips Hue Devices"), (char *)"Philips Hue Devices", (char *)context); + TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Philips Hue Devices"), (char *)"Philips Hue Devices", (char *)context); ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel); } @@ -911,21 +820,10 @@ void OpenRGBDialog2::AddPhilipsWizSettingsPage() ui->SettingsTabBar->addTab(PhilipsWizSettingsPage, ""); - QString SettingsLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - SettingsLabelString = "light_dark.png"; - } - else - { - SettingsLabelString = "light.png"; - } - - /*-----------------------------------------------------*\ + /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, tr("Philips Wiz Devices"), (char *)"Philips Wiz Devices", (char *)context); + TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Philips Wiz Devices"), (char *)"Philips Wiz Devices", (char *)context); ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel); } @@ -939,21 +837,10 @@ void OpenRGBDialog2::AddQMKORGBSettingsPage() ui->SettingsTabBar->addTab(QMKORGBSettingsPage, ""); - QString SettingsLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - SettingsLabelString = "keyboard_dark.png"; - } - else - { - SettingsLabelString = "keyboard.png"; - } - /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, tr("OpenRGB QMK Protocol"), (char *)"OpenRGB QMK Protocol", (char *)context); + TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::keyboard, tr("OpenRGB QMK Protocol"), (char *)"OpenRGB QMK Protocol", (char *)context); ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel); } @@ -965,25 +852,14 @@ void OpenRGBDialog2::AddSerialSettingsPage() \*-----------------------------------------------------*/ SerialSettingsPage = new OpenRGBSerialSettingsPage(); - ui->SettingsTabBar->addTab(SerialSettingsPage, ""); - - QString SettingsLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - SettingsLabelString = "serial_dark.png"; - } - else - { - SettingsLabelString = "serial.png"; - } + ui->SettingsTabBar->addTab(SerialSettingsPage, ""); /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, tr("Serial Devices"), (char *)"Serial Devices", (char *)context); + TabLabel* SerialSettingsTabLabel = new TabLabel(OpenRGBFont::serial, tr("Serial Devices"), (char *)"Serial Devices", (char *)context); - ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel); + ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SerialSettingsTabLabel); } void OpenRGBDialog2::AddYeelightSettingsPage() @@ -995,21 +871,10 @@ void OpenRGBDialog2::AddYeelightSettingsPage() ui->SettingsTabBar->addTab(YeelightSettingsPage, ""); - QString SettingsLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - SettingsLabelString = "light_dark.png"; - } - else - { - SettingsLabelString = "light.png"; - } - /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, tr("Yeelight Devices"), (char *)"Yeelight Devices", (char *)context); + TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Yeelight Devices"), (char *)"Yeelight Devices", (char *)context); ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel); } @@ -1023,21 +888,10 @@ void OpenRGBDialog2::AddNanoleafSettingsPage() ui->SettingsTabBar->addTab(NanoleafSettingsPage, ""); - QString SettingsLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - SettingsLabelString = "light_dark.png"; - } - else - { - SettingsLabelString = "light.png"; - } - /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, tr("Nanoleaf Devices"), (char *)"Nanoleaf Devices", (char *)context); + TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Nanoleaf Devices"), (char *)"Nanoleaf Devices", (char *)context); ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel); } @@ -1051,51 +905,20 @@ void OpenRGBDialog2::AddElgatoKeyLightSettingsPage() ui->SettingsTabBar->addTab(ElgatoKeyLightSettingsPage, ""); - QString SettingsLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - SettingsLabelString = "light_dark.png"; - } - else - { - SettingsLabelString = "light.png"; - } - /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* SettingsTabLabel = new TabLabel(SettingsLabelString, tr("Elgato KeyLight Devices"), (char *)"Elgato KeyLight Devices", (char *)context); + TabLabel* SettingsTabLabel = new TabLabel(OpenRGBFont::bulb, tr("Elgato KeyLight Devices"), (char *)"Elgato KeyLight Devices", (char *)context); ui->SettingsTabBar->tabBar()->setTabButton(ui->SettingsTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SettingsTabLabel); } void OpenRGBDialog2::AddPlugin(OpenRGBPluginEntry* plugin) { - /*-----------------------------------------------------*\ - | Create Label for the Tab | - \*-----------------------------------------------------*/ - QLabel* PluginTabLabel = new QLabel; - - /*-----------------------------------------------------*\ - | If the plugin has custom information, use it, | - | otherwise generate it | - \*-----------------------------------------------------*/ - QString PluginLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - PluginLabelString = "plugin_dark.png"; - } - else - { - PluginLabelString = "plugin.png"; - } - /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - PluginTabLabel = (QLabel*)new TabLabel(PluginLabelString, QString::fromStdString(plugin->info.Label), (char *)plugin->info.Label.c_str(), (char *)context); + TabLabel* PluginTabLabel = new TabLabel(OpenRGBFont::extension, QString::fromStdString(plugin->info.Label), (char *)plugin->info.Label.c_str(), (char *)context); /*-----------------------------------------------------*\ | Place plugin as its own top level tab | @@ -1265,21 +1088,10 @@ void OpenRGBDialog2::AddI2CToolsPage() \*-----------------------------------------------------*/ ui->InformationTabBar->addTab(SMBusToolsPage, ""); - QString SMBusToolsLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - SMBusToolsLabelString = "tools_dark.png"; - } - else - { - SMBusToolsLabelString = "tools.png"; - } - /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* SMBusToolsTabLabel = new TabLabel(SMBusToolsLabelString, tr("SMBus Tools"), (char *)"SMBus Tools", (char *)context); + TabLabel* SMBusToolsTabLabel = new TabLabel(OpenRGBFont::toolbox, tr("SMBus Tools"), (char *)"SMBus Tools", (char *)context); ui->InformationTabBar->tabBar()->setTabButton(ui->InformationTabBar->tabBar()->count() - 1, QTabBar::LeftSide, SMBusToolsTabLabel); } @@ -1400,7 +1212,7 @@ void OpenRGBDialog2::UpdateDevicesList() /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* NewTabLabel = new TabLabel(GetIconString(controllers[controller_idx]->type, OpenRGBThemeManager::IsDarkTheme()), QString::fromStdString(controllers[controller_idx]->name), (char *)controllers[controller_idx]->name.c_str(), (char *)context); + TabLabel* NewTabLabel = new TabLabel(GetIcon(controllers[controller_idx]->type), QString::fromStdString(controllers[controller_idx]->name), (char *)controllers[controller_idx]->name.c_str(), (char *)context); ui->DevicesTabBar->tabBar()->setTabButton(ui->DevicesTabBar->count() - 1, QTabBar::LeftSide, NewTabLabel); ui->DevicesTabBar->tabBar()->setTabToolTip(ui->DevicesTabBar->count() - 1, QString::fromStdString(controllers[controller_idx]->name)); @@ -1451,7 +1263,7 @@ void OpenRGBDialog2::UpdateDevicesList() /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* NewTabLabel = new TabLabel(GetIconString(controllers[controller_idx]->type, OpenRGBThemeManager::IsDarkTheme()), QString::fromStdString(controllers[controller_idx]->name), (char *)controllers[controller_idx]->name.c_str(), (char *)context); + TabLabel* NewTabLabel = new TabLabel(GetIcon(controllers[controller_idx]->type), QString::fromStdString(controllers[controller_idx]->name), (char *)controllers[controller_idx]->name.c_str(), (char *)context); ui->InformationTabBar->tabBar()->setTabButton(ui->InformationTabBar->count() - 1, QTabBar::LeftSide, NewTabLabel); ui->InformationTabBar->tabBar()->setTabToolTip(ui->InformationTabBar->count() - 1, QString::fromStdString(controllers[controller_idx]->name)); @@ -2069,21 +1881,10 @@ void Ui::OpenRGBDialog2::AddConsolePage() ui->InformationTabBar->addTab(page, ""); - QString ConsoleLabelString; - - if(OpenRGBThemeManager::IsDarkTheme()) - { - ConsoleLabelString = "console_dark.png"; - } - else - { - ConsoleLabelString = "console.png"; - } - /*-----------------------------------------------------*\ | Create the tab label | \*-----------------------------------------------------*/ - TabLabel* ConsoleTabLabel = new TabLabel(ConsoleLabelString, tr("Log Console"), (char *)"Log Console", (char *)context); + TabLabel* ConsoleTabLabel = new TabLabel(OpenRGBFont::terminal, tr("Log Console"), (char *)"Log Console", (char *)context); ui->InformationTabBar->tabBar()->setTabButton(ui->InformationTabBar->tabBar()->count() - 1, QTabBar::LeftSide, ConsoleTabLabel); } diff --git a/qt/OpenRGBFont.cpp b/qt/OpenRGBFont.cpp new file mode 100644 index 00000000..628bd352 --- /dev/null +++ b/qt/OpenRGBFont.cpp @@ -0,0 +1,39 @@ +#include "OpenRGBFont.h" +#include + +OpenRGBFont* OpenRGBFont::instance; + +OpenRGBFont::OpenRGBFont(){} + +OpenRGBFont *OpenRGBFont::Get() +{ + if(!instance) + { + instance = new OpenRGBFont(); + instance->fontId = QFontDatabase::addApplicationFont(":/fonts/OpenRGB.ttf"); + + if(instance->fontId == -1) + { + printf("Cannot load requested font.\n"); + } + else + { + QString family = QFontDatabase::applicationFontFamilies(instance->fontId).at(0); + instance->font = QFont(family); + instance->font.setStyleStrategy(QFont::PreferAntialias); + } + } + + return instance; +} + +QString OpenRGBFont::icon(int glyph) +{ + return QChar(glyph); +} + +QFont OpenRGBFont::GetFont() +{ + return Get()->font; +} + diff --git a/qt/OpenRGBFont.h b/qt/OpenRGBFont.h new file mode 100644 index 00000000..1563a774 --- /dev/null +++ b/qt/OpenRGBFont.h @@ -0,0 +1,54 @@ +#ifndef OPENRGBFONT_H +#define OPENRGBFONT_H + +#include +#include + +class OpenRGBFont +{ +public: + static OpenRGBFont* Get(); + + enum Glyph { + bulb = 0xF001, + controller = 0xF002, + cooler = 0xF003, + data = 0xF004, + dram = 0xF005, + drive = 0xF006, + extension = 0xF007, + gamepad = 0xF008, + gpu = 0xF009, + headset = 0xF00A, + headsetstand = 0xF00B, + info = 0xF00C, + keyboard = 0xF00D, + keypad = 0xF00E, + ledstrip = 0xF00F, + mainboard = 0xF010, + mic = 0xF011, + mouse = 0xF012, + mousemat = 0xF013, + music_speaker = 0xF014, + options = 0xF015, + pc_case = 0xF016, + serial = 0xF017, + terminal = 0xF018, + toolbox = 0xF019, + unknown = 0xF01A, + virtual_controller = 0xF01B, + usb = 0xF01C + }; + + static QString icon(int); + static QFont GetFont(); + +private: + OpenRGBFont(); + + static OpenRGBFont* instance; + int fontId = -1; + QFont font; +}; + +#endif // OPENRGBFONT_H diff --git a/qt/TabLabel.cpp b/qt/TabLabel.cpp index b4f91c72..fb8078ff 100644 --- a/qt/TabLabel.cpp +++ b/qt/TabLabel.cpp @@ -1,13 +1,21 @@ #include "TabLabel.h" #include +#include "OpenRGBFont.h" -Ui::TabLabel::TabLabel(QString icon, QString name, char* original, char* context) : +Ui::TabLabel::TabLabel(int icon, QString name, char* original, char* context) : QWidget(nullptr), ui(new Ui::TabLabelUi) { ui->setupUi(this); - ui->icon->setText(""); + + QFont font = OpenRGBFont::GetFont(); + font.setPointSize(18); + + ui->icon->setFont(font); + ui->icon->setText(OpenRGBFont::icon(icon)); + ui->name->setText(name); + label = original; ctxt = context; } diff --git a/qt/TabLabel.h b/qt/TabLabel.h index 68a7920d..40ab2f63 100644 --- a/qt/TabLabel.h +++ b/qt/TabLabel.h @@ -13,7 +13,7 @@ class Ui::TabLabel : public QWidget Q_OBJECT public: - TabLabel(QString icon, QString name, char* original, char* context); + TabLabel(int icon, QString name, char* original, char* context); ~TabLabel(); private: diff --git a/qt/TabLabel.ui b/qt/TabLabel.ui index 0b6db413..01e6e558 100644 --- a/qt/TabLabel.ui +++ b/qt/TabLabel.ui @@ -47,18 +47,6 @@ - - - 16 - 16 - - - - - 16 - 16 - - @@ -113,4 +101,3 @@ - diff --git a/qt/accessory.png b/qt/accessory.png deleted file mode 100644 index 3ce7cef6..00000000 Binary files a/qt/accessory.png and /dev/null differ diff --git a/qt/accessory_dark.png b/qt/accessory_dark.png deleted file mode 100644 index ab4a1e6d..00000000 Binary files a/qt/accessory_dark.png and /dev/null differ diff --git a/qt/arrow-down.png b/qt/arrow-down.png deleted file mode 100644 index a0c0e158..00000000 Binary files a/qt/arrow-down.png and /dev/null differ diff --git a/qt/arrow-up.png b/qt/arrow-up.png deleted file mode 100644 index b44f10d8..00000000 Binary files a/qt/arrow-up.png and /dev/null differ diff --git a/qt/case.png b/qt/case.png deleted file mode 100644 index 7a99dd55..00000000 Binary files a/qt/case.png and /dev/null differ diff --git a/qt/case_dark.png b/qt/case_dark.png deleted file mode 100644 index 27cf9f36..00000000 Binary files a/qt/case_dark.png and /dev/null differ diff --git a/qt/console.png b/qt/console.png deleted file mode 100644 index 32ee953a..00000000 Binary files a/qt/console.png and /dev/null differ diff --git a/qt/console_dark.png b/qt/console_dark.png deleted file mode 100644 index 876eebe0..00000000 Binary files a/qt/console_dark.png and /dev/null differ diff --git a/qt/dram.png b/qt/dram.png deleted file mode 100644 index 1353b020..00000000 Binary files a/qt/dram.png and /dev/null differ diff --git a/qt/dram_dark.png b/qt/dram_dark.png deleted file mode 100644 index 6cc6b6dd..00000000 Binary files a/qt/dram_dark.png and /dev/null differ diff --git a/qt/fan.png b/qt/fan.png deleted file mode 100644 index 20ecbb0c..00000000 Binary files a/qt/fan.png and /dev/null differ diff --git a/qt/fan_dark.png b/qt/fan_dark.png deleted file mode 100644 index d1ddcbec..00000000 Binary files a/qt/fan_dark.png and /dev/null differ diff --git a/qt/fonts/OpenRGB.ttf b/qt/fonts/OpenRGB.ttf new file mode 100644 index 00000000..a7ada68f Binary files /dev/null and b/qt/fonts/OpenRGB.ttf differ diff --git a/qt/gamepad.png b/qt/gamepad.png deleted file mode 100644 index 620c5614..00000000 Binary files a/qt/gamepad.png and /dev/null differ diff --git a/qt/gamepad_dark.png b/qt/gamepad_dark.png deleted file mode 100644 index 6c12f9b8..00000000 Binary files a/qt/gamepad_dark.png and /dev/null differ diff --git a/qt/gpu.png b/qt/gpu.png deleted file mode 100644 index a386ae38..00000000 Binary files a/qt/gpu.png and /dev/null differ diff --git a/qt/gpu_dark.png b/qt/gpu_dark.png deleted file mode 100644 index 0a690e00..00000000 Binary files a/qt/gpu_dark.png and /dev/null differ diff --git a/qt/headset.png b/qt/headset.png deleted file mode 100644 index 84e1261b..00000000 Binary files a/qt/headset.png and /dev/null differ diff --git a/qt/headset_dark.png b/qt/headset_dark.png deleted file mode 100644 index 08f1cfe0..00000000 Binary files a/qt/headset_dark.png and /dev/null differ diff --git a/qt/headsetstand.png b/qt/headsetstand.png deleted file mode 100644 index 0b15d614..00000000 Binary files a/qt/headsetstand.png and /dev/null differ diff --git a/qt/headsetstand_dark.png b/qt/headsetstand_dark.png deleted file mode 100644 index 9bf9d3e7..00000000 Binary files a/qt/headsetstand_dark.png and /dev/null differ diff --git a/qt/keyboard.png b/qt/keyboard.png deleted file mode 100644 index 58466d04..00000000 Binary files a/qt/keyboard.png and /dev/null differ diff --git a/qt/keyboard_dark.png b/qt/keyboard_dark.png deleted file mode 100644 index e400d29d..00000000 Binary files a/qt/keyboard_dark.png and /dev/null differ diff --git a/qt/keypad.png b/qt/keypad.png deleted file mode 100644 index e8048293..00000000 Binary files a/qt/keypad.png and /dev/null differ diff --git a/qt/keypad_dark.png b/qt/keypad_dark.png deleted file mode 100644 index 0becdd39..00000000 Binary files a/qt/keypad_dark.png and /dev/null differ diff --git a/qt/ledstrip.png b/qt/ledstrip.png deleted file mode 100644 index 3d3335da..00000000 Binary files a/qt/ledstrip.png and /dev/null differ diff --git a/qt/ledstrip_dark.png b/qt/ledstrip_dark.png deleted file mode 100644 index acfcfc21..00000000 Binary files a/qt/ledstrip_dark.png and /dev/null differ diff --git a/qt/light.png b/qt/light.png deleted file mode 100644 index 068a78e5..00000000 Binary files a/qt/light.png and /dev/null differ diff --git a/qt/light_dark.png b/qt/light_dark.png deleted file mode 100644 index 385805bc..00000000 Binary files a/qt/light_dark.png and /dev/null differ diff --git a/qt/microphone.png b/qt/microphone.png deleted file mode 100644 index 6f344dc7..00000000 Binary files a/qt/microphone.png and /dev/null differ diff --git a/qt/microphone_dark.png b/qt/microphone_dark.png deleted file mode 100644 index e8657090..00000000 Binary files a/qt/microphone_dark.png and /dev/null differ diff --git a/qt/motherboard.png b/qt/motherboard.png deleted file mode 100644 index aded29d4..00000000 Binary files a/qt/motherboard.png and /dev/null differ diff --git a/qt/motherboard_dark.png b/qt/motherboard_dark.png deleted file mode 100644 index 5fdc9325..00000000 Binary files a/qt/motherboard_dark.png and /dev/null differ diff --git a/qt/mouse.png b/qt/mouse.png deleted file mode 100644 index 5b53631a..00000000 Binary files a/qt/mouse.png and /dev/null differ diff --git a/qt/mouse_dark.png b/qt/mouse_dark.png deleted file mode 100644 index 0cb32b38..00000000 Binary files a/qt/mouse_dark.png and /dev/null differ diff --git a/qt/mousemat.png b/qt/mousemat.png deleted file mode 100644 index 0e482aac..00000000 Binary files a/qt/mousemat.png and /dev/null differ diff --git a/qt/mousemat_dark.png b/qt/mousemat_dark.png deleted file mode 100644 index f1a7b8a9..00000000 Binary files a/qt/mousemat_dark.png and /dev/null differ diff --git a/qt/plugin.png b/qt/plugin.png deleted file mode 100644 index 76bccd20..00000000 Binary files a/qt/plugin.png and /dev/null differ diff --git a/qt/plugin_dark.png b/qt/plugin_dark.png deleted file mode 100644 index 434b8f08..00000000 Binary files a/qt/plugin_dark.png and /dev/null differ diff --git a/qt/resources.qrc b/qt/resources.qrc index 5b1ec874..65e1f48e 100644 --- a/qt/resources.qrc +++ b/qt/resources.qrc @@ -1,62 +1,7 @@ OpenRGB.png - motherboard.png - dram.png - gpu.png - fan.png - ledstrip.png - keyboard.png - mouse.png - mousemat.png - headset.png - headsetstand.png - tools.png - software.png - dram_dark.png - fan_dark.png - gpu_dark.png - headset_dark.png - headsetstand_dark.png - keyboard_dark.png - ledstrip_dark.png - mousemat_dark.png - mouse_dark.png - motherboard_dark.png - software_dark.png - tools_dark.png - gamepad.png - gamepad_dark.png - light.png - light_dark.png - arrow-down.png - arrow-up.png - plugin.png - plugin_dark.png - speaker.png - speaker_dark.png - virtual.png - virtual_dark.png - settings.png - settings_dark.png - serial.png - serial_dark.png - wireless.png - wireless_dark.png - console.png - console_dark.png - storage.png - storage_dark.png - case.png - case_dark.png + fonts/OpenRGB.ttf OpenRGBGreyscale.png - microphone.png - microphone_dark.png - accessory.png - accessory_dark.png - keypad.png - keypad_dark.png - unknown.png - unknown_dark.png diff --git a/qt/serial.png b/qt/serial.png deleted file mode 100644 index 28440e72..00000000 Binary files a/qt/serial.png and /dev/null differ diff --git a/qt/serial_dark.png b/qt/serial_dark.png deleted file mode 100644 index 4f28e08f..00000000 Binary files a/qt/serial_dark.png and /dev/null differ diff --git a/qt/settings.png b/qt/settings.png deleted file mode 100644 index 45ab9bbe..00000000 Binary files a/qt/settings.png and /dev/null differ diff --git a/qt/settings_dark.png b/qt/settings_dark.png deleted file mode 100644 index 2fb3848f..00000000 Binary files a/qt/settings_dark.png and /dev/null differ diff --git a/qt/software.png b/qt/software.png deleted file mode 100644 index b055e2a7..00000000 Binary files a/qt/software.png and /dev/null differ diff --git a/qt/software_dark.png b/qt/software_dark.png deleted file mode 100644 index dd11cdf4..00000000 Binary files a/qt/software_dark.png and /dev/null differ diff --git a/qt/speaker.png b/qt/speaker.png deleted file mode 100644 index 66e12452..00000000 Binary files a/qt/speaker.png and /dev/null differ diff --git a/qt/speaker_dark.png b/qt/speaker_dark.png deleted file mode 100644 index f1a7b8a9..00000000 Binary files a/qt/speaker_dark.png and /dev/null differ diff --git a/qt/storage.png b/qt/storage.png deleted file mode 100644 index e61a83db..00000000 Binary files a/qt/storage.png and /dev/null differ diff --git a/qt/storage_dark.png b/qt/storage_dark.png deleted file mode 100644 index 5bb9937b..00000000 Binary files a/qt/storage_dark.png and /dev/null differ diff --git a/qt/tools.png b/qt/tools.png deleted file mode 100644 index 4f303a02..00000000 Binary files a/qt/tools.png and /dev/null differ diff --git a/qt/tools_dark.png b/qt/tools_dark.png deleted file mode 100644 index b2813d4d..00000000 Binary files a/qt/tools_dark.png and /dev/null differ diff --git a/qt/unknown.png b/qt/unknown.png deleted file mode 100644 index 2cb6d18a..00000000 Binary files a/qt/unknown.png and /dev/null differ diff --git a/qt/unknown_dark.png b/qt/unknown_dark.png deleted file mode 100644 index 01604653..00000000 Binary files a/qt/unknown_dark.png and /dev/null differ diff --git a/qt/virtual.png b/qt/virtual.png deleted file mode 100644 index 3d5a0268..00000000 Binary files a/qt/virtual.png and /dev/null differ diff --git a/qt/virtual_dark.png b/qt/virtual_dark.png deleted file mode 100644 index 29ba5c7f..00000000 Binary files a/qt/virtual_dark.png and /dev/null differ diff --git a/qt/wireless.png b/qt/wireless.png deleted file mode 100644 index edb81b36..00000000 Binary files a/qt/wireless.png and /dev/null differ diff --git a/qt/wireless_dark.png b/qt/wireless_dark.png deleted file mode 100644 index 97a276e6..00000000 Binary files a/qt/wireless_dark.png and /dev/null differ