From a3a698181e86e18e747183963a80e17a0caf0633 Mon Sep 17 00:00:00 2001 From: Romolo Manfredini Date: Sun, 19 Jan 2014 22:49:26 +0100 Subject: [PATCH] Further work in themes for the ui and some further bug fix. --- companion/src/companion.qrc | 430 ++++++++++++++---- companion/src/comparedialog.ui | 2 +- .../src/firmwares/er9x/er9xinterface.cpp | 2 +- .../firmwares/gruvin9x/gruvin9xinterface.cpp | 2 +- .../firmwares/opentx/opentxSky9xsimulator.cpp | 2 +- .../opentx/opentxTaranisSimulator.cpp | 2 +- .../src/firmwares/th9x/th9xinterface.cpp | 2 +- companion/src/helpers.cpp | 7 + companion/src/helpers.h | 1 + companion/src/mainwindow.cpp | 222 ++++++--- companion/src/mainwindow.h | 1 + companion/src/mdichild.cpp | 16 +- companion/src/mdichild.ui | 8 +- companion/src/modeledit/curves.cpp | 18 +- companion/src/modeledit/customfunctions.cpp | 83 +++- companion/src/modeledit/customswitches.cpp | 27 +- companion/src/modeledit/inputs.cpp | 72 ++- companion/src/modeledit/mixes.cpp | 70 ++- companion/src/modeledit/modeledit.cpp | 14 + companion/src/modeledit/modeledit.ui | 8 +- companion/src/modeledit/setup.cpp | 4 +- companion/src/modeledit/telemetry.cpp | 2 +- companion/src/modelslist.cpp | 58 ++- companion/src/preferencesdialog.cpp | 8 +- companion/src/preferencesdialog.ui | 8 - companion/src/printdialog.ui | 2 +- .../src/themes/monochrome/16/customize.png | Bin 0 -> 381 bytes companion/src/themes/monochrome/16/play.png | Bin 0 -> 534 bytes companion/src/themes/monochrome/16/stop.png | Bin 0 -> 312 bytes .../src/themes/monochrome/24/customize.png | Bin 0 -> 381 bytes companion/src/themes/monochrome/24/play.png | Bin 0 -> 534 bytes companion/src/themes/monochrome/24/stop.png | Bin 0 -> 312 bytes .../src/themes/monochrome/32/customize.png | Bin 0 -> 381 bytes companion/src/themes/monochrome/32/play.png | Bin 0 -> 534 bytes companion/src/themes/monochrome/32/stop.png | Bin 0 -> 312 bytes .../src/themes/monochrome/48/customize.png | Bin 0 -> 381 bytes companion/src/themes/monochrome/48/play.png | Bin 0 -> 534 bytes companion/src/themes/monochrome/48/stop.png | Bin 0 -> 312 bytes 38 files changed, 849 insertions(+), 222 deletions(-) create mode 100644 companion/src/themes/monochrome/16/customize.png create mode 100644 companion/src/themes/monochrome/16/play.png create mode 100644 companion/src/themes/monochrome/16/stop.png create mode 100644 companion/src/themes/monochrome/24/customize.png create mode 100644 companion/src/themes/monochrome/24/play.png create mode 100644 companion/src/themes/monochrome/24/stop.png create mode 100644 companion/src/themes/monochrome/32/customize.png create mode 100644 companion/src/themes/monochrome/32/play.png create mode 100644 companion/src/themes/monochrome/32/stop.png create mode 100644 companion/src/themes/monochrome/48/customize.png create mode 100644 companion/src/themes/monochrome/48/play.png create mode 100644 companion/src/themes/monochrome/48/stop.png diff --git a/companion/src/companion.qrc b/companion/src/companion.qrc index f56405744..5212a3809 100644 --- a/companion/src/companion.qrc +++ b/companion/src/companion.qrc @@ -292,91 +292,349 @@ images/library/30002.png images/library/30003.png images/library/30004.png - themes/monochrome/open.png - themes/monochrome/edit.png - themes/monochrome/information.png - themes/monochrome/configure.png - themes/monochrome/switch_dir.png - themes/monochrome/list.png - themes/monochrome/wizard.png - themes/monochrome/logs.png - themes/monochrome/new.png - themes/monochrome/save.png - themes/monochrome/recentdocument.png - themes/monochrome/simulate.png - themes/monochrome/changelog.png - themes/monochrome/copy.png - themes/monochrome/write_flash.png - themes/monochrome/read_eeprom_file.png - themes/monochrome/clear.png - themes/monochrome/play.png - themes/monochrome/fuses.png - themes/monochrome/arrow-right.png - themes/monochrome/exit.png - themes/monochrome/moveup.png - themes/monochrome/read_eeprom.png - themes/monochrome/cut.png - themes/monochrome/arrow-left.png - themes/monochrome/write_eeprom_file.png - themes/monochrome/library.png - themes/monochrome/profiles.png - themes/monochrome/paste.png - themes/monochrome/print.png - themes/monochrome/compare.png - themes/monochrome/customize.png - themes/monochrome/saveas.png - themes/monochrome/preferences.png - themes/monochrome/movedown.png - themes/monochrome/currentmodel.png - themes/monochrome/read_flash.png - themes/monochrome/duplicate.png - themes/monochrome/add.png - themes/monochrome/update.png - themes/monochrome/contributors.png - themes/monochrome/stop.png - themes/monochrome/write_eeprom.png - themes/classic/open.png - themes/classic/edit.png - themes/classic/information.png - themes/classic/configure.png - themes/classic/switch_dir.png - themes/classic/list.png - themes/classic/wizard.png - themes/classic/logs.png - themes/classic/new.png - themes/classic/save.png - themes/classic/recentdocument.png - themes/classic/simulate.png - themes/classic/changelog.png - themes/classic/copy.png - themes/classic/write_flash.png - themes/classic/read_eeprom_file.png - themes/classic/clear.png - themes/classic/play.png - themes/classic/fuses.png - themes/classic/arrow-right.png - themes/classic/exit.png - themes/classic/moveup.png - themes/classic/read_eeprom.png - themes/classic/cut.png - themes/classic/arrow-left.png - themes/classic/write_eeprom_file.png - themes/classic/library.png - themes/classic/profiles.png - themes/classic/paste.png - themes/classic/print.png - themes/classic/compare.png - themes/classic/customize.png - themes/classic/saveas.png - themes/classic/preferences.png - themes/classic/movedown.png - themes/classic/currentmodel.png - themes/classic/read_flash.png - themes/classic/duplicate.png - themes/classic/add.png - themes/classic/update.png - themes/classic/contributors.png - themes/classic/stop.png - themes/classic/write_eeprom.png + themes/monochrome/16/open.png + themes/monochrome/16/edit.png + themes/monochrome/16/information.png + themes/monochrome/16/configure.png + themes/monochrome/16/switch_dir.png + themes/monochrome/16/list.png + themes/monochrome/16/wizard.png + themes/monochrome/16/logs.png + themes/monochrome/16/new.png + themes/monochrome/16/save.png + themes/monochrome/16/recentdocument.png + themes/monochrome/16/simulate.png + themes/monochrome/16/changelog.png + themes/monochrome/16/copy.png + themes/monochrome/16/write_flash.png + themes/monochrome/16/read_eeprom_file.png + themes/monochrome/16/clear.png + themes/monochrome/16/play.png + themes/monochrome/16/fuses.png + themes/monochrome/16/arrow-right.png + themes/monochrome/16/exit.png + themes/monochrome/16/moveup.png + themes/monochrome/16/read_eeprom.png + themes/monochrome/16/cut.png + themes/monochrome/16/arrow-left.png + themes/monochrome/16/write_eeprom_file.png + themes/monochrome/16/library.png + themes/monochrome/16/profiles.png + themes/monochrome/16/paste.png + themes/monochrome/16/print.png + themes/monochrome/16/compare.png + themes/monochrome/16/customize.png + themes/monochrome/16/saveas.png + themes/monochrome/16/preferences.png + themes/monochrome/16/movedown.png + themes/monochrome/16/currentmodel.png + themes/monochrome/16/read_flash.png + themes/monochrome/16/duplicate.png + themes/monochrome/16/add.png + themes/monochrome/16/update.png + themes/monochrome/16/contributors.png + themes/monochrome/16/stop.png + themes/monochrome/16/write_eeprom.png + themes/monochrome/24/open.png + themes/monochrome/24/edit.png + themes/monochrome/24/information.png + themes/monochrome/24/configure.png + themes/monochrome/24/switch_dir.png + themes/monochrome/24/list.png + themes/monochrome/24/wizard.png + themes/monochrome/24/logs.png + themes/monochrome/24/new.png + themes/monochrome/24/save.png + themes/monochrome/24/recentdocument.png + themes/monochrome/24/simulate.png + themes/monochrome/24/changelog.png + themes/monochrome/24/copy.png + themes/monochrome/24/write_flash.png + themes/monochrome/24/read_eeprom_file.png + themes/monochrome/24/clear.png + themes/monochrome/24/play.png + themes/monochrome/24/fuses.png + themes/monochrome/24/arrow-right.png + themes/monochrome/24/exit.png + themes/monochrome/24/moveup.png + themes/monochrome/24/read_eeprom.png + themes/monochrome/24/cut.png + themes/monochrome/24/arrow-left.png + themes/monochrome/24/write_eeprom_file.png + themes/monochrome/24/library.png + themes/monochrome/24/profiles.png + themes/monochrome/24/paste.png + themes/monochrome/24/print.png + themes/monochrome/24/compare.png + themes/monochrome/24/customize.png + themes/monochrome/24/saveas.png + themes/monochrome/24/preferences.png + themes/monochrome/24/movedown.png + themes/monochrome/24/currentmodel.png + themes/monochrome/24/read_flash.png + themes/monochrome/24/duplicate.png + themes/monochrome/24/add.png + themes/monochrome/24/update.png + themes/monochrome/24/contributors.png + themes/monochrome/24/stop.png + themes/monochrome/24/write_eeprom.png + themes/monochrome/32/open.png + themes/monochrome/32/edit.png + themes/monochrome/32/information.png + themes/monochrome/32/configure.png + themes/monochrome/32/switch_dir.png + themes/monochrome/32/list.png + themes/monochrome/32/wizard.png + themes/monochrome/32/logs.png + themes/monochrome/32/new.png + themes/monochrome/32/save.png + themes/monochrome/32/recentdocument.png + themes/monochrome/32/simulate.png + themes/monochrome/32/changelog.png + themes/monochrome/32/copy.png + themes/monochrome/32/write_flash.png + themes/monochrome/32/read_eeprom_file.png + themes/monochrome/32/clear.png + themes/monochrome/32/play.png + themes/monochrome/32/fuses.png + themes/monochrome/32/arrow-right.png + themes/monochrome/32/exit.png + themes/monochrome/32/moveup.png + themes/monochrome/32/read_eeprom.png + themes/monochrome/32/cut.png + themes/monochrome/32/arrow-left.png + themes/monochrome/32/write_eeprom_file.png + themes/monochrome/32/library.png + themes/monochrome/32/profiles.png + themes/monochrome/32/paste.png + themes/monochrome/32/print.png + themes/monochrome/32/compare.png + themes/monochrome/32/customize.png + themes/monochrome/32/saveas.png + themes/monochrome/32/preferences.png + themes/monochrome/32/movedown.png + themes/monochrome/32/currentmodel.png + themes/monochrome/32/read_flash.png + themes/monochrome/32/duplicate.png + themes/monochrome/32/add.png + themes/monochrome/32/update.png + themes/monochrome/32/contributors.png + themes/monochrome/32/stop.png + themes/monochrome/32/write_eeprom.png + themes/monochrome/48/open.png + themes/monochrome/48/edit.png + themes/monochrome/48/information.png + themes/monochrome/48/configure.png + themes/monochrome/48/switch_dir.png + themes/monochrome/48/list.png + themes/monochrome/48/wizard.png + themes/monochrome/48/logs.png + themes/monochrome/48/new.png + themes/monochrome/48/save.png + themes/monochrome/48/recentdocument.png + themes/monochrome/48/simulate.png + themes/monochrome/48/changelog.png + themes/monochrome/48/copy.png + themes/monochrome/48/write_flash.png + themes/monochrome/48/read_eeprom_file.png + themes/monochrome/48/clear.png + themes/monochrome/48/play.png + themes/monochrome/48/fuses.png + themes/monochrome/48/arrow-right.png + themes/monochrome/48/exit.png + themes/monochrome/48/moveup.png + themes/monochrome/48/read_eeprom.png + themes/monochrome/48/cut.png + themes/monochrome/48/arrow-left.png + themes/monochrome/48/write_eeprom_file.png + themes/monochrome/48/library.png + themes/monochrome/48/profiles.png + themes/monochrome/48/paste.png + themes/monochrome/48/print.png + themes/monochrome/48/compare.png + themes/monochrome/48/customize.png + themes/monochrome/48/saveas.png + themes/monochrome/48/preferences.png + themes/monochrome/48/movedown.png + themes/monochrome/48/currentmodel.png + themes/monochrome/48/read_flash.png + themes/monochrome/48/duplicate.png + themes/monochrome/48/add.png + themes/monochrome/48/update.png + themes/monochrome/48/contributors.png + themes/monochrome/48/stop.png + themes/monochrome/48/write_eeprom.png + themes/classic/16/open.png + themes/classic/16/edit.png + themes/classic/16/information.png + themes/classic/16/configure.png + themes/classic/16/switch_dir.png + themes/classic/16/list.png + themes/classic/16/wizard.png + themes/classic/16/logs.png + themes/classic/16/new.png + themes/classic/16/save.png + themes/classic/16/recentdocument.png + themes/classic/16/simulate.png + themes/classic/16/changelog.png + themes/classic/16/copy.png + themes/classic/16/write_flash.png + themes/classic/16/read_eeprom_file.png + themes/classic/16/clear.png + themes/classic/16/play.png + themes/classic/16/fuses.png + themes/classic/16/arrow-right.png + themes/classic/16/exit.png + themes/classic/16/moveup.png + themes/classic/16/read_eeprom.png + themes/classic/16/cut.png + themes/classic/16/arrow-left.png + themes/classic/16/write_eeprom_file.png + themes/classic/16/library.png + themes/classic/16/profiles.png + themes/classic/16/paste.png + themes/classic/16/print.png + themes/classic/16/compare.png + themes/classic/16/customize.png + themes/classic/16/saveas.png + themes/classic/16/preferences.png + themes/classic/16/movedown.png + themes/classic/16/currentmodel.png + themes/classic/16/read_flash.png + themes/classic/16/duplicate.png + themes/classic/16/add.png + themes/classic/16/update.png + themes/classic/16/contributors.png + themes/classic/16/stop.png + themes/classic/16/write_eeprom.png + themes/classic/24/open.png + themes/classic/24/edit.png + themes/classic/24/information.png + themes/classic/24/configure.png + themes/classic/24/switch_dir.png + themes/classic/24/list.png + themes/classic/24/wizard.png + themes/classic/24/logs.png + themes/classic/24/new.png + themes/classic/24/save.png + themes/classic/24/recentdocument.png + themes/classic/24/simulate.png + themes/classic/24/changelog.png + themes/classic/24/copy.png + themes/classic/24/write_flash.png + themes/classic/24/read_eeprom_file.png + themes/classic/24/clear.png + themes/classic/24/play.png + themes/classic/24/fuses.png + themes/classic/24/arrow-right.png + themes/classic/24/exit.png + themes/classic/24/moveup.png + themes/classic/24/read_eeprom.png + themes/classic/24/cut.png + themes/classic/24/arrow-left.png + themes/classic/24/write_eeprom_file.png + themes/classic/24/library.png + themes/classic/24/profiles.png + themes/classic/24/paste.png + themes/classic/24/print.png + themes/classic/24/compare.png + themes/classic/24/customize.png + themes/classic/24/saveas.png + themes/classic/24/preferences.png + themes/classic/24/movedown.png + themes/classic/24/currentmodel.png + themes/classic/24/read_flash.png + themes/classic/24/duplicate.png + themes/classic/24/add.png + themes/classic/24/update.png + themes/classic/24/contributors.png + themes/classic/24/stop.png + themes/classic/24/write_eeprom.png + themes/classic/32/open.png + themes/classic/32/edit.png + themes/classic/32/information.png + themes/classic/32/configure.png + themes/classic/32/switch_dir.png + themes/classic/32/list.png + themes/classic/32/wizard.png + themes/classic/32/logs.png + themes/classic/32/new.png + themes/classic/32/save.png + themes/classic/32/recentdocument.png + themes/classic/32/simulate.png + themes/classic/32/changelog.png + themes/classic/32/copy.png + themes/classic/32/write_flash.png + themes/classic/32/read_eeprom_file.png + themes/classic/32/clear.png + themes/classic/32/play.png + themes/classic/32/fuses.png + themes/classic/32/arrow-right.png + themes/classic/32/exit.png + themes/classic/32/moveup.png + themes/classic/32/read_eeprom.png + themes/classic/32/cut.png + themes/classic/32/arrow-left.png + themes/classic/32/write_eeprom_file.png + themes/classic/32/library.png + themes/classic/32/profiles.png + themes/classic/32/paste.png + themes/classic/32/print.png + themes/classic/32/compare.png + themes/classic/32/customize.png + themes/classic/32/saveas.png + themes/classic/32/preferences.png + themes/classic/32/movedown.png + themes/classic/32/currentmodel.png + themes/classic/32/read_flash.png + themes/classic/32/duplicate.png + themes/classic/32/add.png + themes/classic/32/update.png + themes/classic/32/contributors.png + themes/classic/32/stop.png + themes/classic/32/write_eeprom.png + themes/classic/48/open.png + themes/classic/48/edit.png + themes/classic/48/information.png + themes/classic/48/configure.png + themes/classic/48/switch_dir.png + themes/classic/48/list.png + themes/classic/48/wizard.png + themes/classic/48/logs.png + themes/classic/48/new.png + themes/classic/48/save.png + themes/classic/48/recentdocument.png + themes/classic/48/simulate.png + themes/classic/48/changelog.png + themes/classic/48/copy.png + themes/classic/48/write_flash.png + themes/classic/48/read_eeprom_file.png + themes/classic/48/clear.png + themes/classic/48/play.png + themes/classic/48/fuses.png + themes/classic/48/arrow-right.png + themes/classic/48/exit.png + themes/classic/48/moveup.png + themes/classic/48/read_eeprom.png + themes/classic/48/cut.png + themes/classic/48/arrow-left.png + themes/classic/48/write_eeprom_file.png + themes/classic/48/library.png + themes/classic/48/profiles.png + themes/classic/48/paste.png + themes/classic/48/print.png + themes/classic/48/compare.png + themes/classic/48/customize.png + themes/classic/48/saveas.png + themes/classic/48/preferences.png + themes/classic/48/movedown.png + themes/classic/48/currentmodel.png + themes/classic/48/read_flash.png + themes/classic/48/duplicate.png + themes/classic/48/add.png + themes/classic/48/update.png + themes/classic/48/contributors.png + themes/classic/48/stop.png + themes/classic/48/write_eeprom.png diff --git a/companion/src/comparedialog.ui b/companion/src/comparedialog.ui index 7667ad3ce..6f11bf138 100644 --- a/companion/src/comparedialog.ui +++ b/companion/src/comparedialog.ui @@ -30,7 +30,7 @@ - :/images/print.png:/images/print.png + :/icon.png:/icon.png diff --git a/companion/src/firmwares/er9x/er9xinterface.cpp b/companion/src/firmwares/er9x/er9xinterface.cpp index f2eed4608..9d413654d 100644 --- a/companion/src/firmwares/er9x/er9xinterface.cpp +++ b/companion/src/firmwares/er9x/er9xinterface.cpp @@ -44,7 +44,7 @@ const char * Er9xInterface::getName() const int Er9xInterface::getEEpromSize() { - QSettings settings("companion9x", "companion9x"); + QSettings settings("companion", "companion"); QString avrMCU = settings.value("mcu", QString("m64")).toString(); if (avrMCU==QString("m128")) { return 2*EESIZE_STOCK; diff --git a/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp b/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp index cdb6d4124..1115f46f1 100644 --- a/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp +++ b/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp @@ -47,7 +47,7 @@ const char * Gruvin9xInterface::getName() const int Gruvin9xInterface::getEEpromSize() { if (board == BOARD_STOCK) { - QSettings settings("companion9x", "companion9x"); + QSettings settings("companion", "companion"); QString avrMCU = settings.value("mcu", QString("m64")).toString(); if (avrMCU==QString("m128")) { return EESIZE_STOCK*2; diff --git a/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp b/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp index 9f444c808..393eff229 100644 --- a/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp +++ b/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp @@ -135,7 +135,7 @@ using namespace Open9xSky9x; Open9xSky9xSimulator::Open9xSky9xSimulator(Open9xInterface * open9xInterface): open9xInterface(open9xInterface) { - QSettings settings("companion9x", "companion9x"); + QSettings settings("companion", "companion"); QString path=settings.value("sdPath", ".").toString()+"/"; int i=0; for (i=0; i< std::min(path.length(),1022); i++) { diff --git a/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp b/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp index ae4424797..3af9d4a86 100644 --- a/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp +++ b/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp @@ -145,7 +145,7 @@ OpentxTaranisSimulator::OpentxTaranisSimulator(Open9xInterface * open9xInterface open9xInterface(open9xInterface) { taranisSimulatorBoard = GetEepromInterface()->getBoard(); - QSettings settings("companion9x", "companion9x"); + QSettings settings("companion", "companion"); QString path=settings.value("sdPath", ".").toString()+"/"; int i=0; for (i=0; i< std::min(path.length(),1022); i++) { diff --git a/companion/src/firmwares/th9x/th9xinterface.cpp b/companion/src/firmwares/th9x/th9xinterface.cpp index d86065ddb..bf49284ce 100644 --- a/companion/src/firmwares/th9x/th9xinterface.cpp +++ b/companion/src/firmwares/th9x/th9xinterface.cpp @@ -44,7 +44,7 @@ const char * Th9xInterface::getName() const int Th9xInterface::getEEpromSize() { - QSettings settings("companion9x", "companion9x"); + QSettings settings("companion", "companion"); QString avrMCU = settings.value("mcu", QString("m64")).toString(); if (avrMCU==QString("m128")) { return 2*EESIZE_STOCK; diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index d89deaa6f..8c70f8805 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -1484,3 +1484,10 @@ QString getCenterBeep(ModelData * g_model) if(g_model->beepANACenter & 0x80) strl << "LS"; return strl.join(", "); } + +void populate_icon(QIcon *Icon, QString usedtheme, QString baseimage) { + Icon->addFile(":/themes/"+usedtheme+"/16/"+baseimage,QSize(16,16)); + Icon->addFile(":/themes/"+usedtheme+"/24/"+baseimage,QSize(24,24)); + Icon->addFile(":/themes/"+usedtheme+"/32/"+baseimage,QSize(32,32)); + Icon->addFile(":/themes/"+usedtheme+"/48/"+baseimage,QSize(48,48)); +} diff --git a/companion/src/helpers.h b/companion/src/helpers.h index 6f104480c..1cb564340 100644 --- a/companion/src/helpers.h +++ b/companion/src/helpers.h @@ -28,6 +28,7 @@ void populateVoiceLangCB(QComboBox *b, QString language); void populateTTraceCB(QComboBox *b, int value); void populateRotEncCB(QComboBox *b, int value, int renumber); void populateBacklightCB(QComboBox *b, const uint8_t value); +void populate_icon(QIcon *Icon, QString usedtheme, QString baseimage); class GVarGroup : public QObject { diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index eee308d16..4f0cad108 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -59,6 +59,7 @@ #include "burndialog.h" #include "hexinterface.h" #include "warnings.h" +#include "helpers.h" #include "firmwares/opentx/opentxinterface.h" // TODO get rid of this include #define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2" @@ -80,6 +81,7 @@ #include "mountlist.h" #endif + MainWindow::MainWindow(): downloadDialog_forWait(NULL) { @@ -104,6 +106,24 @@ downloadDialog_forWait(NULL) Theme="monochrome"; break; } + int icon_size=settings.value("icon_size", 1).toInt(); + switch (icon_size) { + case 0: + ISize="16"; + break; + case 1: + ISize="24"; + break; + case 2: + ISize="32"; + break; + case 3: + ISize="48"; + break; + default: + ISize="24"; + break; + } restoreGeometry(settings.value("mainWindowGeometry").toByteArray()); createActions(); createMenus(); @@ -1069,14 +1089,18 @@ void MainWindow::burnFrom() QStringList str; str << path << tempFile; avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Read Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); + QIcon icon; + populate_icon(&icon,Theme,"read_eeprom.png"); + ad->setWindowIcon(icon); res = ad->exec(); sleep(1); } } else { QStringList str = GetReceiveEEpromCommand(tempFile); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Read Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); + QIcon icon; + populate_icon(&icon,Theme,"read_eeprom.png"); + ad->setWindowIcon(icon); res = ad->exec(); } if(QFileInfo(tempFile).exists() && res) { @@ -1126,14 +1150,18 @@ void MainWindow::burnExtenalToEEPROM() QStringList str; str << path << backupFile; avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Backup Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); + QIcon icon; + populate_icon(&icon,Theme,"read_eeprom.png"); + ad->setWindowIcon(icon); ad->exec(); sleep(1); } } else { QStringList str = GetReceiveEEpromCommand(backupFile); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx")); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); + QIcon icon; + populate_icon(&icon,Theme,"read_eeprom.png"); + ad->setWindowIcon(icon); ad->exec(); sleep(1); } @@ -1143,7 +1171,9 @@ void MainWindow::burnExtenalToEEPROM() QString tempFlash = tempDir + "/flash.bin"; QStringList str = GetReceiveFlashCommand(tempFlash); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Read Firmware From Tx"); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_flash.png")); + QIcon icon; + populate_icon(&icon,Theme,"read_flash.png"); + ad->setWindowIcon(icon); ad->exec(); sleep(1); QString restoreFile = tempDir + "/compat.bin"; @@ -1176,14 +1206,18 @@ void MainWindow::burnExtenalToEEPROM() QStringList str; str << path << backupFile; avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Backup Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); + QIcon icon; + populate_icon(&icon,Theme,"read_eeprom.png"); + ad->setWindowIcon(icon); ad->exec(); sleep(1); } } else { QStringList str = ((MainWindow *)this->parent())->GetReceiveEEpromCommand(backupFile); avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx")); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); + QIcon icon; + populate_icon(&icon,Theme,"read_eeprom.png"); + ad->setWindowIcon(icon); ad->exec(); sleep(1); } @@ -1198,14 +1232,18 @@ void MainWindow::burnExtenalToEEPROM() QStringList str; str << fileName << path; avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Write Models and Settings To Tx")); //, AVR_DIALOG_KEEP_OPEN); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); + QIcon icon; + populate_icon(&icon,Theme,"read_eeprom.png"); + ad->setWindowIcon(icon); ad->exec(); sleep(1); } } else { QStringList str = GetSendEEpromCommand(fileName); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Write Models and Settings To Tx", AVR_DIALOG_SHOW_DONE); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/write_eeprom.png")); + QIcon icon; + populate_icon(&icon,Theme,"write_eeprom.png"); + ad->setWindowIcon(icon); ad->exec(); } } @@ -1370,13 +1408,17 @@ void MainWindow::burnToFlash(QString fileToFlash) } QStringList str = GetReceiveEEpromCommand(backupFile); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx"), AVR_DIALOG_CLOSE_IF_SUCCESSFUL); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); + QIcon icon; + populate_icon(&icon,Theme,"read_eeprom.png"); + ad->setWindowIcon(icon); int res = ad->exec(); if (QFileInfo(backupFile).exists() && res) { sleep(1); QStringList str = GetSendFlashCommand(fileName); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Write Firmware To Tx"), AVR_DIALOG_CLOSE_IF_SUCCESSFUL); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/write_flash.png")); + QIcon iconw; + populate_icon(&iconw,Theme,"write_eeprom.png"); + ad->setWindowIcon(iconw); int res = ad->exec(); if (res) { QString restoreFile = tempDir + "/restore.bin"; @@ -1387,7 +1429,7 @@ void MainWindow::burnToFlash(QString fileToFlash) sleep(1); QStringList str = GetSendEEpromCommand(restoreFile); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Restore Models and Settings To Tx"), AVR_DIALOG_CLOSE_IF_SUCCESSFUL); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/write_eeprom.png")); + ad->setWindowIcon(iconw); res=ad->exec(); if (!res) { QMessageBox::warning(this, tr("Restore failed"), tr("Could not restore Models and Settings to TX. The models and settings data file can be found at: %1").arg(backupFile)); @@ -1412,14 +1454,18 @@ void MainWindow::burnToFlash(QString fileToFlash) QString backupFile=backupPath+"/backup-"+QDateTime().currentDateTime().toString("yyyy-MM-dd-hhmmss")+".bin"; QStringList str = GetReceiveEEpromCommand(backupFile); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx")); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); + QIcon icon; + populate_icon(&icon,Theme,"read_eeprom.png"); + ad->setWindowIcon(icon); ad->exec(); sleep(1); } QStringList str = GetSendFlashCommand(fileName); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Write Firmware To Tx"), AVR_DIALOG_SHOW_DONE); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/write_flash.png")); + QIcon iconw; + populate_icon(&iconw,Theme,"read_eeprom.png"); + ad->setWindowIcon(iconw); ad->exec(); } } @@ -1440,14 +1486,18 @@ void MainWindow::burnExtenalFromEEPROM() QStringList str; str << path << fileName; avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Read Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); + QIcon icon; + populate_icon(&icon,Theme,"read_eeprom.png"); + ad->setWindowIcon(icon); ad->exec(); } } else { settings.setValue("lastDir", QFileInfo(fileName).dir().absolutePath()); QStringList str = GetReceiveEEpromCommand(fileName); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Read Models and Settings From Tx")); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_eeprom.png")); + QIcon icon; + populate_icon(&icon,Theme,"read_eeprom.png"); + ad->setWindowIcon(icon); ad->exec(); } } @@ -1465,7 +1515,9 @@ void MainWindow::burnFromFlash() settings.setValue("lastFlashDir",QFileInfo(fileName).dir().absolutePath()); QStringList str = GetReceiveFlashCommand(fileName); avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Read Firmware From Tx"); - ad->setWindowIcon(QIcon(":/themes/"+Theme+"/read_flash.png")); + QIcon icon; + populate_icon(&icon,Theme,"read_flash.png"); + ad->setWindowIcon(icon); ad->exec(); } @@ -1605,137 +1657,191 @@ MdiChild *MainWindow::createMdiChild() void MainWindow::createActions() { - newAct = new QAction(QIcon(":/themes/"+Theme+"/new.png"), tr("&New"), this); + QIcon newActIcon; + populate_icon(&newActIcon,Theme,"new.png"); + + newAct = new QAction(newActIcon, tr("&New"), this); newAct->setShortcuts(QKeySequence::New); newAct->setStatusTip(tr("Create a new file")); connect(newAct, SIGNAL(triggered()), this, SLOT(newFile())); - openAct = new QAction(QIcon(":/themes/"+Theme+"/open.png"), tr("&Open..."), this); + QIcon openActIcon; + populate_icon(&openActIcon,Theme,"open.png"); + openAct = new QAction(openActIcon, tr("&Open..."), this); openAct->setShortcuts(QKeySequence::Open); openAct->setStatusTip(tr("Open an existing file")); connect(openAct, SIGNAL(triggered()), this, SLOT(openFile())); - loadbackupAct = new QAction(QIcon(":/themes/"+Theme+"/open.png"), tr("&loadBackup..."), this); + loadbackupAct = new QAction(openActIcon, tr("&loadBackup..."), this); loadbackupAct->setStatusTip(tr("Load backup from file")); connect(loadbackupAct, SIGNAL(triggered()), this, SLOT(loadBackup())); - saveAct = new QAction(QIcon(":/themes/"+Theme+"/save.png"), tr("&Save"), this); + QIcon saveActIcon; + populate_icon(&saveActIcon,Theme,"save.png"); + saveAct = new QAction(saveActIcon, tr("&Save"), this); saveAct->setShortcuts(QKeySequence::Save); saveAct->setStatusTip(tr("Save the document to disk")); connect(saveAct, SIGNAL(triggered()), this, SLOT(save())); - saveAsAct = new QAction(QIcon(":/themes/"+Theme+"/saveas.png"), tr("Save &As..."), this); + QIcon saveAsActIcon; + populate_icon(&saveAsActIcon,Theme,"saveas.png"); + saveAsAct = new QAction(saveAsActIcon, tr("Save &As..."), this); saveAsAct->setShortcuts(QKeySequence::SaveAs); saveAsAct->setStatusTip(tr("Save the document under a new name")); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); - logsAct = new QAction(QIcon(":/themes/"+Theme+"/logs.png"), tr("Lo&gs"), this); + QIcon logsActIcon; + populate_icon(&logsActIcon,Theme,"logs.png"); + logsAct = new QAction(logsActIcon, tr("Lo&gs"), this); logsAct->setShortcut(tr("Ctrl+G")); logsAct->setStatusTip(tr("Open log file")); connect(logsAct, SIGNAL(triggered()), this, SLOT(logFile())); - preferencesAct = new QAction(QIcon(":/themes/"+Theme+"/preferences.png"), tr("&Preferences..."), this); + QIcon preferencesActIcon; + populate_icon(&preferencesActIcon,Theme,"preferences.png"); + preferencesAct = new QAction(preferencesActIcon, tr("&Preferences..."), this); preferencesAct->setStatusTip(tr("Edit general preferences")); connect(preferencesAct, SIGNAL(triggered()), this, SLOT(preferences())); - checkForUpdatesAct = new QAction(QIcon(":/themes/"+Theme+"/update.png"), tr("&Check for updates..."), this); + QIcon checkForUpdatesActIcon; + populate_icon(&checkForUpdatesActIcon,Theme,"update.png"); + checkForUpdatesAct = new QAction(checkForUpdatesActIcon, tr("&Check for updates..."), this); checkForUpdatesAct->setStatusTip(tr("Check for new version of Companion")); connect(checkForUpdatesAct, SIGNAL(triggered()), this, SLOT(doUpdates())); - contributorsAct = new QAction(QIcon(":/themes/"+Theme+"/contributors.png"), tr("Contributors &List..."), this); + QIcon contributorsActIcon; + populate_icon(&contributorsActIcon,Theme,"contributors.png"); + contributorsAct = new QAction(contributorsActIcon, tr("Contributors &List..."), this); contributorsAct->setStatusTip(tr("Show Companion contributors list")); connect(contributorsAct, SIGNAL(triggered()), this, SLOT(contributors())); - changelogAct = new QAction(QIcon(":/themes/"+Theme+"/changelog.png"), tr("ChangeLog..."), this); + QIcon changelogActIcon; + populate_icon(&changelogActIcon,Theme,"changelog.png"); + changelogAct = new QAction(changelogActIcon, tr("ChangeLog..."), this); changelogAct->setStatusTip(tr("Show Companion changelog")); connect(changelogAct, SIGNAL(triggered()), this, SLOT(changelog())); - fwchangelogAct = new QAction(QIcon(":/themes/"+Theme+"/changelog.png"), tr("Firmware ChangeLog..."), this); + QIcon fwchangelogActIcon; + populate_icon(&fwchangelogActIcon,Theme,"changelog.png"); + fwchangelogAct = new QAction(fwchangelogActIcon, tr("Firmware ChangeLog..."), this); fwchangelogAct->setStatusTip(tr("Show firmware changelog")); connect(fwchangelogAct, SIGNAL(triggered()), this, SLOT(fwchangelog())); - compareAct = new QAction(QIcon(":/themes/"+Theme+"/compare.png"), tr("Compare..."), this); + QIcon compareActIcon; + populate_icon(&compareActIcon,Theme,"compare.png"); + compareAct = new QAction(compareActIcon, tr("Compare..."), this); compareAct->setStatusTip(tr("Compare models")); compareAct->setEnabled(false); connect(compareAct, SIGNAL(triggered()), this, SLOT(compare())); - customizeSplashAct = new QAction(QIcon(":/themes/"+Theme+"/customize.png"), tr("Customize your &TX..."), this); + QIcon customizeSplashActIcon; + populate_icon(&customizeSplashActIcon,Theme,"customize.png"); + customizeSplashAct = new QAction(customizeSplashActIcon, tr("Customize your &TX..."), this); customizeSplashAct->setStatusTip(tr("Customize the splash screen of your TX")); connect(customizeSplashAct, SIGNAL(triggered()), this, SLOT(customizeSplash())); //! [0] - exitAct = new QAction(QIcon(":/themes/"+Theme+"/exit.png"), tr("E&xit"), this); + QIcon exitActIcon; + populate_icon(&exitActIcon,Theme,"exit.png"); + exitAct = new QAction(exitActIcon, tr("E&xit"), this); exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); //! [0] - cutAct = new QAction(QIcon(":/themes/"+Theme+"/cut.png"), tr("Cu&t"), this); + QIcon cutActIcon; + populate_icon(&cutActIcon,Theme,"cut.png"); + cutAct = new QAction(cutActIcon, tr("Cu&t"), this); cutAct->setShortcuts(QKeySequence::Cut); cutAct->setStatusTip(tr("Cut the current selection's contents to the " "clipboard")); connect(cutAct, SIGNAL(triggered()), this, SLOT(cut())); - copyAct = new QAction(QIcon(":/themes/"+Theme+"/copy.png"), tr("&Copy"), this); + QIcon copyActIcon; + populate_icon(©ActIcon,Theme,"copy.png"); + copyAct = new QAction(copyActIcon, tr("&Copy"), this); copyAct->setShortcuts(QKeySequence::Copy); copyAct->setStatusTip(tr("Copy the current selection's contents to the " "clipboard")); connect(copyAct, SIGNAL(triggered()), this, SLOT(copy())); - pasteAct = new QAction(QIcon(":/themes/"+Theme+"/paste.png"), tr("&Paste"), this); + QIcon pasteActIcon; + populate_icon(&pasteActIcon,Theme,"paste.png"); + pasteAct = new QAction(pasteActIcon, tr("&Paste"), this); pasteAct->setShortcuts(QKeySequence::Paste); pasteAct->setStatusTip(tr("Paste the clipboard's contents into the current " "selection")); connect(pasteAct, SIGNAL(triggered()), this, SLOT(paste())); - - burnToAct = new QAction(QIcon(":/themes/"+Theme+"/write_eeprom.png"), tr("&Write Models and Settings To Tx"), this); + QIcon burnToActIcon; + populate_icon(&burnToActIcon,Theme,"write_eeprom.png"); + burnToAct = new QAction(burnToActIcon, tr("&Write Models and Settings To Tx"), this); burnToAct->setShortcut(tr("Ctrl+Alt+W")); burnToAct->setStatusTip(tr("Write Models and Settings to transmitter")); connect(burnToAct,SIGNAL(triggered()),this,SLOT(burnTo())); - burnFromAct = new QAction(QIcon(":/themes/"+Theme+"/read_eeprom.png"), tr("&Read Models and Settings From Tx"), this); + QIcon burnFromActIcon; + populate_icon(&burnFromActIcon,Theme,"read_eeprom.png"); + burnFromAct = new QAction(burnFromActIcon, tr("&Read Models and Settings From Tx"), this); burnFromAct->setShortcut(tr("Ctrl+Alt+R")); burnFromAct->setStatusTip(tr("Read Models and Settings from transmitter")); connect(burnFromAct,SIGNAL(triggered()),this,SLOT(burnFrom())); - burnToFlashAct = new QAction(QIcon(":/themes/"+Theme+"/write_flash.png"), tr("Write Firmware"), this); + QIcon burnToFlashActIcon; + populate_icon(&burnToFlashActIcon,Theme,"write_flash.png"); + burnToFlashAct = new QAction(burnToFlashActIcon, tr("Write Firmware"), this); burnToFlashAct->setStatusTip(tr("Write firmware to transmitter")); connect(burnToFlashAct,SIGNAL(triggered()),this,SLOT(burnToFlash())); - burnExtenalToEEPROMAct = new QAction(QIcon(":/themes/"+Theme+"/write_eeprom_file.png"), tr("Write Models and Settings from file to Tx"), this); + QIcon burnExtenalToEEPROMActIcon; + populate_icon(&burnExtenalToEEPROMActIcon,Theme,"write_eeprom_file.png"); + burnExtenalToEEPROMAct = new QAction(burnExtenalToEEPROMActIcon, tr("Write Models and Settings from file to Tx"), this); burnExtenalToEEPROMAct->setStatusTip(tr("Write Models and Settings from file to transmitter")); connect(burnExtenalToEEPROMAct,SIGNAL(triggered()),this,SLOT(burnExtenalToEEPROM())); - burnExtenalFromEEPROMAct = new QAction(QIcon(":/themes/"+Theme+"/read_eeprom_file.png"), tr("Save transmitter Models and Settings to file"), this); + QIcon burnExtenalFromEEPROMActIcon; + populate_icon(&burnExtenalFromEEPROMActIcon,Theme,"read_eeprom_file.png"); + burnExtenalFromEEPROMAct = new QAction(burnExtenalFromEEPROMActIcon, tr("Save transmitter Models and Settings to file"), this); burnExtenalFromEEPROMAct->setStatusTip(tr("Save the Models and Settings from the transmitter to a file")); connect(burnExtenalFromEEPROMAct,SIGNAL(triggered()),this,SLOT(burnExtenalFromEEPROM())); - burnFromFlashAct = new QAction(QIcon(":/themes/"+Theme+"/read_flash.png"), tr("Read Firmware"), this); + QIcon burnFromFlashActIcon; + populate_icon(&burnFromFlashActIcon,Theme,"read_flash.png"); + burnFromFlashAct = new QAction(burnFromFlashActIcon, tr("Read Firmware"), this); burnFromFlashAct->setStatusTip(tr("Read firmware from transmitter")); connect(burnFromFlashAct,SIGNAL(triggered()),this,SLOT(burnFromFlash())); - burnConfigAct = new QAction(QIcon(":/themes/"+Theme+"/configure.png"), tr("&Configure..."), this); + QIcon burnConfigActIcon; + populate_icon(&burnConfigActIcon,Theme,"configure.png"); + burnConfigAct = new QAction(burnConfigActIcon, tr("&Configure..."), this); burnConfigAct->setStatusTip(tr("Configure software for reading from and writing to the transmitter")); connect(burnConfigAct,SIGNAL(triggered()),this,SLOT(burnConfig())); EEPROMInterface *eepromInterface = GetEepromInterface(); if (!IS_ARM(eepromInterface->getBoard())) { - burnListAct = new QAction(QIcon(":/themes/"+Theme+"/list.png"), tr("&List programmers"), this); + QIcon burnListActIcon; + populate_icon(&burnListActIcon,Theme,"list.png"); + burnListAct = new QAction(burnListActIcon, tr("&List programmers"), this); burnListAct->setStatusTip(tr("List available programmers")); connect(burnListAct,SIGNAL(triggered()),this,SLOT(burnList())); - burnFusesAct = new QAction(QIcon(":/themes/"+Theme+"/fuses.png"), tr("&Fuses..."), this); + QIcon burnFusesActIcon; + populate_icon(&burnFusesActIcon,Theme,"fuses.png"); + burnFusesAct = new QAction(burnFusesActIcon, tr("&Fuses..."), this); burnFusesAct->setStatusTip(tr("Show fuses dialog")); connect(burnFusesAct,SIGNAL(triggered()),this,SLOT(burnFuses())); } - simulateAct = new QAction(QIcon(":/themes/"+Theme+"/simulate.png"), tr("&Simulate"), this); + QIcon simulateActIcon; + populate_icon(&simulateActIcon,Theme,"simulate.png"); + simulateAct = new QAction(simulateActIcon, tr("&Simulate"), this); simulateAct->setShortcut(tr("Alt+S")); simulateAct->setStatusTip(tr("Simulate selected model.")); simulateAct->setEnabled(false); connect(simulateAct,SIGNAL(triggered()),this,SLOT(simulate())); - printAct = new QAction(QIcon(":/themes/"+Theme+"/print.png"), tr("&Print"), this); + QIcon printActIcon; + populate_icon(&printActIcon,Theme,"print.png"); + printAct = new QAction(printActIcon, tr("&Print"), this); printAct->setShortcut(tr("Ctrl+P")); printAct->setStatusTip(tr("Print current model.")); printAct->setEnabled(false); @@ -1775,11 +1881,15 @@ void MainWindow::createActions() separatorAct = new QAction(this); separatorAct->setSeparator(true); - aboutAct = new QAction(QIcon(":/themes/"+Theme+"/information.png"), tr("&About"), this); + QIcon aboutActIcon; + populate_icon(&aboutActIcon,Theme,"information.png"); + aboutAct = new QAction(aboutActIcon, tr("&About"), this); aboutAct->setStatusTip(tr("Show the application's About box")); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); - switchLayoutDirectionAct = new QAction(QIcon(":/themes/"+Theme+"/switch_dir.png"), tr("Switch layout direction"), this); + QIcon switchLayoutDirectionActIcon; + populate_icon(&switchLayoutDirectionActIcon,Theme,"switch_dir.png"); + switchLayoutDirectionAct = new QAction(switchLayoutDirectionActIcon, tr("Switch layout direction"), this); switchLayoutDirectionAct->setStatusTip(tr("Switch layout Left/Right")); connect(switchLayoutDirectionAct, SIGNAL(triggered()), this, SLOT(switchLayoutDirection())); for (int i = 0; i < MaxRecentFiles; ++i) { @@ -1809,7 +1919,9 @@ void MainWindow::createMenus() fileMenu->addAction(saveAct); fileMenu->addAction(saveAsAct); fileMenu->addMenu(recentFileMenu); - recentFileMenu->setIcon(QIcon(":/themes/"+Theme+"/recentdocument.png")); + QIcon recentFileMenuIcon; + populate_icon(&recentFileMenuIcon,Theme,"recentdocument.png"); + recentFileMenu->setIcon(recentFileMenuIcon); for ( int i = 0; i < MaxRecentFiles; ++i) recentFileMenu->addAction(recentFileActs[i]); fileMenu->addSeparator(); @@ -1822,7 +1934,9 @@ void MainWindow::createMenus() fileMenu->addAction(preferencesAct); fileMenu->addMenu(profilesMenu); - profilesMenu->setIcon(QIcon(":/themes/"+Theme+"/profiles.png")); + QIcon profilesMenuIcon; + populate_icon(&profilesMenuIcon,Theme,"profiles.png"); + profilesMenu->setIcon(profilesMenuIcon); for ( int i = 0; i < MAX_PROFILES; ++i) profilesMenu->addAction(profileActs[i]); fileMenu->addAction(switchLayoutDirectionAct); @@ -1912,7 +2026,9 @@ void MainWindow::createToolBars() QToolButton * recentToolButton = new QToolButton; recentToolButton->setPopupMode(QToolButton::InstantPopup); recentToolButton->setMenu(createRecentFileMenu()); - recentToolButton->setIcon(QIcon(":/themes/"+Theme+"/recentdocument.png")); + QIcon recentToolButtonIcon; + populate_icon(&recentToolButtonIcon,Theme,"recentdocument.png"); + recentToolButton->setIcon(recentToolButtonIcon); recentToolButton->setToolTip(tr("Recent Files")); fileToolBar->addWidget(recentToolButton); fileToolBar->addAction(saveAct); @@ -1922,7 +2038,9 @@ void MainWindow::createToolBars() profileButton = new QToolButton; profileButton->setPopupMode(QToolButton::InstantPopup); profileButton->setMenu(createProfilesMenu()); - profileButton->setIcon(QIcon(":/themes/"+Theme+"/profiles.png")); + QIcon profileButtonIcon; + populate_icon(&profileButtonIcon,Theme,"profiles.png"); + profileButton->setIcon(profileButtonIcon); profileButton->setToolTip(tr("Firmware Profiles")); fileToolBar->addWidget(profileButton); bool notfound=true; diff --git a/companion/src/mainwindow.h b/companion/src/mainwindow.h index d26667f75..de5b1083f 100644 --- a/companion/src/mainwindow.h +++ b/companion/src/mainwindow.h @@ -139,6 +139,7 @@ private: int getFileType(const QString &fullFileName); QString FindTaranisPath(); QString Theme; + QString ISize; QString strippedName(const QString &fullFileName); MdiChild *activeMdiChild(); diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index e9049bd1f..ed908c9b0 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -68,8 +68,22 @@ MdiChild::MdiChild(): isUntitled(true), fileChanged(false) { - ui->setupUi(this); + QSettings settings("companion", "companion"); + int theme_set=settings.value("theme", 1).toInt(); + QString Theme; + switch(theme_set) { + case 0: + Theme="classic"; + break; + default: + Theme="monochrome"; + break; + } + QIcon SimulateIcon; + populate_icon(&SimulateIcon,Theme,"simulate.png"); + ui->setupUi(this); + ui->SimulateTxButton->setIcon(SimulateIcon); setAttribute(Qt::WA_DeleteOnClose); eepromInterfaceChanged(); diff --git a/companion/src/mdichild.ui b/companion/src/mdichild.ui index d32b3cffb..b2fb21e2f 100644 --- a/companion/src/mdichild.ui +++ b/companion/src/mdichild.ui @@ -13,6 +13,10 @@ + + + :/icon.png:/icon.png + @@ -22,10 +26,6 @@ Simulate Tx - - - :/images/simulate.png:/images/simulate.png - diff --git a/companion/src/modeledit/curves.cpp b/companion/src/modeledit/curves.cpp index 2e52c54ea..21c3fec32 100644 --- a/companion/src/modeledit/curves.cpp +++ b/companion/src/modeledit/curves.cpp @@ -2,6 +2,7 @@ #include "ui_curves.h" #include "node.h" #include "edge.h" +#include "helpers.h" #include #include #include @@ -83,9 +84,20 @@ Curves::Curves(QWidget * parent, ModelData & model): QGraphicsScene *scene = new QGraphicsScene(ui->curvePreview); scene->setItemIndexMethod(QGraphicsScene::NoIndex); ui->curvePreview->setScene(scene); + QSettings settings("companion", "companion"); + int theme_set=settings.value("theme", 1).toInt(); + QString Theme; + switch(theme_set) { + case 0: + Theme="classic"; + break; + default: + Theme="monochrome"; + break; + } - QIcon clearIcon; - clearIcon.addFile(":/images/clear.png", QSize(), QIcon::Normal, QIcon::Off); + QIcon ClearIcon; + populate_icon(&ClearIcon,Theme,"clear.png"); for (int i=0; igetCapability(NumCurves); i++) { visibleCurves[i] = false; @@ -94,7 +106,7 @@ Curves::Curves(QWidget * parent, ModelData & model): QPushButton * reset = new QPushButton(this); reset->setProperty("index", i); reset->setMinimumSize(QSize(0, 0)); - reset->setIcon(clearIcon); + reset->setIcon(ClearIcon); reset->setIconSize(QSize(14, 14)); connect(reset, SIGNAL(clicked()), this, SLOT(resetCurve())); ui->curvesLayout->addWidget(reset, i, 0, 1, 1); diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index e6c883ee6..7bb1a2b76 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -36,7 +36,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, } } - QSettings settings("companion9x", "companion9x"); + QSettings settings("companion", "companion"); QString path = settings.value("sdPath", ".").toString(); path.append("/SOUNDS/"); QString lang = generalSettings.ttsLanguage; @@ -123,9 +123,22 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, connect(fswtchParamArmT[i], SIGNAL(editTextChanged ( const QString)), this, SLOT(customFunctionEdited())); #ifdef PHONON + QSettings settings("companion", "companion"); + int theme_set=settings.value("theme", 1).toInt(); + QString Theme; + switch(theme_set) { + case 0: + Theme="classic"; + break; + default: + Theme="monochrome"; + break; + } + QIcon PlayIcon; + populate_icon(&PlayIcon,Theme,"play.png"); playBT[i] = new QPushButton(this); playBT[i]->setObjectName(QString("play_%1").arg(i)); - playBT[i]->setIcon(QIcon(":/images/play.png")); + playBT[i]->setIcon(PlayIcon); paramLayout->addWidget(playBT[i]); connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic())); #endif @@ -160,6 +173,20 @@ void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::Sta { if (phononLock) return; + QSettings settings("companion", "companion"); + int theme_set=settings.value("theme", 1).toInt(); + QString Theme; + switch(theme_set) { + case 0: + Theme="classic"; + break; + default: + Theme="monochrome"; + break; + } + QIcon PlayIcon; + populate_icon(&PlayIcon,Theme,"play.png"); + phononLock=true; if ((newState==Phonon::StoppedState || newState==Phonon::PausedState) && oldState==Phonon::PlayingState) { clickObject->stop(); @@ -167,7 +194,7 @@ void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::Sta clickObject->clear(); for (int i=0; igetCapability(CustomFunctions); i++) { playBT[i]->setObjectName(QString("play_%1").arg(i)); - playBT[i]->setIcon(QIcon(":/images/play.png")); + playBT[i]->setIcon(PlayIcon); } } if (newState==Phonon::ErrorState) { @@ -176,7 +203,7 @@ void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::Sta clickObject->clear(); for (int i=0; igetCapability(CustomFunctions); i++) { playBT[i]->setObjectName(QString("play_%1").arg(i)); - playBT[i]->setIcon(QIcon(":/images/play.png")); + playBT[i]->setIcon(PlayIcon); } } @@ -189,7 +216,22 @@ void CustomFunctionsPanel::playMusic() QPushButton *playButton = qobject_cast(sender()); int index=playButton->objectName().mid(5,2).toInt(); QString function=playButton->objectName().left(4); - QSettings settings("companion9x", "companion9x"); + QSettings settings("companion", "companion"); + int theme_set=settings.value("theme", 1).toInt(); + QString Theme; + switch(theme_set) { + case 0: + Theme="classic"; + break; + default: + Theme="monochrome"; + break; + } + QIcon PlayIcon; + populate_icon(&PlayIcon,Theme,"play.png"); + QIcon StopIcon; + populate_icon(&StopIcon,Theme,"stop.png"); + QString path=settings.value("sdPath", ".").toString(); QDir qd(path); QString track; @@ -217,12 +259,12 @@ void CustomFunctionsPanel::playMusic() clickObject->setCurrentSource(Phonon::MediaSource(track)); clickObject->play(); playBT[index]->setObjectName(QString("stop_%1").arg(index)); - playBT[index]->setIcon(QIcon(":/images/stop.png")); + playBT[index]->setIcon(StopIcon); } else { clickObject->stop(); clickObject->clear(); playBT[index]->setObjectName(QString("play_%1").arg(index)); - playBT[index]->setIcon(QIcon(":/images/play.png")); + playBT[index]->setIcon(PlayIcon); } #endif } @@ -457,6 +499,25 @@ void CustomFunctionsPanel::fsw_customContextMenuRequested(QPoint pos) { QLabel *label = (QLabel *)sender(); selectedFunction = label->property("index").toInt(); + QSettings settings("companion", "companion"); + int theme_set=settings.value("theme", 1).toInt(); + QString Theme; + switch(theme_set) { + case 0: + Theme="classic"; + break; + default: + Theme="monochrome"; + break; + } + QIcon ClearIcon; + populate_icon(&ClearIcon,Theme,"clear.png"); + QIcon CopyIcon; + populate_icon(&CopyIcon,Theme,"copy.png"); + QIcon CutIcon; + populate_icon(&CutIcon,Theme,"cut.png"); + QIcon PasteIcon; + populate_icon(&PasteIcon,Theme,"paste.png"); QPoint globalPos = label->mapToGlobal(pos); @@ -465,10 +526,10 @@ void CustomFunctionsPanel::fsw_customContextMenuRequested(QPoint pos) bool hasData = mimeData->hasFormat("application/x-companion9x-fsw"); QMenu contextMenu; - contextMenu.addAction(QIcon(":/images/clear.png"), tr("&Delete"),this,SLOT(fswDelete()),tr("Delete")); - contextMenu.addAction(QIcon(":/images/copy.png"), tr("&Copy"),this,SLOT(fswCopy()),tr("Ctrl+C")); - contextMenu.addAction(QIcon(":/images/cut.png"), tr("&Cut"),this,SLOT(fswCut()),tr("Ctrl+X")); - contextMenu.addAction(QIcon(":/images/paste.png"), tr("&Paste"),this,SLOT(fswPaste()),tr("Ctrl+V"))->setEnabled(hasData); + contextMenu.addAction(ClearIcon, tr("&Delete"),this,SLOT(fswDelete()),tr("Delete")); + contextMenu.addAction(CopyIcon, tr("&Copy"),this,SLOT(fswCopy()),tr("Ctrl+C")); + contextMenu.addAction(CutIcon, tr("&Cut"),this,SLOT(fswCut()),tr("Ctrl+X")); + contextMenu.addAction(PasteIcon, tr("&Paste"),this,SLOT(fswPaste()),tr("Ctrl+V"))->setEnabled(hasData); contextMenu.exec(globalPos); } diff --git a/companion/src/modeledit/customswitches.cpp b/companion/src/modeledit/customswitches.cpp index 8270689b6..487cd68cc 100644 --- a/companion/src/modeledit/customswitches.cpp +++ b/companion/src/modeledit/customswitches.cpp @@ -382,6 +382,25 @@ void CustomSwitchesPanel::csw_customContextMenuRequested(QPoint pos) { QLabel *label = (QLabel *)sender(); selectedSwitch = label->property("index").toInt(); + QSettings settings("companion", "companion"); + int theme_set=settings.value("theme", 1).toInt(); + QString Theme; + switch(theme_set) { + case 0: + Theme="classic"; + break; + default: + Theme="monochrome"; + break; + } + QIcon ClearIcon; + populate_icon(&ClearIcon,Theme,"clear.png"); + QIcon CopyIcon; + populate_icon(&CopyIcon,Theme,"copy.png"); + QIcon CutIcon; + populate_icon(&CutIcon,Theme,"cut.png"); + QIcon PasteIcon; + populate_icon(&PasteIcon,Theme,"paste.png"); QPoint globalPos = label->mapToGlobal(pos); @@ -390,10 +409,10 @@ void CustomSwitchesPanel::csw_customContextMenuRequested(QPoint pos) bool hasData = mimeData->hasFormat("application/x-companion9x-csw"); QMenu contextMenu; - contextMenu.addAction(QIcon(":/images/clear.png"), tr("&Delete"),this,SLOT(cswDelete()),tr("Delete")); - contextMenu.addAction(QIcon(":/images/copy.png"), tr("&Copy"),this,SLOT(cswCopy()),tr("Ctrl+C")); - contextMenu.addAction(QIcon(":/images/cut.png"), tr("&Cut"),this,SLOT(cswCut()),tr("Ctrl+X")); - contextMenu.addAction(QIcon(":/images/paste.png"), tr("&Paste"),this,SLOT(cswPaste()),tr("Ctrl+V"))->setEnabled(hasData); + contextMenu.addAction(ClearIcon, tr("&Delete"),this,SLOT(cswDelete()),tr("Delete")); + contextMenu.addAction(CopyIcon, tr("&Copy"),this,SLOT(cswCopy()),tr("Ctrl+C")); + contextMenu.addAction(CutIcon, tr("&Cut"),this,SLOT(cswCut()),tr("Ctrl+X")); + contextMenu.addAction(PasteIcon, tr("&Paste"),this,SLOT(cswPaste()),tr("Ctrl+V"))->setEnabled(hasData); contextMenu.exec(globalPos); } diff --git a/companion/src/modeledit/inputs.cpp b/companion/src/modeledit/inputs.cpp index 015080f76..fce9166e2 100644 --- a/companion/src/modeledit/inputs.cpp +++ b/companion/src/modeledit/inputs.cpp @@ -8,21 +8,38 @@ InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & g generalSettings(generalSettings), expoInserted(false) { + QSettings settings("companion", "companion"); + int theme_set=settings.value("theme", 1).toInt(); + QString Theme; + switch(theme_set) { + case 0: + Theme="classic"; + break; + default: + Theme="monochrome"; + break; + } + QGridLayout * exposLayout = new QGridLayout(this); ExposlistWidget = new MixersList(this, true); QPushButton * qbUp = new QPushButton(this); QPushButton * qbDown = new QPushButton(this); QPushButton * qbClear = new QPushButton(this); - + QIcon qbUpIcon; + populate_icon(&qbUpIcon,Theme,"moveup.png"); qbUp->setText(tr("Move Up")); - qbUp->setIcon(QIcon(":/images/moveup.png")); + qbUp->setIcon(qbUpIcon); qbUp->setShortcut(QKeySequence(tr("Ctrl+Up"))); + QIcon qbDownIcon; + populate_icon(&qbDownIcon,Theme,"movedown.png"); qbDown->setText(tr("Move Down")); - qbDown->setIcon(QIcon(":/images/movedown.png")); + qbDown->setIcon(qbDownIcon); qbDown->setShortcut(QKeySequence(tr("Ctrl+Down"))); + QIcon qbClearIcon; + populate_icon(&qbClearIcon,Theme,"clear.png"); qbClear->setText(tr("Clear Expo Settings")); - qbClear->setIcon(QIcon(":/images/clear.png")); + qbClear->setIcon(qbClearIcon); exposLayout->addWidget(ExposlistWidget,1,1,1,3); exposLayout->addWidget(qbUp,2,1); @@ -341,6 +358,35 @@ void InputsPanel::expoAdd() void InputsPanel::expolistWidget_customContextMenuRequested(QPoint pos) { + QSettings settings("companion", "companion"); + int theme_set=settings.value("theme", 1).toInt(); + QString Theme; + switch(theme_set) { + case 0: + Theme="classic"; + break; + default: + Theme="monochrome"; + break; + } + QIcon AddIcon; + populate_icon(&AddIcon,Theme,"add.png"); + QIcon EditIcon; + populate_icon(&EditIcon,Theme,"edit.png"); + QIcon ClearIcon; + populate_icon(&ClearIcon,Theme,"clear.png"); + QIcon CopyIcon; + populate_icon(&CopyIcon,Theme,"copy.png"); + QIcon CutIcon; + populate_icon(&CutIcon,Theme,"cut.png"); + QIcon PasteIcon; + populate_icon(&PasteIcon,Theme,"paste.png"); + QIcon DuplicateIcon; + populate_icon(&DuplicateIcon,Theme,"duplicate.png"); + QIcon MoveUpIcon; + populate_icon(&MoveUpIcon,Theme,"moveup.png"); + QIcon MoveDownIcon; + populate_icon(&MoveDownIcon,Theme,"movedown.png"); QPoint globalPos = ExposlistWidget->mapToGlobal(pos); const QClipboard *clipboard = QApplication::clipboard(); @@ -348,17 +394,17 @@ void InputsPanel::expolistWidget_customContextMenuRequested(QPoint pos) bool hasData = mimeData->hasFormat("application/x-companion9x-expo"); QMenu contextMenu; - contextMenu.addAction(QIcon(":/images/add.png"), tr("&Add"),this,SLOT(expoAdd()),tr("Ctrl+A")); - contextMenu.addAction(QIcon(":/images/edit.png"), tr("&Edit"),this,SLOT(expoOpen()),tr("Enter")); + contextMenu.addAction(AddIcon, tr("&Add"),this,SLOT(expoAdd()),tr("Ctrl+A")); + contextMenu.addAction(EditIcon, tr("&Edit"),this,SLOT(expoOpen()),tr("Enter")); contextMenu.addSeparator(); - contextMenu.addAction(QIcon(":/images/clear.png"), tr("&Delete"),this,SLOT(exposDelete()),tr("Delete")); - contextMenu.addAction(QIcon(":/images/copy.png"), tr("&Copy"),this,SLOT(exposCopy()),tr("Ctrl+C")); - contextMenu.addAction(QIcon(":/images/cut.png"), tr("&Cut"),this,SLOT(exposCut()),tr("Ctrl+X")); - contextMenu.addAction(QIcon(":/images/paste.png"), tr("&Paste"),this,SLOT(exposPaste()),tr("Ctrl+V"))->setEnabled(hasData); - contextMenu.addAction(QIcon(":/images/duplicate.png"), tr("Du&plicate"),this,SLOT(exposDuplicate()),tr("Ctrl+U")); + contextMenu.addAction(ClearIcon, tr("&Delete"),this,SLOT(exposDelete()),tr("Delete")); + contextMenu.addAction(CopyIcon, tr("&Copy"),this,SLOT(exposCopy()),tr("Ctrl+C")); + contextMenu.addAction(CutIcon, tr("&Cut"),this,SLOT(exposCut()),tr("Ctrl+X")); + contextMenu.addAction(PasteIcon, tr("&Paste"),this,SLOT(exposPaste()),tr("Ctrl+V"))->setEnabled(hasData); + contextMenu.addAction(DuplicateIcon, tr("Du&plicate"),this,SLOT(exposDuplicate()),tr("Ctrl+U")); contextMenu.addSeparator(); - contextMenu.addAction(QIcon(":/images/moveup.png"), tr("Move Up"),this,SLOT(moveExpoUp()),tr("Ctrl+Up")); - contextMenu.addAction(QIcon(":/images/movedown.png"), tr("Move Down"),this,SLOT(moveExpoDown()),tr("Ctrl+Down")); + contextMenu.addAction(MoveUpIcon, tr("Move Up"),this,SLOT(moveExpoUp()),tr("Ctrl+Up")); + contextMenu.addAction(MoveDownIcon, tr("Move Down"),this,SLOT(moveExpoDown()),tr("Ctrl+Down")); contextMenu.exec(globalPos); } diff --git a/companion/src/modeledit/mixes.cpp b/companion/src/modeledit/mixes.cpp index 63a4bcb9c..132cfc00e 100644 --- a/companion/src/modeledit/mixes.cpp +++ b/companion/src/modeledit/mixes.cpp @@ -8,6 +8,17 @@ MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & gen generalSettings(generalSettings), mixInserted(false) { + QSettings settings("companion", "companion"); + int theme_set=settings.value("theme", 1).toInt(); + QString Theme; + switch(theme_set) { + case 0: + Theme="classic"; + break; + default: + Theme="monochrome"; + break; + } QGridLayout * mixesLayout = new QGridLayout(this); MixerlistWidget = new MixersList(this, false); // TODO enum @@ -15,14 +26,20 @@ MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & gen QPushButton * qbDown = new QPushButton(this); QPushButton * qbClear = new QPushButton(this); + QIcon qbUpIcon; + populate_icon(&qbUpIcon,Theme,"moveup.png"); qbUp->setText(tr("Move Up")); - qbUp->setIcon(QIcon(":/images/moveup.png")); + qbUp->setIcon(qbUpIcon); qbUp->setShortcut(QKeySequence(tr("Ctrl+Up"))); + QIcon qbDownIcon; + populate_icon(&qbDownIcon,Theme,"movedown.png"); qbDown->setText(tr("Move Down")); - qbDown->setIcon(QIcon(":/images/movedown.png")); + qbDown->setIcon(qbDownIcon); qbDown->setShortcut(QKeySequence(tr("Ctrl+Down"))); + QIcon qbClearIcon; + populate_icon(&qbClearIcon,Theme,"clear.png"); qbClear->setText(tr("Clear Mixes")); - qbClear->setIcon(QIcon(":/images/clear.png")); + qbClear->setIcon(qbClearIcon); mixesLayout->addWidget(MixerlistWidget,1,1,1,3); mixesLayout->addWidget(qbUp,2,1); @@ -406,6 +423,35 @@ void MixesPanel::mixerAdd() void MixesPanel::mixerlistWidget_customContextMenuRequested(QPoint pos) { + QSettings settings("companion", "companion"); + int theme_set=settings.value("theme", 1).toInt(); + QString Theme; + switch(theme_set) { + case 0: + Theme="classic"; + break; + default: + Theme="monochrome"; + break; + } + QIcon AddIcon; + populate_icon(&AddIcon,Theme,"add.png"); + QIcon EditIcon; + populate_icon(&EditIcon,Theme,"edit.png"); + QIcon ClearIcon; + populate_icon(&ClearIcon,Theme,"clear.png"); + QIcon CopyIcon; + populate_icon(&CopyIcon,Theme,"copy.png"); + QIcon CutIcon; + populate_icon(&CutIcon,Theme,"cut.png"); + QIcon PasteIcon; + populate_icon(&PasteIcon,Theme,"paste.png"); + QIcon DuplicateIcon; + populate_icon(&DuplicateIcon,Theme,"duplicate.png"); + QIcon MoveUpIcon; + populate_icon(&MoveUpIcon,Theme,"moveup.png"); + QIcon MoveDownIcon; + populate_icon(&MoveDownIcon,Theme,"movedown.png"); QPoint globalPos = MixerlistWidget->mapToGlobal(pos); const QClipboard *clipboard = QApplication::clipboard(); @@ -413,17 +459,17 @@ void MixesPanel::mixerlistWidget_customContextMenuRequested(QPoint pos) bool hasData = mimeData->hasFormat("application/x-companion9x-mix"); QMenu contextMenu; - contextMenu.addAction(QIcon(":/images/add.png"), tr("&Add"),this,SLOT(mixerAdd()),tr("Ctrl+A")); - contextMenu.addAction(QIcon(":/images/edit.png"), tr("&Edit"),this,SLOT(mixerOpen()),tr("Enter")); + contextMenu.addAction(AddIcon, tr("&Add"),this,SLOT(mixerAdd()),tr("Ctrl+A")); + contextMenu.addAction(EditIcon, tr("&Edit"),this,SLOT(mixerOpen()),tr("Enter")); contextMenu.addSeparator(); - contextMenu.addAction(QIcon(":/images/clear.png"), tr("&Delete"),this,SLOT(mixersDelete()),tr("Delete")); - contextMenu.addAction(QIcon(":/images/copy.png"), tr("&Copy"),this,SLOT(mixersCopy()),tr("Ctrl+C")); - contextMenu.addAction(QIcon(":/images/cut.png"), tr("&Cut"),this,SLOT(mixersCut()),tr("Ctrl+X")); - contextMenu.addAction(QIcon(":/images/paste.png"), tr("&Paste"),this,SLOT(mixersPaste()),tr("Ctrl+V"))->setEnabled(hasData); - contextMenu.addAction(QIcon(":/images/duplicate.png"), tr("Du&plicate"),this,SLOT(mixersDuplicate()),tr("Ctrl+U")); + contextMenu.addAction(ClearIcon, tr("&Delete"),this,SLOT(mixersDelete()),tr("Delete")); + contextMenu.addAction(CopyIcon, tr("&Copy"),this,SLOT(mixersCopy()),tr("Ctrl+C")); + contextMenu.addAction(CutIcon, tr("&Cut"),this,SLOT(mixersCut()),tr("Ctrl+X")); + contextMenu.addAction(PasteIcon, tr("&Paste"),this,SLOT(mixersPaste()),tr("Ctrl+V"))->setEnabled(hasData); + contextMenu.addAction(DuplicateIcon, tr("Du&plicate"),this,SLOT(mixersDuplicate()),tr("Ctrl+U")); contextMenu.addSeparator(); - contextMenu.addAction(QIcon(":/images/moveup.png"), tr("Move Up"),this,SLOT(moveMixUp()),tr("Ctrl+Up")); - contextMenu.addAction(QIcon(":/images/movedown.png"), tr("Move Down"),this,SLOT(moveMixDown()),tr("Ctrl+Down")); + contextMenu.addAction(MoveUpIcon, tr("Move Up"),this,SLOT(moveMixUp()),tr("Ctrl+Up")); + contextMenu.addAction(MoveDownIcon, tr("Move Down"),this,SLOT(moveMixDown()),tr("Ctrl+Down")); contextMenu.exec(globalPos); } diff --git a/companion/src/modeledit/modeledit.cpp b/companion/src/modeledit/modeledit.cpp index d5417e8ea..8cf90bece 100644 --- a/companion/src/modeledit/modeledit.cpp +++ b/companion/src/modeledit/modeledit.cpp @@ -7,6 +7,7 @@ #include "mixes.h" #include "channels.h" #include "curves.h" +#include "../helpers.h" #include "customswitches.h" #include "customfunctions.h" #include "telemetry.h" @@ -22,6 +23,19 @@ ModelEdit::ModelEdit(RadioData & radioData, int modelId, bool openWizard, bool i ui->setupUi(this); QSettings settings("companion", "companion"); restoreGeometry(settings.value("modelEditGeometry").toByteArray()); + int theme_set=settings.value("theme", 1).toInt(); + QString Theme; + switch(theme_set) { + case 0: + Theme="classic"; + break; + default: + Theme="monochrome"; + break; + } + QIcon SimulateIcon; + populate_icon(&SimulateIcon,Theme,"simulate.png"); + ui->pushButton->setIcon(SimulateIcon); addTab(new Setup(this, model), tr("Setup")); addTab(new HeliPanel(this, model), tr("Heli")); addTab(new FlightModes(this, model, radioData.generalSettings), tr("Flight Modes")); diff --git a/companion/src/modeledit/modeledit.ui b/companion/src/modeledit/modeledit.ui index a4ac2fa1e..9002e383b 100644 --- a/companion/src/modeledit/modeledit.ui +++ b/companion/src/modeledit/modeledit.ui @@ -20,7 +20,7 @@ Dialog - + :/icon.png:/icon.png @@ -50,10 +50,6 @@ Simulate - - - :/images/simulate.png:/images/simulate.png - @@ -61,7 +57,7 @@ - + diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index 0302d367e..1d67137d1 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -353,7 +353,7 @@ Setup::Setup(QWidget *parent, ModelData & model): if (GetEepromInterface()->getCapability(ModelImage)) { QStringList items; items.append(""); - QSettings settings("companion9x", "companion9x"); + QSettings settings("companion", "companion"); QString path = settings.value("sdPath", ".").toString(); path.append("/BMP/"); QDir qd(path); @@ -497,7 +497,7 @@ void Setup::on_image_currentIndexChanged(int index) { if (!lock) { strncpy(model.bitmap, ui->image->currentText().toAscii(), GetEepromInterface()->getCapability(VoicesMaxLength)); - QSettings settings("companion9x", "companion9x"); + QSettings settings("companion", "companion"); QString path=settings.value("sdPath", ".").toString(); path.append("/BMP/"); QDir qd(path); diff --git a/companion/src/modeledit/telemetry.cpp b/companion/src/modeledit/telemetry.cpp index 22db68ae4..e0637f4df 100644 --- a/companion/src/modeledit/telemetry.cpp +++ b/companion/src/modeledit/telemetry.cpp @@ -342,7 +342,7 @@ TelemetryPanel::~TelemetryPanel() void TelemetryPanel::setup() { - QSettings settings("companion9x", "companion9x"); + QSettings settings("companion", "companion"); QString firmware_id = settings.value("firmware", default_firmware_variant.id).toString(); lock=true; diff --git a/companion/src/modelslist.cpp b/companion/src/modelslist.cpp index 4f3b3eb02..a2984c02c 100644 --- a/companion/src/modelslist.cpp +++ b/companion/src/modelslist.cpp @@ -41,6 +41,7 @@ #include "modelslist.h" #include "mdichild.h" +#include "helpers.h" class DragDropHeader { public: @@ -82,23 +83,58 @@ void ModelsListWidget::ShowContextMenu(const QPoint& pos) const QClipboard *clipboard = QApplication::clipboard(); const QMimeData *mimeData = clipboard->mimeData(); bool hasData = mimeData->hasFormat("application/x-companion9x"); + QSettings settings("companion", "companion"); + int theme_set=settings.value("theme", 1).toInt(); + QString Theme; + switch(theme_set) { + case 0: + Theme="classic"; + break; + default: + Theme="monochrome"; + break; + } + QIcon AddIcon; + populate_icon(&AddIcon,Theme,"add.png"); + QIcon EditIcon; + populate_icon(&EditIcon,Theme,"edit.png"); + QIcon OpenIcon; + populate_icon(&OpenIcon,Theme,"open.png"); + QIcon WizardIcon; + populate_icon(&WizardIcon,Theme,"wizard.png"); + QIcon ClearIcon; + populate_icon(&ClearIcon,Theme,"clear.png"); + QIcon CopyIcon; + populate_icon(&CopyIcon,Theme,"copy.png"); + QIcon CutIcon; + populate_icon(&CutIcon,Theme,"cut.png"); + QIcon PasteIcon; + populate_icon(&PasteIcon,Theme,"paste.png"); + QIcon DuplicateIcon; + populate_icon(&DuplicateIcon,Theme,"duplicate.png"); + QIcon CurrentModelIcon; + populate_icon(&CurrentModelIcon,Theme,"currentmodel.png"); + QIcon PrintIcon; + populate_icon(&PrintIcon,Theme,"print.png"); + QIcon SimulateIcon; + populate_icon(&SimulateIcon,Theme,"simulate.png"); QMenu contextMenu; - contextMenu.addAction(QIcon(":/images/edit.png"), tr("&Edit"),this,SLOT(OpenEditWindow())); - contextMenu.addAction(QIcon(":/images/open.png"), tr("&Restore from backup"),this,SLOT(LoadBackup())); - contextMenu.addAction(QIcon(":/images/wizard.png"), tr("&Model Wizard"),this,SLOT(OpenWizard())); + contextMenu.addAction(EditIcon, tr("&Edit"),this,SLOT(OpenEditWindow())); + contextMenu.addAction(OpenIcon, tr("&Restore from backup"),this,SLOT(LoadBackup())); + contextMenu.addAction(WizardIcon, tr("&Model Wizard"),this,SLOT(OpenWizard())); contextMenu.addSeparator(); - contextMenu.addAction(QIcon(":/images/clear.png"), tr("&Delete"),this,SLOT(confirmDelete()),tr("Delete")); - contextMenu.addAction(QIcon(":/images/copy.png"), tr("&Copy"),this,SLOT(copy()),tr("Ctrl+C")); - contextMenu.addAction(QIcon(":/images/cut.png"), tr("&Cut"),this,SLOT(cut()),tr("Ctrl+X")); - contextMenu.addAction(QIcon(":/images/paste.png"), tr("&Paste"),this,SLOT(paste()),tr("Ctrl+V"))->setEnabled(hasData); - contextMenu.addAction(QIcon(":/images/duplicate.png"), tr("D&uplicate"),this,SLOT(duplicate()),tr("Ctrl+U")); + contextMenu.addAction(ClearIcon, tr("&Delete"),this,SLOT(confirmDelete()),tr("Delete")); + contextMenu.addAction(CopyIcon, tr("&Copy"),this,SLOT(copy()),tr("Ctrl+C")); + contextMenu.addAction(CutIcon, tr("&Cut"),this,SLOT(cut()),tr("Ctrl+X")); + contextMenu.addAction(PasteIcon, tr("&Paste"),this,SLOT(paste()),tr("Ctrl+V"))->setEnabled(hasData); + contextMenu.addAction(DuplicateIcon, tr("D&uplicate"),this,SLOT(duplicate()),tr("Ctrl+U")); contextMenu.addSeparator(); - contextMenu.addAction(QIcon(":/images/currentmodel.png"), tr("&Use as default"),this,SLOT(setdefault())); + contextMenu.addAction(CurrentModelIcon, tr("&Use as default"),this,SLOT(setdefault())); contextMenu.addSeparator(); - contextMenu.addAction(QIcon(":/images/print.png"), tr("P&rint model"),this, SLOT(print()),tr("Alt+R")); + contextMenu.addAction(PrintIcon, tr("P&rint model"),this, SLOT(print()),tr("Alt+R")); contextMenu.addSeparator(); - contextMenu.addAction(QIcon(":/images/simulate.png"), tr("&Simulate model"),this, SLOT(simulate()),tr("Alt+S")); + contextMenu.addAction(SimulateIcon, tr("&Simulate model"),this, SLOT(simulate()),tr("Alt+S")); contextMenu.exec(globalPos); } diff --git a/companion/src/preferencesdialog.cpp b/companion/src/preferencesdialog.cpp index bcb152962..839c554a3 100644 --- a/companion/src/preferencesdialog.cpp +++ b/companion/src/preferencesdialog.cpp @@ -30,8 +30,14 @@ preferencesDialog::preferencesDialog(QWidget *parent) : Theme="monochrome"; break; } - Icon.addPixmap(":/themes/"+Theme+"/preferences.png"); + populate_icon(&Icon, Theme, "preferences.png"); this->setWindowIcon(Icon); + QIcon LibraryIcon; + populate_icon(&LibraryIcon, Theme, "library.png"); + ui->splashLibraryButton->setIcon(LibraryIcon); + QIcon ClearIcon; + populate_icon(&ClearIcon, Theme, "clear.png"); + ui->clearImageButton->setIcon(ClearIcon); QCheckBox * OptionCheckBox[]= { ui->optionCheckBox_1, ui->optionCheckBox_2, ui->optionCheckBox_3, ui->optionCheckBox_4, ui->optionCheckBox_5, ui->optionCheckBox_6, ui->optionCheckBox_7, diff --git a/companion/src/preferencesdialog.ui b/companion/src/preferencesdialog.ui index e2a16d63d..c05efb26a 100644 --- a/companion/src/preferencesdialog.ui +++ b/companion/src/preferencesdialog.ui @@ -176,10 +176,6 @@ ... - - - :/images/clear.png:/images/clear.png - @@ -243,10 +239,6 @@ ... - - - :/images/library.png:/images/library.png - diff --git a/companion/src/printdialog.ui b/companion/src/printdialog.ui index 5e45d5a2c..169c33103 100644 --- a/companion/src/printdialog.ui +++ b/companion/src/printdialog.ui @@ -27,7 +27,7 @@ - :/images/print.png:/images/print.png + :/icon.png:/icon.png diff --git a/companion/src/themes/monochrome/16/customize.png b/companion/src/themes/monochrome/16/customize.png new file mode 100644 index 0000000000000000000000000000000000000000..078d0af75638cd472e47a5ff15d3e72407d5f23b GIT binary patch literal 381 zcmV-@0fPRCP)m&H)T;i5Q?0wbq~1C!8%1{M`4GmJ^7 zti46;ui^pqozGQF4R$74)!sH>23mmt^<`Gq<{rOL`Y$T~_^yu@yBODeEm@P@zf}6b z^IsO%n%yt+Caf+0-CV|yz4w;<7UqcctiPKJ7_#TS;lIWBW`6HC_J<7Dsy;?#uy1(J z-@yhX-q~KtWBC2=!L`M2**09;{MXUCVXJ+`ml?Ym-~48t-}{h3Mw|Pgf}`2$4`Mpdp2%nIJR*UL){JeA2~eiAQ_-qi!iYR64u-aK(z)S z?b~Ovfao9m$4`a-Ivmfio`LZO3)g}41q?DQoCg9oFdQ@RU`UqHY53SIz}Pdtg)`xg zMhL^>^oKtgVt6{)9%MzBFidw|%(z2Nj_<$>GpUBhw=)=yZF$JB=lNnriOX)x1vS#V zKna-!!(0=F~6@vd$@?2>^$4&Mp7| literal 0 HcmV?d00001 diff --git a/companion/src/themes/monochrome/16/stop.png b/companion/src/themes/monochrome/16/stop.png new file mode 100644 index 0000000000000000000000000000000000000000..3bf2af6e958f4cb76597b5817813e8a2e2b9e271 GIT binary patch literal 312 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSjKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgf<9v*Q4{-;v&Du6;eJY5_^DsH{K z#K_BFz`m&H)T;i5Q?0wbq~1C!8%1{M`4GmJ^7 zti46;ui^pqozGQF4R$74)!sH>23mmt^<`Gq<{rOL`Y$T~_^yu@yBODeEm@P@zf}6b z^IsO%n%yt+Caf+0-CV|yz4w;<7UqcctiPKJ7_#TS;lIWBW`6HC_J<7Dsy;?#uy1(J z-@yhX-q~KtWBC2=!L`M2**09;{MXUCVXJ+`ml?Ym-~48t-}{h3Mw|Pgf}`2$4`Mpdp2%nIJR*UL){JeA2~eiAQ_-qi!iYR64u-aK(z)S z?b~Ovfao9m$4`a-Ivmfio`LZO3)g}41q?DQoCg9oFdQ@RU`UqHY53SIz}Pdtg)`xg zMhL^>^oKtgVt6{)9%MzBFidw|%(z2Nj_<$>GpUBhw=)=yZF$JB=lNnriOX)x1vS#V zKna-!!(0=F~6@vd$@?2>^$4&Mp7| literal 0 HcmV?d00001 diff --git a/companion/src/themes/monochrome/24/stop.png b/companion/src/themes/monochrome/24/stop.png new file mode 100644 index 0000000000000000000000000000000000000000..3bf2af6e958f4cb76597b5817813e8a2e2b9e271 GIT binary patch literal 312 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSjKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgf<9v*Q4{-;v&Du6;eJY5_^DsH{K z#K_BFz`m&H)T;i5Q?0wbq~1C!8%1{M`4GmJ^7 zti46;ui^pqozGQF4R$74)!sH>23mmt^<`Gq<{rOL`Y$T~_^yu@yBODeEm@P@zf}6b z^IsO%n%yt+Caf+0-CV|yz4w;<7UqcctiPKJ7_#TS;lIWBW`6HC_J<7Dsy;?#uy1(J z-@yhX-q~KtWBC2=!L`M2**09;{MXUCVXJ+`ml?Ym-~48t-}{h3Mw|Pgf}`2$4`Mpdp2%nIJR*UL){JeA2~eiAQ_-qi!iYR64u-aK(z)S z?b~Ovfao9m$4`a-Ivmfio`LZO3)g}41q?DQoCg9oFdQ@RU`UqHY53SIz}Pdtg)`xg zMhL^>^oKtgVt6{)9%MzBFidw|%(z2Nj_<$>GpUBhw=)=yZF$JB=lNnriOX)x1vS#V zKna-!!(0=F~6@vd$@?2>^$4&Mp7| literal 0 HcmV?d00001 diff --git a/companion/src/themes/monochrome/32/stop.png b/companion/src/themes/monochrome/32/stop.png new file mode 100644 index 0000000000000000000000000000000000000000..3bf2af6e958f4cb76597b5817813e8a2e2b9e271 GIT binary patch literal 312 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSjKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgf<9v*Q4{-;v&Du6;eJY5_^DsH{K z#K_BFz`m&H)T;i5Q?0wbq~1C!8%1{M`4GmJ^7 zti46;ui^pqozGQF4R$74)!sH>23mmt^<`Gq<{rOL`Y$T~_^yu@yBODeEm@P@zf}6b z^IsO%n%yt+Caf+0-CV|yz4w;<7UqcctiPKJ7_#TS;lIWBW`6HC_J<7Dsy;?#uy1(J z-@yhX-q~KtWBC2=!L`M2**09;{MXUCVXJ+`ml?Ym-~48t-}{h3Mw|Pgf}`2$4`Mpdp2%nIJR*UL){JeA2~eiAQ_-qi!iYR64u-aK(z)S z?b~Ovfao9m$4`a-Ivmfio`LZO3)g}41q?DQoCg9oFdQ@RU`UqHY53SIz}Pdtg)`xg zMhL^>^oKtgVt6{)9%MzBFidw|%(z2Nj_<$>GpUBhw=)=yZF$JB=lNnriOX)x1vS#V zKna-!!(0=F~6@vd$@?2>^$4&Mp7| literal 0 HcmV?d00001 diff --git a/companion/src/themes/monochrome/48/stop.png b/companion/src/themes/monochrome/48/stop.png new file mode 100644 index 0000000000000000000000000000000000000000..3bf2af6e958f4cb76597b5817813e8a2e2b9e271 GIT binary patch literal 312 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSjKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgf<9v*Q4{-;v&Du6;eJY5_^DsH{K z#K_BFz`