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
+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();
}
}