Companion now should fully support themes

This commit is contained in:
Romolo Manfredini
2014-01-20 00:05:16 +01:00
parent 0f2cc257cd
commit 034130555e
16 changed files with 158 additions and 43 deletions
+71 -5
View File
@@ -2,6 +2,7 @@
#include "ui_burnconfigdialog.h"
#include "avroutputdialog.h"
#include "eeprominterface.h"
#include "helpers.h"
#include <QtGui>
#if !defined WIN32 && defined __GNUC__
@@ -278,7 +279,20 @@ void burnConfigDialog::listProgrammers()
QStringList arguments;
arguments << "-c?";
avrOutputDialog *ad = new avrOutputDialog(this, ui->avrdude_location->text(), arguments, "List available programmers", AVR_DIALOG_KEEP_OPEN, TRUE);
ad->setWindowIcon(QIcon(":/images/list.png"));
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 Icon;
populate_icon(&Icon,Theme,"list.png");
ad->setWindowIcon(Icon);
ad->show();
}
@@ -295,7 +309,20 @@ void burnConfigDialog::on_pushButton_4_clicked()
arguments << "-?";
avrOutputDialog *ad = new avrOutputDialog(this, ui->avrdude_location->text(), arguments, "Show help", AVR_DIALOG_KEEP_OPEN,TRUE);
ad->setWindowIcon(QIcon(":/images/configure.png"));
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 Icon;
populate_icon(&Icon,Theme,"configure.png");
ad->setWindowIcon(Icon);
ad->show();
}
@@ -312,7 +339,20 @@ void burnConfigDialog::readFuses()
arguments << "-c" << avrProgrammer << "-p" << avrMCU << args << str;
avrOutputDialog *ad = new avrOutputDialog(this, avrLoc, arguments, "Read Fuses",AVR_DIALOG_KEEP_OPEN,TRUE);
ad->setWindowIcon(QIcon(":/images/fuses.png"));
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 Icon;
populate_icon(&Icon,Theme,"fuses.png");
ad->setWindowIcon(Icon);
ad->show();
}
@@ -346,7 +386,20 @@ void burnConfigDialog::restFuses(bool eeProtect)
QStringList argread;
argread << "-c" << avrProgrammer << "-p" << avrMCU << args <<"-U" << "lfuse:r:"+tempFile+":r" ;
avrOutputDialog *ad = new avrOutputDialog(this, avrLoc, argread, "Reset Fuses",AVR_DIALOG_CLOSE_IF_SUCCESSFUL,FALSE);
ad->setWindowIcon(QIcon(":/images/fuses.png"));
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 Icon;
populate_icon(&Icon,Theme,"fuses.png");
ad->setWindowIcon(Icon);
ad->exec();
QFile file(tempFile);
if (file.exists() && file.size()==1) {
@@ -375,7 +428,20 @@ void burnConfigDialog::restFuses(bool eeProtect)
arguments << "-c" << avrProgrammer << "-p" << avrMCU << args << "-B" << "100" << "-u" << str;
}
avrOutputDialog *ad = new avrOutputDialog(this, avrLoc, arguments, "Reset Fuses",AVR_DIALOG_KEEP_OPEN,TRUE);
ad->setWindowIcon(QIcon(":/images/fuses.png"));
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 Icon;
populate_icon(&Icon,Theme,"fuses.png");
ad->setWindowIcon(Icon);
ad->show();
}
+1 -1
View File
@@ -27,7 +27,7 @@
</property>
<property name="windowIcon">
<iconset resource="companion.qrc">
<normaloff>:/images/configure.png</normaloff>:/images/configure.png</iconset>
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="2" column="0">
+14
View File
@@ -16,6 +16,20 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
hexType(Type)
{
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 LibraryIcon;
populate_icon(&LibraryIcon,Theme,"library.png");
ui->libraryButton->setIcon(LibraryIcon);
ui->SplashFrame->hide();
ui->FramFWInfo->hide();
ui->EEbackupCB->hide();
+2 -6
View File
@@ -26,8 +26,8 @@
<string>Customize Splash</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>:/images/c_home.png</normaloff>:/images/c_home.png</iconset>
<iconset resource="companion.qrc">
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="1" column="0">
@@ -455,10 +455,6 @@
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="companion.qrc">
<normaloff>:/images/library.png</normaloff>:/images/library.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
+1
View File
@@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>images/customize.png</file>
<file>icon.png</file>
<file>../../CREDITS.txt</file>
<file>../../DONATIONS.txt</file>
+14
View File
@@ -11,6 +11,20 @@ customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::customizeSplashDialog) {
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 LibraryIcon;
populate_icon(&LibraryIcon,Theme,"library.png");
ui->libraryButton->setIcon(LibraryIcon);
ui->HowToLabel->clear();
ui->HowToLabel->append("<center>" + tr("Select an original firmware file") + "</center>");
}
+2 -6
View File
@@ -20,8 +20,8 @@
<string>Customize Splash</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>:/images/c_home.png</normaloff>:/images/c_home.png</iconset>
<iconset resource="companion.qrc">
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
@@ -211,10 +211,6 @@ p, li { white-space: pre-wrap; }
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="companion.qrc">
<normaloff>:/images/library.png</normaloff>:/images/library.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
+1 -1
View File
@@ -15,7 +15,7 @@
</property>
<property name="windowIcon">
<iconset resource="companion.qrc">
<normaloff>:/images/fuses.png</normaloff>:/images/fuses.png</iconset>
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="2">

Before

Width:  |  Height:  |  Size: 381 B

After

Width:  |  Height:  |  Size: 381 B

+28 -6
View File
@@ -523,6 +523,16 @@ QString MdiChild::strippedName(const QString &fullFileName)
void MdiChild::burnTo() // write to Tx
{
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;
}
bool backupEnable=settings.value("backupEnable", true).toBool();
QString backupPath=settings.value("backupPath", "").toString();
if (!backupPath.isEmpty()) {
@@ -567,14 +577,18 @@ void MdiChild::burnTo() // write to Tx
QStringList str;
str << path << backupFile;
avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Backup EEPROM From Tx")); //, AVR_DIALOG_KEEP_OPEN);
ad->setWindowIcon(QIcon(":/images/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 EEPROM From Tx"));
ad->setWindowIcon(QIcon(":/images/read_eeprom.png"));
QIcon Icon;
populate_icon(&Icon,Theme,"read_eeprom.png");
ad->setWindowIcon(Icon);
ad->exec();
sleep(1);
}
@@ -583,7 +597,9 @@ void MdiChild::burnTo() // write to Tx
QString tempFlash=tempDir + "/flash.bin";
QStringList str = ((MainWindow *)this->parent())->GetReceiveFlashCommand(tempFlash);
avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, "Read Flash From Tx");
ad->setWindowIcon(QIcon(":/images/read_flash.png"));
QIcon Icon;
populate_icon(&Icon,Theme,"read_flash.png");
ad->setWindowIcon(Icon);
ad->exec();
sleep(1);
QString restoreFile = tempDir + "/compat.bin";
@@ -619,7 +635,9 @@ void MdiChild::burnTo() // write to Tx
} else {
QStringList str = ((MainWindow *)this->parent())->GetReceiveEEpromCommand(backupFile);
avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, tr("Backup EEPROM From Tx"));
ad->setWindowIcon(QIcon(":/images/read_eeprom.png"));
QIcon Icon;
populate_icon(&Icon,Theme,"read_eeprom.png");
ad->setWindowIcon(Icon);
ad->exec();
sleep(1);
}
@@ -634,14 +652,18 @@ void MdiChild::burnTo() // write to Tx
QStringList str;
str << tempFile << path;
avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Write EEPROM To Tx"), AVR_DIALOG_SHOW_DONE); //, AVR_DIALOG_KEEP_OPEN);
ad->setWindowIcon(QIcon(":/images/read_eeprom.png"));
QIcon Icon;
populate_icon(&Icon,Theme,"read_eeprom.png");
ad->setWindowIcon(Icon);
ad->show();
sleep(1);
}
} else {
QStringList str = ((MainWindow *)this->parent())->GetSendEEpromCommand(tempFile);
avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, "Write EEPROM To Tx", AVR_DIALOG_SHOW_DONE);
ad->setWindowIcon(QIcon(":/images/write_eeprom.png"));
QIcon Icon;
populate_icon(&Icon,Theme,"write_eeprom.png");
ad->setWindowIcon(Icon);
ad->show();
}
}
+1 -1
View File
@@ -27,7 +27,7 @@
</property>
<property name="windowIcon">
<iconset resource="companion.qrc">
<normaloff>:/images/configure.png</normaloff>:/images/configure.png</iconset>
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,1" columnstretch="0,0,1,1,1,1">
<item row="3" column="2">
+1 -6
View File
@@ -27,7 +27,7 @@
</property>
<property name="windowIcon">
<iconset resource="companion.qrc">
<normaloff>:/images/simulate.png</normaloff>:/images/simulate.png</iconset>
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<property name="margin">
@@ -1092,8 +1092,6 @@ QPushButton:checked {
</property>
</widget>
</item>
<item row="0" column="4" rowspan="3">
<widget class="menuWidget" name="menu" native="true">
<property name="sizePolicy">
@@ -1812,8 +1810,6 @@ QPushButton:checked {
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
@@ -2298,7 +2294,6 @@ border-radius: 4px;
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_ch01">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
+17
View File
@@ -9,6 +9,23 @@
splashLibrary::splashLibrary(QWidget *parent, QString * fileName) : QDialog(parent), ui(new Ui::splashLibrary) {
splashFileName = fileName;
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 NextIcon;
populate_icon(&NextIcon,Theme,"arrow-right.png");
QIcon PrevIcon;
populate_icon(&PrevIcon,Theme,"arrow-left.png");
ui->nextPage->setIcon(NextIcon);
ui->prevPage->setIcon(PrevIcon);
page = 0;
getFileList();
if (imageList.size() > 20) {
+4 -8
View File
@@ -25,6 +25,10 @@
<property name="windowTitle">
<string/>
</property>
<property name="windowIcon">
<iconset resource="companion.qrc">
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QToolButton" name="prevPage">
@@ -46,10 +50,6 @@
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="companion.qrc">
<normaloff>:/images/arrow-left.png</normaloff>:/images/arrow-left.png</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
@@ -945,10 +945,6 @@
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="companion.qrc">
<normaloff>:/images/arrow-right.png</normaloff>:/images/arrow-right.png</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 864 B

+1 -3
View File
@@ -27,7 +27,7 @@
</property>
<property name="windowIcon">
<iconset resource="companion.qrc">
<normaloff>:/images/simulate.png</normaloff>:/images/simulate.png</iconset>
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<property name="margin">
@@ -2053,8 +2053,6 @@ border-radius: 4px;
<width>16777215</width>
<height>18</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QSlider::sub-page:horizontal:disabled {