Replace all png icons with a custom font

This commit is contained in:
morg 2023-07-06 17:05:38 +00:00 committed by Adam Honse
parent b8f4b081a4
commit 3256bc3296
65 changed files with 158 additions and 322 deletions

View file

@ -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 \

View file

@ -1,4 +1,4 @@
#include <functional>
#include <functional>
#include "OpenRGBDialog2.h"
#include "LogManager.h"
#include "PluginManager.h"
@ -17,6 +17,7 @@
#include <QMessageBox>
#include <QCloseEvent>
#include <QStyleFactory>
#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);
}

39
qt/OpenRGBFont.cpp Normal file
View file

@ -0,0 +1,39 @@
#include "OpenRGBFont.h"
#include <QFontDatabase>
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;
}

54
qt/OpenRGBFont.h Normal file
View file

@ -0,0 +1,54 @@
#ifndef OPENRGBFONT_H
#define OPENRGBFONT_H
#include <QFont>
#include <QString>
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

View file

@ -1,13 +1,21 @@
#include "TabLabel.h"
#include <QFontMetrics>
#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("<img src=':/" + icon + "' height='16' width='16' />");
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;
}

View file

@ -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:

View file

@ -47,18 +47,6 @@
</item>
<item>
<widget class="QLabel" name="icon">
<property name="minimumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
@ -113,4 +101,3 @@
<resources/>
<connections/>
</ui>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

BIN
qt/fonts/OpenRGB.ttf Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 B

View file

@ -1,62 +1,7 @@
<RCC>
<qresource prefix="/">
<file>OpenRGB.png</file>
<file>motherboard.png</file>
<file>dram.png</file>
<file>gpu.png</file>
<file>fan.png</file>
<file>ledstrip.png</file>
<file>keyboard.png</file>
<file>mouse.png</file>
<file>mousemat.png</file>
<file>headset.png</file>
<file>headsetstand.png</file>
<file>tools.png</file>
<file>software.png</file>
<file>dram_dark.png</file>
<file>fan_dark.png</file>
<file>gpu_dark.png</file>
<file>headset_dark.png</file>
<file>headsetstand_dark.png</file>
<file>keyboard_dark.png</file>
<file>ledstrip_dark.png</file>
<file>mousemat_dark.png</file>
<file>mouse_dark.png</file>
<file>motherboard_dark.png</file>
<file>software_dark.png</file>
<file>tools_dark.png</file>
<file>gamepad.png</file>
<file>gamepad_dark.png</file>
<file>light.png</file>
<file>light_dark.png</file>
<file>arrow-down.png</file>
<file>arrow-up.png</file>
<file>plugin.png</file>
<file>plugin_dark.png</file>
<file>speaker.png</file>
<file>speaker_dark.png</file>
<file>virtual.png</file>
<file>virtual_dark.png</file>
<file>settings.png</file>
<file>settings_dark.png</file>
<file>serial.png</file>
<file>serial_dark.png</file>
<file>wireless.png</file>
<file>wireless_dark.png</file>
<file>console.png</file>
<file>console_dark.png</file>
<file>storage.png</file>
<file>storage_dark.png</file>
<file>case.png</file>
<file>case_dark.png</file>
<file>fonts/OpenRGB.ttf</file>
<file>OpenRGBGreyscale.png</file>
<file>microphone.png</file>
<file>microphone_dark.png</file>
<file>accessory.png</file>
<file>accessory_dark.png</file>
<file>keypad.png</file>
<file>keypad_dark.png</file>
<file>unknown.png</file>
<file>unknown_dark.png</file>
</qresource>
</RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B