Merge pull request #661 from opentx/dvogonen/simplify_companion_preferences_dialog_632

Dvogonen/simplify companion preferences dialog 632
This commit is contained in:
Bertrand Songis
2014-02-08 07:48:37 +01:00
155 changed files with 12015 additions and 4015 deletions
+6
View File
@@ -156,6 +156,8 @@ SET( companion_SRCS
mountlist.cpp
avroutputdialog.cpp
preferencesdialog.cpp
apppreferencesdialog.cpp
fwpreferencesdialog.cpp
burnconfigdialog.cpp
comparedialog.cpp
contributorsdialog.cpp
@@ -177,6 +179,8 @@ SET( companion_SRCS
SET( companion_MOC_HDRS
avroutputdialog.h
preferencesdialog.h
apppreferencesdialog.h
fwpreferencesdialog.h
burnconfigdialog.h
comparedialog.h
printdialog.h
@@ -211,6 +215,8 @@ SET( companion_UIS
fusesdialog.ui
logsdialog.ui
preferencesdialog.ui
apppreferencesdialog.ui
fwpreferencesdialog.ui
simulatordialog.ui
xsimulatordialog.ui
burnconfigdialog.ui
+224
View File
@@ -0,0 +1,224 @@
#include "apppreferencesdialog.h"
#include "ui_apppreferencesdialog.h"
#include "mainwindow.h"
#include "helpers.h"
#ifdef JOYSTICKS
#include "joystick.h"
#include "joystickdialog.h"
#endif
#include <QDesktopServices>
#include <QtGui>
appPreferencesDialog::appPreferencesDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::appPreferencesDialog)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("preferences.png"));
initSettings();
connect(this, SIGNAL(accepted()), this, SLOT(writeValues()));
#ifndef JOYSTICKS
ui->joystickCB->hide();
ui->joystickCB->setDisabled(true);
ui->joystickcalButton->hide();
ui->joystickChkB->hide();
ui->label_11->hide();
#endif
resize(0,0);
}
appPreferencesDialog::~appPreferencesDialog()
{
delete ui;
}
void appPreferencesDialog::writeValues()
{
QSettings settings;
settings.setValue("startup_check_companion", ui->startupCheck_companion9x->isChecked());
settings.setValue("startup_check_fw", ui->startupCheck_fw->isChecked());
settings.setValue("wizardEnable", ui->wizardEnable_ChkB->isChecked());
settings.setValue("show_splash", ui->showSplash->isChecked());
settings.setValue("simuSW", ui->simuSW->isChecked());
settings.setValue("history_size", ui->historySize->value());
settings.setValue("backLight", ui->backLightColor->currentIndex());
settings.setValue("libraryPath", ui->libraryPath->text());
settings.setValue("gePath", ui->ge_lineedit->text());
settings.setValue("embedded_splashes", ui->splashincludeCB->currentIndex());
settings.setValue("backupEnable", ui->backupEnable->isChecked());
if (ui->joystickChkB ->isChecked() && ui->joystickCB->isEnabled()) {
settings.setValue("js_support", ui->joystickChkB ->isChecked());
settings.setValue("js_ctrl", ui->joystickCB ->currentIndex());
}
else {
settings.remove("js_support");
settings.remove("js_ctrl");
}
MainWindow * mw = (MainWindow *)this->parent();
mw->unloadProfile();
}
void appPreferencesDialog::on_snapshotPathButton_clicked()
{
QSettings settings;
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your snapshot folder"), settings.value("snapshotPath").toString());
if (!fileName.isEmpty()) {
settings.setValue("snapshotpath", fileName);
settings.setValue("snapshot_to_clipboard", false);
ui->snapshotPath->setText(fileName);
}
}
void appPreferencesDialog::initSettings()
{
QSettings settings;
ui->snapshotClipboardCKB->setChecked(settings.value("snapshot_to_clipboard", false).toBool());
QString Path=settings.value("snapshotPath", "").toString();
if (QDir(Path).exists()) {
ui->snapshotPath->setText(Path);
ui->snapshotPath->setReadOnly(true);
}
if (ui->snapshotClipboardCKB->isChecked()) {
ui->snapshotPath->setDisabled(true);
ui->snapshotPathButton->setDisabled(true);
}
ui->startupCheck_companion9x->setChecked(settings.value("startup_check_companion", true).toBool());
ui->startupCheck_fw->setChecked(settings.value("startup_check_fw", true).toBool());
ui->wizardEnable_ChkB->setChecked(settings.value("wizardEnable", true).toBool());
ui->showSplash->setChecked(settings.value("show_splash", true).toBool());
ui->historySize->setValue(settings.value("history_size", 10).toInt());
ui->backLightColor->setCurrentIndex(settings.value("backLight", 0).toInt());
ui->simuSW->setChecked(settings.value("simuSW", false).toBool());
Path=settings.value("libraryPath", "").toString();
if (QDir(Path).exists()) {
ui->libraryPath->setText(Path);
}
Path=settings.value("gePath", "").toString();
if (QFile(Path).exists()) {
ui->ge_lineedit->setText(Path);
}
Path=settings.value("backupPath", "").toString();
if (!Path.isEmpty()) {
if (QDir(Path).exists()) {
ui->backupPath->setText(Path);
ui->backupEnable->setEnabled(true);
ui->backupEnable->setChecked(settings.value("backupEnable", true).toBool());
} else {
ui->backupEnable->setDisabled(true);
}
} else {
ui->backupEnable->setDisabled(true);
}
ui->splashincludeCB->setCurrentIndex(settings.value("embedded_splashes", 0).toInt());
#ifdef JOYSTICKS
ui->joystickChkB->setChecked(settings.value("js_support", false).toBool());
if (ui->joystickChkB->isChecked()) {
QStringList joystickNames;
joystickNames << tr("No joysticks found");
joystick = new Joystick(0,false,0,0);
ui->joystickcalButton->setDisabled(true);
ui->joystickCB->setDisabled(true);
if ( joystick ) {
if ( joystick->joystickNames.count() > 0 ) {
joystickNames = joystick->joystickNames;
ui->joystickCB->setEnabled(true);
ui->joystickcalButton->setEnabled(true);
}
joystick->close();
}
ui->joystickCB->clear();
ui->joystickCB->insertItems(0, joystickNames);
ui->joystickCB->setCurrentIndex(settings.value("js_ctrl", 0).toInt());
}
else {
ui->joystickCB->clear();
ui->joystickCB->setDisabled(true);
ui->joystickcalButton->setDisabled(true);
}
#endif
}
void appPreferencesDialog::on_libraryPathButton_clicked()
{
QSettings settings;
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your library folder"), settings.value("libraryPath").toString());
if (!fileName.isEmpty()) {
settings.setValue("libraryPath", fileName);
ui->libraryPath->setText(fileName);
}
}
void appPreferencesDialog::on_snapshotClipboardCKB_clicked()
{
QSettings settings;
if (ui->snapshotClipboardCKB->isChecked()) {
ui->snapshotPath->setDisabled(true);
ui->snapshotPathButton->setDisabled(true);
settings.setValue("snapshot_to_clipboard", true);
} else {
ui->snapshotPath->setEnabled(true);
ui->snapshotPath->setReadOnly(true);
ui->snapshotPathButton->setEnabled(true);
settings.setValue("snapshot_to_clipboard", false);
}
}
void appPreferencesDialog::on_backupPathButton_clicked()
{
QSettings settings;
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your Models and Settings backup folder"), settings.value("backupPath").toString());
if (!fileName.isEmpty()) {
settings.setValue("backupPath", fileName);
ui->backupPath->setText(fileName);
}
ui->backupEnable->setEnabled(true);
}
void appPreferencesDialog::on_ge_pathButton_clicked()
{
QSettings settings;
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Google Earth executable"),ui->ge_lineedit->text());
if (!fileName.isEmpty()) {
ui->ge_lineedit->setText(fileName);
}
}
#ifdef JOYSTICKS
void appPreferencesDialog::on_joystickChkB_clicked() {
if (ui->joystickChkB->isChecked()) {
QStringList joystickNames;
joystickNames << tr("No joysticks found");
joystick = new Joystick(0,false,0,0);
ui->joystickcalButton->setDisabled(true);
ui->joystickCB->setDisabled(true);
if ( joystick ) {
if ( joystick->joystickNames.count() > 0 ) {
joystickNames = joystick->joystickNames;
ui->joystickCB->setEnabled(true);
ui->joystickcalButton->setEnabled(true);
}
joystick->close();
}
ui->joystickCB->clear();
ui->joystickCB->insertItems(0, joystickNames);
}
else {
ui->joystickCB->clear();
ui->joystickCB->setDisabled(true);
ui->joystickcalButton->setDisabled(true);
}
}
void appPreferencesDialog::on_joystickcalButton_clicked() {
joystickDialog * jd=new joystickDialog(this, ui->joystickCB->currentIndex());
jd->exec();
}
#endif
+40
View File
@@ -0,0 +1,40 @@
#ifndef APPPREFERENCESDIALOG_H
#define APPPREFERENCESDIALOG_H
#include <QDialog>
#include <QCheckBox>
#include "eeprominterface.h"
namespace Ui {
class appPreferencesDialog;
}
class Joystick;
class appPreferencesDialog : public QDialog
{
Q_OBJECT
public:
explicit appPreferencesDialog(QWidget *parent = 0);
~appPreferencesDialog();
Joystick *joystick;
private:
Ui::appPreferencesDialog *ui;
void initSettings();
private slots:
void writeValues();
void on_libraryPathButton_clicked();
void on_snapshotPathButton_clicked();
void on_snapshotClipboardCKB_clicked();
void on_backupPathButton_clicked();
void on_ge_pathButton_clicked();
#ifdef JOYSTICKS
void on_joystickChkB_clicked();
void on_joystickcalButton_clicked();
#endif
};
#endif // APPPREFERENCESDIALOG_H
+505
View File
@@ -0,0 +1,505 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>appPreferencesDialog</class>
<widget class="QDialog" name="appPreferencesDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>685</width>
<height>456</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>685</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Application Preferences</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="verticalSpacing">
<number>2</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item row="20" column="8">
<widget class="QPushButton" name="libraryPathButton">
<property name="text">
<string>Open Folder</string>
</property>
</widget>
</item>
<item row="22" column="1" colspan="8">
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="1" colspan="8">
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="17" column="0">
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Joystick</string>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>Simulator capture folder</string>
</property>
</widget>
</item>
<item row="15" column="1" colspan="7">
<widget class="QCheckBox" name="simuSW">
<property name="text">
<string>Remember simulator switch values</string>
</property>
</widget>
</item>
<item row="20" column="0">
<widget class="QLabel" name="label_9">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>User Splash Screens</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Files to keep</string>
</property>
</widget>
</item>
<item row="8" column="1" colspan="7">
<widget class="QCheckBox" name="wizardEnable_ChkB">
<property name="text">
<string>Offer to use wizard for new models</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="18" column="1" colspan="8">
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="16" column="1">
<widget class="QComboBox" name="backLightColor">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>Blue</string>
</property>
</item>
<item>
<property name="text">
<string>Green</string>
</property>
</item>
<item>
<property name="text">
<string>Red</string>
</property>
</item>
<item>
<property name="text">
<string>Orange</string>
</property>
</item>
<item>
<property name="text">
<string>Yellow</string>
</property>
</item>
</widget>
</item>
<item row="7" column="1" colspan="7">
<widget class="QCheckBox" name="startupCheck_companion9x">
<property name="text">
<string>Automatic check for Companion updates</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="1" colspan="8">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="13" column="1" colspan="7">
<widget class="QLineEdit" name="snapshotPath">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="14" column="1" colspan="7">
<widget class="QCheckBox" name="snapshotClipboardCKB">
<property name="text">
<string>Only capture to clipboard</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="historySize">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>40</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="maximum">
<number>15</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item row="12" column="1" colspan="8">
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="1" colspan="8">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="1" colspan="7">
<widget class="QLineEdit" name="ge_lineedit">
<property name="minimumSize">
<size>
<width>250</width>
<height>0</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="17" column="8">
<widget class="QPushButton" name="joystickcalButton">
<property name="text">
<string>Calibrate</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_17">
<property name="text">
<string>Automatic Backup Folder</string>
</property>
</widget>
</item>
<item row="23" column="7" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="13" column="8">
<widget class="QPushButton" name="snapshotPathButton">
<property name="text">
<string>Open Folder</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="10" column="1" colspan="7">
<widget class="QLineEdit" name="backupPath">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="17" column="1">
<widget class="QComboBox" name="joystickCB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="16" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Simulator BackLight</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="11" column="1" colspan="7">
<widget class="QCheckBox" name="backupEnable">
<property name="text">
<string>Enable automatic backup before writing firmware</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="7">
<widget class="QCheckBox" name="showSplash">
<property name="text">
<string>Show splash screen when Companion starts</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="QPushButton" name="ge_pathButton">
<property name="text">
<string>Find Executable</string>
</property>
</widget>
</item>
<item row="10" column="8">
<widget class="QPushButton" name="backupPathButton">
<property name="text">
<string>Open Folder</string>
</property>
</widget>
</item>
<item row="17" column="4" colspan="4">
<widget class="QCheckBox" name="joystickChkB">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="ge_label">
<property name="text">
<string>Google Earth Executable</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="7">
<widget class="QCheckBox" name="startupCheck_fw">
<property name="text">
<string>Automatic check for OpenTX firmware updates</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="19" column="1">
<widget class="QComboBox" name="splashincludeCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Include companion splashes</string>
</property>
</item>
<item>
<property name="text">
<string>Only user defined splashes</string>
</property>
</item>
</widget>
</item>
<item row="19" column="0">
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Splash Screen Library</string>
</property>
</widget>
</item>
<item row="20" column="1" colspan="7">
<widget class="QLineEdit" name="libraryPath">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
<zorder>startupCheck_companion9x</zorder>
<zorder>backupEnable</zorder>
<zorder>line</zorder>
<zorder>backupPath</zorder>
<zorder>line_2</zorder>
<zorder>startupCheck_fw</zorder>
<zorder>wizardEnable_ChkB</zorder>
<zorder>ge_label</zorder>
<zorder>label_5</zorder>
<zorder>showSplash</zorder>
<zorder>line_3</zorder>
<zorder>ge_pathButton</zorder>
<zorder>line_4</zorder>
<zorder>backupPathButton</zorder>
<zorder>label_3</zorder>
<zorder>backLightColor</zorder>
<zorder>snapshotPath</zorder>
<zorder>snapshotPathButton</zorder>
<zorder>snapshotClipboardCKB</zorder>
<zorder>label_11</zorder>
<zorder>joystickCB</zorder>
<zorder>joystickcalButton</zorder>
<zorder>ge_lineedit</zorder>
<zorder>simuSW</zorder>
<zorder>buttonBox</zorder>
<zorder>line_5</zorder>
<zorder>joystickChkB</zorder>
<zorder>label_17</zorder>
<zorder>label_19</zorder>
<zorder>historySize</zorder>
<zorder>label_9</zorder>
<zorder>libraryPath</zorder>
<zorder>libraryPathButton</zorder>
<zorder>line_6</zorder>
<zorder>splashincludeCB</zorder>
<zorder>label_10</zorder>
</widget>
<tabstops>
<tabstop>buttonBox</tabstop>
<tabstop>ge_lineedit</tabstop>
<tabstop>ge_pathButton</tabstop>
<tabstop>historySize</tabstop>
<tabstop>showSplash</tabstop>
<tabstop>startupCheck_fw</tabstop>
<tabstop>startupCheck_companion9x</tabstop>
<tabstop>wizardEnable_ChkB</tabstop>
<tabstop>backupPath</tabstop>
<tabstop>backupPathButton</tabstop>
<tabstop>backupEnable</tabstop>
<tabstop>snapshotPath</tabstop>
<tabstop>snapshotPathButton</tabstop>
<tabstop>snapshotClipboardCKB</tabstop>
<tabstop>simuSW</tabstop>
<tabstop>backLightColor</tabstop>
<tabstop>joystickCB</tabstop>
<tabstop>joystickChkB</tabstop>
<tabstop>joystickcalButton</tabstop>
</tabstops>
<resources>
<include location="companion.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>appPreferencesDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>376</x>
<y>596</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>appPreferencesDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>396</x>
<y>596</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
+32 -16
View File
@@ -325,7 +325,8 @@
<file>themes/monochrome/16/print.png</file>
<file>themes/monochrome/16/compare.png</file>
<file>themes/monochrome/16/saveas.png</file>
<file>themes/monochrome/16/preferences.png</file>
<file>themes/monochrome/16/apppreferences.png</file>
<file>themes/monochrome/16/fwpreferences.png</file>
<file>themes/monochrome/16/movedown.png</file>
<file>themes/monochrome/16/currentmodel.png</file>
<file>themes/monochrome/16/read_flash.png</file>
@@ -367,7 +368,8 @@
<file>themes/monochrome/24/print.png</file>
<file>themes/monochrome/24/compare.png</file>
<file>themes/monochrome/24/saveas.png</file>
<file>themes/monochrome/24/preferences.png</file>
<file>themes/monochrome/24/apppreferences.png</file>
<file>themes/monochrome/24/fwpreferences.png</file>
<file>themes/monochrome/24/movedown.png</file>
<file>themes/monochrome/24/currentmodel.png</file>
<file>themes/monochrome/24/read_flash.png</file>
@@ -409,7 +411,8 @@
<file>themes/monochrome/32/print.png</file>
<file>themes/monochrome/32/compare.png</file>
<file>themes/monochrome/32/saveas.png</file>
<file>themes/monochrome/32/preferences.png</file>
<file>themes/monochrome/32/apppreferences.png</file>
<file>themes/monochrome/32/fwpreferences.png</file>
<file>themes/monochrome/32/movedown.png</file>
<file>themes/monochrome/32/currentmodel.png</file>
<file>themes/monochrome/32/read_flash.png</file>
@@ -451,7 +454,8 @@
<file>themes/monochrome/48/print.png</file>
<file>themes/monochrome/48/compare.png</file>
<file>themes/monochrome/48/saveas.png</file>
<file>themes/monochrome/48/preferences.png</file>
<file>themes/monochrome/48/apppreferences.png</file>
<file>themes/monochrome/48/fwpreferences.png</file>
<file>themes/monochrome/48/movedown.png</file>
<file>themes/monochrome/48/currentmodel.png</file>
<file>themes/monochrome/48/read_flash.png</file>
@@ -493,7 +497,8 @@
<file>themes/classic/16/print.png</file>
<file>themes/classic/16/compare.png</file>
<file>themes/classic/16/saveas.png</file>
<file>themes/classic/16/preferences.png</file>
<file>themes/classic/16/apppreferences.png</file>
<file>themes/classic/16/fwpreferences.png</file>
<file>themes/classic/16/movedown.png</file>
<file>themes/classic/16/currentmodel.png</file>
<file>themes/classic/16/read_flash.png</file>
@@ -535,7 +540,8 @@
<file>themes/classic/24/print.png</file>
<file>themes/classic/24/compare.png</file>
<file>themes/classic/24/saveas.png</file>
<file>themes/classic/24/preferences.png</file>
<file>themes/classic/24/apppreferences.png</file>
<file>themes/classic/24/fwpreferences.png</file>
<file>themes/classic/24/movedown.png</file>
<file>themes/classic/24/currentmodel.png</file>
<file>themes/classic/24/read_flash.png</file>
@@ -577,7 +583,8 @@
<file>themes/classic/32/print.png</file>
<file>themes/classic/32/compare.png</file>
<file>themes/classic/32/saveas.png</file>
<file>themes/classic/32/preferences.png</file>
<file>themes/classic/32/apppreferences.png</file>
<file>themes/classic/32/fwpreferences.png</file>
<file>themes/classic/32/movedown.png</file>
<file>themes/classic/32/currentmodel.png</file>
<file>themes/classic/32/read_flash.png</file>
@@ -619,7 +626,8 @@
<file>themes/classic/48/print.png</file>
<file>themes/classic/48/compare.png</file>
<file>themes/classic/48/saveas.png</file>
<file>themes/classic/48/preferences.png</file>
<file>themes/classic/48/apppreferences.png</file>
<file>themes/classic/48/fwpreferences.png</file>
<file>themes/classic/48/movedown.png</file>
<file>themes/classic/48/currentmodel.png</file>
<file>themes/classic/48/read_flash.png</file>
@@ -661,7 +669,8 @@
<file>themes/monoblue/16/print.png</file>
<file>themes/monoblue/16/compare.png</file>
<file>themes/monoblue/16/saveas.png</file>
<file>themes/monoblue/16/preferences.png</file>
<file>themes/monoblue/16/apppreferences.png</file>
<file>themes/monoblue/16/fwpreferences.png</file>
<file>themes/monoblue/16/movedown.png</file>
<file>themes/monoblue/16/currentmodel.png</file>
<file>themes/monoblue/16/read_flash.png</file>
@@ -703,7 +712,8 @@
<file>themes/monoblue/24/print.png</file>
<file>themes/monoblue/24/compare.png</file>
<file>themes/monoblue/24/saveas.png</file>
<file>themes/monoblue/24/preferences.png</file>
<file>themes/monoblue/24/apppreferences.png</file>
<file>themes/monoblue/24/fwpreferences.png</file>
<file>themes/monoblue/24/movedown.png</file>
<file>themes/monoblue/24/currentmodel.png</file>
<file>themes/monoblue/24/read_flash.png</file>
@@ -745,7 +755,8 @@
<file>themes/monoblue/32/print.png</file>
<file>themes/monoblue/32/compare.png</file>
<file>themes/monoblue/32/saveas.png</file>
<file>themes/monoblue/32/preferences.png</file>
<file>themes/monoblue/32/apppreferences.png</file>
<file>themes/monoblue/32/fwpreferences.png</file>
<file>themes/monoblue/32/movedown.png</file>
<file>themes/monoblue/32/currentmodel.png</file>
<file>themes/monoblue/32/read_flash.png</file>
@@ -787,7 +798,8 @@
<file>themes/monoblue/48/print.png</file>
<file>themes/monoblue/48/compare.png</file>
<file>themes/monoblue/48/saveas.png</file>
<file>themes/monoblue/48/preferences.png</file>
<file>themes/monoblue/48/apppreferences.png</file>
<file>themes/monoblue/48/fwpreferences.png</file>
<file>themes/monoblue/48/movedown.png</file>
<file>themes/monoblue/48/currentmodel.png</file>
<file>themes/monoblue/48/read_flash.png</file>
@@ -829,7 +841,8 @@
<file>themes/monowhite/16/print.png</file>
<file>themes/monowhite/16/compare.png</file>
<file>themes/monowhite/16/saveas.png</file>
<file>themes/monowhite/16/preferences.png</file>
<file>themes/monowhite/16/apppreferences.png</file>
<file>themes/monowhite/16/fwpreferences.png</file>
<file>themes/monowhite/16/movedown.png</file>
<file>themes/monowhite/16/currentmodel.png</file>
<file>themes/monowhite/16/read_flash.png</file>
@@ -871,7 +884,8 @@
<file>themes/monowhite/24/print.png</file>
<file>themes/monowhite/24/compare.png</file>
<file>themes/monowhite/24/saveas.png</file>
<file>themes/monowhite/24/preferences.png</file>
<file>themes/monowhite/24/apppreferences.png</file>
<file>themes/monowhite/24/fwpreferences.png</file>
<file>themes/monowhite/24/movedown.png</file>
<file>themes/monowhite/24/currentmodel.png</file>
<file>themes/monowhite/24/read_flash.png</file>
@@ -913,7 +927,8 @@
<file>themes/monowhite/32/print.png</file>
<file>themes/monowhite/32/compare.png</file>
<file>themes/monowhite/32/saveas.png</file>
<file>themes/monowhite/32/preferences.png</file>
<file>themes/monowhite/32/apppreferences.png</file>
<file>themes/monowhite/32/fwpreferences.png</file>
<file>themes/monowhite/32/movedown.png</file>
<file>themes/monowhite/32/currentmodel.png</file>
<file>themes/monowhite/32/read_flash.png</file>
@@ -955,7 +970,8 @@
<file>themes/monowhite/48/print.png</file>
<file>themes/monowhite/48/compare.png</file>
<file>themes/monowhite/48/saveas.png</file>
<file>themes/monowhite/48/preferences.png</file>
<file>themes/monowhite/48/apppreferences.png</file>
<file>themes/monowhite/48/fwpreferences.png</file>
<file>themes/monowhite/48/movedown.png</file>
<file>themes/monowhite/48/currentmodel.png</file>
<file>themes/monowhite/48/read_flash.png</file>
+126 -105
View File
@@ -7,14 +7,39 @@
#include "splashlibrary.h"
#include "flashinterface.h"
Side::Side(){
imageLabel = 0;
fileNameEdit = 0;
saveButton = 0;
source=new Source;
*source = UNDEFINED;
}
void Side::copyImage( Side side ){
if ((*source!=UNDEFINED) && (*side.source!=UNDEFINED))
imageLabel->setPixmap(*side.imageLabel->pixmap());
}
customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::customizeSplashDialog)
{
ui->setupUi(this);
ui->libraryButton->setIcon(CompanionIcon("library.png"));
ui->HowToLabel->clear();
ui->HowToLabel->append("<center>" + tr("Select an original firmware file") + "</center>");
ui->leftLibraryButton->setIcon(CompanionIcon("library.png"));
ui->rightLibraryButton->setIcon(CompanionIcon("library.png"));
left.imageLabel = ui->leftImageLabel;
right.imageLabel = ui->rightImageLabel;
left.fileNameEdit = ui->leftFileNameEdit;
right.fileNameEdit = ui->rightFileNameEdit;
left.saveButton = ui->leftSaveButton;
right.saveButton = ui->rightSaveButton;
left.libraryButton = ui->leftLibraryButton;
right.libraryButton = ui->rightLibraryButton;
left.invertButton = ui->leftInvertButton;
right.invertButton = ui->rightInvertButton;
resize(0,0);
}
customizeSplashDialog::~customizeSplashDialog()
@@ -22,92 +47,95 @@ customizeSplashDialog::~customizeSplashDialog()
delete ui;
}
void customizeSplashDialog::on_FlashLoadButton_clicked()
void customizeSplashDialog::on_copyRightToLeftButton_clicked() {
left.copyImage(right);
}
void customizeSplashDialog::on_copyLeftToRightButton_clicked() {
right.copyImage(left);
}
void customizeSplashDialog::on_leftLoadFwButton_clicked() {loadFwButton_clicked(left);}
void customizeSplashDialog::on_rightLoadFwButton_clicked() {loadFwButton_clicked(right);}
void customizeSplashDialog::loadFwButton_clicked(Side side)
{
QSettings settings;
QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER);
if (!fileName.isEmpty()) {
ui->ImageLoadButton->setDisabled(true);
ui->libraryButton->setDisabled(true);
ui->SaveFlashButton->setDisabled(true);
ui->SaveImageButton->setDisabled(true);
ui->ImageFileName->clear();
ui->imageLabel->clear();
ui->HowToLabel->clear();
ui->HowToLabel->setStyleSheet("background:rgb(255, 255, 0)");
QFile file(fileName);
if (!file.exists()) {
ui->FWFileName->clear();
ui->HowToLabel->append("<center>" + tr("Select an original firmware file") + "</center>");
if (fileName.isEmpty() || !file.exists())
return;
}
if (fileName.isEmpty()) {
ui->FWFileName->clear();
ui->HowToLabel->append("<center>" + tr("Select an original firmware file") + "</center>");
return;
}
ui->FWFileName->setText(fileName);
FlashInterface flash(fileName);
if (flash.hasSplash()) {
ui->HowToLabel->append("<center>" + tr("Select an image to customize your splash <br />or save actual firmware splash") + "</center>");
ui->ImageLoadButton->setEnabled(true);
ui->libraryButton->setEnabled(true);
ui->SaveImageButton->setEnabled(true);
ui->imageLabel->setPixmap(QPixmap::fromImage(flash.getSplash()));
ui->imageLabel->setFixedSize(flash.getSplashWidth()*2,flash.getSplashHeight()*2);
} else {
if (!flash.hasSplash()) {
QMessageBox::information(this, tr("Error"), tr("Could not find bitmap to replace in file"));
return;
}
side.saveButton->setEnabled(true);
side.imageLabel->setPixmap(QPixmap::fromImage(flash.getSplash()));
side.imageLabel->setFixedSize(flash.getSplashWidth()*2,flash.getSplashHeight()*2);
side.fileNameEdit->setText(fileName);
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath());
*side.source=FW;
side.saveButton->setEnabled(true);
side.libraryButton->setEnabled(true);
side.invertButton->setEnabled(true);
}
}
void customizeSplashDialog::on_ImageLoadButton_clicked() {
void customizeSplashDialog::on_leftLoadPictButton_clicked() {loadPictButton_clicked(left);}
void customizeSplashDialog::on_rightLoadPictButton_clicked() {loadPictButton_clicked(right);}
void customizeSplashDialog::loadPictButton_clicked(Side side)
{
QString supportedImageFormats;
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
}
QSettings settings;
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats));
if (!fileName.isEmpty()) {
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
QImage image(fileName);
if (image.isNull()) {
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
return;
}
ui->HowToLabel->clear();
ui->ImageFileName->setText(fileName);
if (ui->imageLabel->width()==424) {
image=image.convertToFormat(QImage::Format_RGB32);
QRgb col;
int gray;
int width = image.width();
int height = image.height();
for (int i = 0; i < width; ++i)
{
for (int j = 0; j < height; ++j)
{
col = image.pixel(i, j);
gray = qGray(col);
image.setPixel(i, j, qRgb(gray, gray, gray));
}
}
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2)));
} else {
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
}
ui->SaveFlashButton->setEnabled(true);
ui->HowToLabel->append("<center>" + tr("Save your custimized firmware") + "</center>");
if (fileName.isEmpty()){
return;
}
QImage image(fileName);
if (image.isNull()) {
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
return;
}
if (side.imageLabel->width()==424) {
image=image.convertToFormat(QImage::Format_RGB32);
QRgb col;
int gray;
int width = image.width();
int height = image.height();
for (int i = 0; i < width; ++i)
{
for (int j = 0; j < height; ++j)
{
col = image.pixel(i, j);
gray = qGray(col);
image.setPixel(i, j, qRgb(gray, gray, gray));
}
}
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2)));
} else {
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
}
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
side.fileNameEdit->setText(fileName);
*side.source=PICT;
side.saveButton->setEnabled(true);
side.libraryButton->setEnabled(true);
side.invertButton->setEnabled(true);
}
void customizeSplashDialog::on_libraryButton_clicked() {
void customizeSplashDialog::on_leftLibraryButton_clicked(){libraryButton_clicked(left);}
void customizeSplashDialog::on_rightLibraryButton_clicked(){libraryButton_clicked(right);}
void customizeSplashDialog::libraryButton_clicked( Side side )
{
QString fileName;
splashLibrary *ld = new splashLibrary(this,&fileName);
@@ -118,9 +146,7 @@ void customizeSplashDialog::on_libraryButton_clicked() {
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
return;
}
ui->HowToLabel->clear();
ui->ImageFileName->setText(fileName);
if (ui->imageLabel->width()==424) {
if (side.imageLabel->width()==424) {
image=image.convertToFormat(QImage::Format_RGB32);
QRgb col;
int gray;
@@ -135,57 +161,52 @@ void customizeSplashDialog::on_libraryButton_clicked() {
image.setPixel(i, j, qRgb(gray, gray, gray));
}
}
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2)));
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2)));
} else {
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
}
ui->SaveFlashButton->setEnabled(true);
ui->HowToLabel->append("<center>" + tr("Save your custimized firmware") + "</center>");
}
}
void customizeSplashDialog::on_SaveFlashButton_clicked()
void customizeSplashDialog::on_leftSaveButton_clicked(){saveButton_clicked(left);}
void customizeSplashDialog::on_rightSaveButton_clicked(){saveButton_clicked(right);}
void customizeSplashDialog::saveButton_clicked(Side side)
{
QString fileName;
QSettings settings;
ui->HowToLabel->clear();
fileName = QFileDialog::getSaveFileName(this, tr("Write to file"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER, 0, QFileDialog::DontConfirmOverwrite);
if (fileName.isEmpty()) {
return;
QString fileName = side.fileNameEdit->text();
if (*side.source == FW)
{
FlashInterface flash(fileName);
if (!flash.hasSplash()) {
QMessageBox::critical(this, tr("Error"), tr("Could not store image in firmware file %1").arg(fileName));
return;
}
QImage image = side.imageLabel->pixmap()->toImage().scaled(flash.getSplashWidth(), flash.getSplashHeight());
if (flash.setSplash(image) && (flash.saveFlash(fileName) > 0))
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath());
else
QMessageBox::critical(this, tr("Error"), tr("Could not store image in firmware file %1").arg(fileName));
}
FlashInterface flash(ui->FWFileName->text());
if (!flash.hasSplash()) {
QMessageBox::critical(this, tr("Error"), tr("Error reading file %1").arg(fileName));
return;
}
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath());
QImage image = ui->imageLabel->pixmap()->toImage().scaled(flash.getSplashWidth(), flash.getSplashHeight());
flash.setSplash(image);
if (flash.saveFlash(fileName) > 0) {
ui->HowToLabel->setStyleSheet("background:rgb(0,255.0);");
ui->HowToLabel->append("<center>" + tr("Firmware correctly saved.") + "</center>");
} else {
ui->HowToLabel->setStyleSheet("background:rgb(255.0.0);");
ui->HowToLabel->append("<center>" + tr("Firmware not saved.") + "</center>");
else if (*side.source == PICT)
{
if (!fileName.isEmpty()) {
QImage image = side.imageLabel->pixmap()->toImage().scaled(side.imageLabel->width()/2, side.imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
if (image.save(fileName))
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
else
QMessageBox::critical(this, tr("Error"), tr("The image file %1 could not be stored").arg(fileName));
}
}
}
void customizeSplashDialog::on_InvertColorButton_clicked()
void customizeSplashDialog::on_leftInvertButton_clicked(){invertButton_clicked(left);}
void customizeSplashDialog::on_rightInvertButton_clicked(){invertButton_clicked(right);}
void customizeSplashDialog::invertButton_clicked(Side side)
{
QImage image = ui->imageLabel->pixmap()->toImage();
QImage image = side.imageLabel->pixmap()->toImage();
image.invertPixels();
ui->imageLabel->setPixmap(QPixmap::fromImage(image));
side.imageLabel->setPixmap(QPixmap::fromImage(image));
}
void customizeSplashDialog::on_SaveImageButton_clicked()
{
QString fileName;
QSettings settings;
fileName = QFileDialog::getSaveFileName(this, tr("Write to file"), settings.value("lastImagesDir").toString(), tr("PNG images (*.png);;"), 0, QFileDialog::DontConfirmOverwrite);
if (!fileName.isEmpty()) {
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
QImage image = ui->imageLabel->pixmap()->toImage().scaled(ui->imageLabel->width()/2, ui->imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
image.save(fileName, "PNG");
}
}
+40 -6
View File
@@ -10,24 +10,58 @@ namespace Ui
class customizeSplashDialog;
}
enum Source {FW, PICT, UNDEFINED};
class Side
{
public:
Side();
void copyImage( Side );
QLabel *imageLabel;
QLineEdit *fileNameEdit;
QPushButton *saveButton;
QPushButton *invertButton;
QToolButton *libraryButton;
Source *source;
};
class customizeSplashDialog : public QDialog
{
Q_OBJECT
Side left;
Side right;
public:
explicit customizeSplashDialog(QWidget *parent = 0);
~customizeSplashDialog();
private slots:
void on_FlashLoadButton_clicked();
void on_ImageLoadButton_clicked();
void on_libraryButton_clicked();
void on_SaveFlashButton_clicked();
void on_InvertColorButton_clicked();
void on_SaveImageButton_clicked();
void on_leftLoadFwButton_clicked();
void on_leftLoadPictButton_clicked();
void on_leftLibraryButton_clicked();
void on_leftSaveButton_clicked();
void on_leftInvertButton_clicked();
void on_rightLoadFwButton_clicked();
void on_rightLoadPictButton_clicked();
void on_rightLibraryButton_clicked();
void on_rightSaveButton_clicked();
void on_rightInvertButton_clicked();
void on_copyRightToLeftButton_clicked();
void on_copyLeftToRightButton_clicked();
private:
void loadFwButton_clicked( Side );
void loadPictButton_clicked( Side );
void libraryButton_clicked( Side );
void saveButton_clicked( Side );
void invertButton_clicked( Side );
Ui::customizeSplashDialog *ui;
enum sideEnum { LEFT, RIGHT };
};
#endif // CUSTOMIZESPLASHDIALOG_H
+551 -194
View File
@@ -2,88 +2,498 @@
<ui version="4.0">
<class>customizeSplashDialog</class>
<widget class="QDialog" name="customizeSplashDialog">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>366</width>
<height>303</height>
<width>1086</width>
<height>285</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Customize Splash</string>
<string>Transmitter Splash Screen Editor</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">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="horizontalLayout_13">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer">
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QLabel" name="imageLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>256</width>
<height>128</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>424</width>
<height>128</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="companion.qrc">:/images/customize.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
<widget class="Line" name="line_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_11">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="SaveImageButton">
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="leftFileNameEdit">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>424</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>426</width>
<height>16777215</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="spacing">
<number>6</number>
</property>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="leftImageLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>424</width>
<height>128</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>424</width>
<height>128</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string>Save Image</string>
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="leftInvertButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Invert</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="leftLibraryButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Open Splash Library</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="leftLoadFwButton">
<property name="text">
<string>Load FW</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="leftLoadPictButton">
<property name="text">
<string>Load Pict</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="leftSaveButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QToolButton" name="copyRightToLeftButton">
<property name="text">
<string>...</string>
</property>
<property name="arrowType">
<enum>Qt::LeftArrow</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="copyLeftToRightButton">
<property name="text">
<string>...</string>
</property>
<property name="arrowType">
<enum>Qt::RightArrow</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="Line" name="line_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_12">
<property name="spacing">
<number>6</number>
</property>
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="rightFileNameEdit">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>426</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>424</width>
<height>16777215</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<property name="spacing">
<number>6</number>
</property>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="rightImageLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>424</width>
<height>128</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>424</width>
<height>128</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QPushButton" name="rightInvertButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Invert</string>
</property>
</widget>
</item>
@@ -101,164 +511,111 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="InvertColorButton">
<widget class="QToolButton" name="rightLibraryButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Open Splash Library</string>
</property>
<property name="text">
<string>Invert Color</string>
<string>...</string>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QPushButton" name="rightLoadFwButton">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Load FW</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="rightLoadPictButton">
<property name="text">
<string>Load Pict</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="rightSaveButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_2">
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>50</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QTextEdit" name="HowToLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background:rgb(255, 255, 0);</string>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="acceptRichText">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLineEdit" name="FWFileName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QPushButton" name="FlashLoadButton">
<property name="text">
<string>Load Firmware</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="ImageFileName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="ImageLoadButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Load Image</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="libraryButton">
<property name="toolTip">
<string>Open Splash Library</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>208</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1" colspan="2">
<widget class="QPushButton" name="SaveFlashButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Save Firmware</string>
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>
<tabstop>leftFileNameEdit</tabstop>
<tabstop>leftInvertButton</tabstop>
<tabstop>leftLoadFwButton</tabstop>
<tabstop>leftLoadPictButton</tabstop>
<tabstop>leftSaveButton</tabstop>
<tabstop>copyLeftToRightButton</tabstop>
<tabstop>copyRightToLeftButton</tabstop>
<tabstop>rightFileNameEdit</tabstop>
<tabstop>rightInvertButton</tabstop>
<tabstop>rightLoadFwButton</tabstop>
<tabstop>rightLoadPictButton</tabstop>
<tabstop>rightSaveButton</tabstop>
</tabstops>
<resources>
<include location="companion.qrc"/>
</resources>
+557
View File
@@ -0,0 +1,557 @@
#include "fwpreferencesdialog.h"
#include "ui_fwpreferencesdialog.h"
#include "mainwindow.h"
#include "eeprominterface.h"
#include "helpers.h"
#include <QDesktopServices>
#include <QtGui>
fwPreferencesDialog::fwPreferencesDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::fwPreferencesDialog),
updateLock(false)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("preferences.png"));
QCheckBox * OptionCheckBox[]= {
ui->optionCheckBox_1, ui->optionCheckBox_2, ui->optionCheckBox_3, ui->optionCheckBox_4, ui->optionCheckBox_5, ui->optionCheckBox_6, ui->optionCheckBox_7,
ui->optionCheckBox_8, ui->optionCheckBox_9, ui->optionCheckBox_10, ui->optionCheckBox_11, ui->optionCheckBox_12, ui->optionCheckBox_13, ui->optionCheckBox_14,
ui->optionCheckBox_15,ui->optionCheckBox_16, ui->optionCheckBox_17, ui->optionCheckBox_18, ui->optionCheckBox_19, ui->optionCheckBox_20, ui->optionCheckBox_21,
ui->optionCheckBox_22, ui->optionCheckBox_23, ui->optionCheckBox_24, ui->optionCheckBox_25, ui->optionCheckBox_26, ui->optionCheckBox_27, ui->optionCheckBox_28,
ui->optionCheckBox_29, ui->optionCheckBox_30, ui->optionCheckBox_31, ui->optionCheckBox_32, ui->optionCheckBox_33, ui->optionCheckBox_34, ui->optionCheckBox_35,
ui->optionCheckBox_36, ui->optionCheckBox_37, ui->optionCheckBox_38, ui->optionCheckBox_39, ui->optionCheckBox_40, ui->optionCheckBox_41, ui->optionCheckBox_42,
NULL };
voice=NULL;
connect(ui->langCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(firmwareLangChanged()));
connect(ui->voiceCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(firmwareLangChanged()));
for (int i=0; OptionCheckBox[i]; i++) {
optionsCheckBoxes.push_back(OptionCheckBox[i]);
connect(OptionCheckBox[i], SIGNAL(toggled(bool)), this, SLOT(firmwareOptionChanged(bool)));
}
initSettings();
connect(ui->downloadVerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(baseFirmwareChanged()));
connect(this, SIGNAL(accepted()), this, SLOT(writeValues()));
resize(0,0);
}
fwPreferencesDialog::~fwPreferencesDialog()
{
delete ui;
}
void fwPreferencesDialog::baseFirmwareChanged()
{
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
voice=NULL;
foreach(FirmwareInfo * firmware, firmwares) {
if (firmware->id == selected_firmware) {
if (firmware->voice) {
ui->voiceLabel->show();
ui->voiceCombo->show();
ui->voice_dnld->show();
ui->sdPathButton->show();
ui->sdPath->show();
ui->sdPathLabel->show();
ui->voiceLabel->setEnabled(true);
ui->voiceCombo->setEnabled(true);
ui->voice_dnld->setEnabled(true);
ui->sdPathButton->setEnabled(true);
ui->sdPath->setEnabled(true);
} else {
ui->voiceLabel->hide();
ui->voiceCombo->hide();
ui->voice_dnld->hide();
ui->sdPathButton->hide();
ui->sdPath->hide();
ui->sdPathLabel->hide();
}
populateFirmwareOptions(firmware);
break;
}
}
firmwareChanged();
}
FirmwareVariant fwPreferencesDialog::getFirmwareVariant()
{
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
bool voice=false;
foreach(FirmwareInfo * firmware, firmwares) {
if (firmware->id == selected_firmware) {
QString id = firmware->id;
foreach(QCheckBox *cb, optionsCheckBoxes) {
if (cb->isChecked()) {
if (cb->text()=="voice" && cb->isChecked())
voice=true;
id += QString("-") + cb->text();
}
}
if (! firmware->eepromInterface->getCapability(MultiLangVoice)) {
if (ui->voiceCombo->count() && (voice || firmware->voice))
id += QString("-tts") + ui->voiceCombo->currentText();
}
if (ui->langCombo->count())
id += QString("-") + ui->langCombo->currentText();
return GetFirmwareVariant(id);
}
}
// Should never occur...
return default_firmware_variant;
}
void fwPreferencesDialog::firmwareLangChanged()
{
firmwareChanged();
}
void fwPreferencesDialog::firmwareOptionChanged(bool state)
{
QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
FirmwareInfo * firmware=NULL;
if (cb && state) {
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
foreach(firmware, firmwares) {
if (firmware->id == selected_firmware) {
foreach(QList<Option> opts, firmware->opts) {
foreach(Option opt, opts) {
if (cb->text() == opt.name) {
foreach(Option other, opts) {
if (other.name != opt.name) {
foreach(QCheckBox *ocb, optionsCheckBoxes) {
if (ocb->text() == other.name)
ocb->setChecked(false);
}
}
}
if (voice) {
if (voice->isChecked()) {
ui->voiceLabel->setEnabled(true);
ui->voiceCombo->setEnabled(true);
ui->voice_dnld->setEnabled(true);
ui->sdPathButton->setEnabled(true);
ui->sdPath->setEnabled(true);
} else {
ui->voiceLabel->setDisabled(true);
ui->voiceCombo->setDisabled(true);
ui->voice_dnld->setDisabled(true);
ui->sdPathButton->setDisabled(true);
ui->sdPath->setDisabled(true);
}
}
return firmwareChanged();
}
}
}
}
}
} else if (cb && !state) {
if (cb->text()=="voice") {
ui->voiceLabel->setDisabled(true);
ui->voiceCombo->setDisabled(true);
ui->voice_dnld->setDisabled(true);
ui->sdPathButton->setEnabled(true);
ui->sdPath->setEnabled(true);
}
}
if (voice ) {
if (voice->isChecked()) {
ui->voiceLabel->setEnabled(true);
ui->voiceCombo->setEnabled(true);
ui->voice_dnld->setEnabled(true);
} else {
ui->voiceLabel->setDisabled(true);
ui->voiceCombo->setDisabled(true);
ui->voice_dnld->setDisabled(true);
ui->sdPathButton->setDisabled(true);
ui->sdPath->setDisabled(true);
}
} else if (firmware) {
if (firmware->voice) {
ui->voiceLabel->setEnabled(true);
ui->voiceCombo->setEnabled(true);
ui->voice_dnld->setEnabled(true);
ui->sdPathButton->setEnabled(true);
ui->sdPath->setEnabled(true);
}
}
return firmwareChanged();
}
void fwPreferencesDialog::firmwareChanged()
{
if (updateLock)
return;
FirmwareVariant variant = getFirmwareVariant();
QString stamp;
stamp.append(variant.firmware->stamp);
ui->fw_dnld->setEnabled(!variant.firmware->getUrl(variant.id).isNull());
QString url=variant.firmware->getUrl(variant.id);
// B-Plan
if (false) {
ui->CPU_ID_LE->show();
ui->CPU_ID_LABEL->show();
} else {
ui->CPU_ID_LE->hide();
ui->CPU_ID_LABEL->hide();
}
QSettings settings;
settings.beginGroup("FwRevisions");
int fwrev = settings.value(variant.id, -1).toInt();
settings.endGroup();
if (fwrev != -1) {
ui->FwInfo->setText(tr("Last downloaded release: %1").arg(fwrev));
if (!stamp.isEmpty()) {
ui->checkFWUpdates->show();
} else {
ui->checkFWUpdates->hide();
}
}
else {
if (ui->fw_dnld->isEnabled()) {
ui->FwInfo->setText(tr("The selected firmware has never been downloaded by Companion."));
ui->checkFWUpdates->hide();
}
else {
ui->FwInfo->setText(tr("The selected firmware cannot be downloaded by Companion."));
ui->checkFWUpdates->hide();
}
}
}
void fwPreferencesDialog::writeValues()
{
QSettings settings;
settings.setValue("default_channel_order", ui->channelorderCB->currentIndex());
settings.setValue("default_mode", ui->stickmodeCB->currentIndex());
settings.setValue("cpu_id", ui->CPU_ID_LE->text());
settings.setValue("rename_firmware_files", ui->renameFirmware->isChecked());
settings.setValue("burnFirmware", ui->burnFirmware->isChecked());
current_firmware_variant = getFirmwareVariant();
settings.setValue("firmware", current_firmware_variant.id);
settings.setValue("profileId", ui->ProfSlot_SB->value());
settings.setValue("sdPath", ui->sdPath->text());
settings.setValue("SplashFileName", ui->SplashFileName->text());
if (!ui->SplashFileName->text().isEmpty())
settings.setValue("SplashImage", "");
MainWindow * mw = (MainWindow *)this->parent();
mw->unloadProfile();
}
void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
{
const FirmwareInfo * parent = firmware->parent ? firmware->parent : firmware;
updateLock = true;
ui->langCombo->clear();
foreach(const char *lang, parent->languages) {
ui->langCombo->addItem(lang);
if (current_firmware_variant.id.endsWith(lang))
ui->langCombo->setCurrentIndex(ui->langCombo->count() - 1);
}
ui->voiceCombo->clear();
foreach(const char *lang, parent->ttslanguages) {
ui->voiceCombo->addItem(lang);
if (current_firmware_variant.id.contains(QString("-tts%1").arg(lang)))
ui->voiceCombo->setCurrentIndex(ui->voiceCombo->count() - 1);
}
if (ui->langCombo->count()) {
ui->langCombo->show();
ui->langLabel->show();
}
else {
ui->langCombo->hide();
ui->langLabel->hide();
}
int index = 0;
foreach(QList<Option> opts, parent->opts) {
foreach(Option opt, opts) {
if (index >= optionsCheckBoxes.size()) {
qDebug() << "This firmware needs more options checkboxes!";
}
else {
QCheckBox *cb = optionsCheckBoxes.at(index++);
if (cb) {
cb->show();
cb->setText(opt.name);
cb->setToolTip(opt.tooltip);
cb->setCheckState(current_firmware_variant.id.contains(opt.name) ? Qt::Checked : Qt::Unchecked);
if (opt.name==QString("voice")) {
voice=cb;
ui->voiceLabel->show();
ui->voiceCombo->show();
ui->voice_dnld->show();
ui->sdPathButton->show();
ui->sdPath->show();
ui->sdPathLabel->show();
if (current_firmware_variant.id.contains(opt.name) ||firmware->voice) {
ui->voiceLabel->setEnabled(true);
ui->voiceCombo->setEnabled(true);
ui->voice_dnld->setEnabled(true);
ui->sdPathButton->setEnabled(true);
ui->sdPath->setEnabled(true);
} else {
ui->voiceLabel->setDisabled(true);
ui->voiceCombo->setDisabled(true);
ui->voice_dnld->setDisabled(true);
ui->sdPathButton->setDisabled(true);
ui->sdPath->setDisabled(true);
}
}
}
}
}
}
for (; index<optionsCheckBoxes.size(); index++) {
QCheckBox *cb = optionsCheckBoxes.at(index);
cb->hide();
cb->setCheckState(Qt::Unchecked);
}
updateLock = false;
QTimer::singleShot(0, this, SLOT(shrink()));
}
void fwPreferencesDialog::initSettings()
{
QSettings settings;
ui->channelorderCB->setCurrentIndex(settings.value("default_channel_order", 0).toInt());
ui->stickmodeCB->setCurrentIndex(settings.value("default_mode", 1).toInt());
ui->renameFirmware->setChecked(settings.value("rename_firmware_files", false).toBool());
ui->burnFirmware->setChecked(settings.value("burnFirmware", true).toBool());
ui->CPU_ID_LE->setText(settings.value("cpu_id", "").toString());
QString Path=settings.value("sdPath", "").toString();
if (QDir(Path).exists()) {
ui->sdPath->setText(Path);
}
FirmwareInfo * current_firmware = GetCurrentFirmware();
foreach(FirmwareInfo * firmware, firmwares) {
ui->downloadVerCB->addItem(firmware->name, firmware->id);
if (current_firmware == firmware) {
ui->downloadVerCB->setCurrentIndex(ui->downloadVerCB->count() - 1);
}
}
baseFirmwareChanged();
ui->ProfSlot_SB->setValue(settings.value("profileId", 1).toInt());
on_ProfSlot_SB_valueChanged();
QString fileName=settings.value("SplashFileName","").toString();
if (!fileName.isEmpty()) {
QFile file(fileName);
if (file.exists()){
ui->SplashFileName->setText(fileName);
}
}
firmwareChanged();
}
void fwPreferencesDialog::on_fw_dnld_clicked()
{
MainWindow * mw = (MainWindow *)this->parent();
FirmwareVariant variant = getFirmwareVariant();
writeValues();
if (!variant.firmware->getUrl(variant.id).isNull()) {
if (ui->burnFirmware->isChecked()) {
QSettings settings;
current_firmware_variant = getFirmwareVariant();
settings.setValue("firmware", current_firmware_variant.id);
}
mw->downloadLatestFW(current_firmware_variant.firmware, current_firmware_variant.id);
}
firmwareChanged();
}
void fwPreferencesDialog::on_voice_dnld_clicked()
{
ui->ProfSave_PB->setEnabled(true);
QString url="http://fw.opentx.it/voices/";
FirmwareVariant variant = getFirmwareVariant();
url.append(QString("%1/%2/").arg(variant.firmware->id).arg(ui->voiceCombo->currentText()));
QDesktopServices::openUrl(url);
}
void fwPreferencesDialog::on_sdPathButton_clicked()
{
QSettings settings;
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select the folder replicating your SD structure"), settings.value("sdPath").toString());
if (!fileName.isEmpty()) {
ui->sdPath->setText(fileName);
}
ui->ProfSave_PB->setEnabled(true);
}
void fwPreferencesDialog::on_ProfSlot_SB_valueChanged()
{
QSettings settings;
settings.beginGroup("Profiles");
QString profile=QString("profile%1").arg(ui->ProfSlot_SB->value());
settings.beginGroup(profile);
QString name=settings.value("Name","").toString();
ui->ProfName_LE->setText(name);
/* if (!(name.isEmpty())) {
QString firmwarename=settings.value("firmware", default_firmware_id).toString();
FirmwareInfo * fw = getFirmware(firmwarename);
int i=0;
foreach(FirmwareInfo * firmware, firmwares) {
if (fw == firmware) {
qDebug() << fw->id;
qDebug() << firmware->id;
qDebug() << i;
ui->downloadVerCB->setCurrentIndex(i);
break;
}
i++;
}
baseFirmwareChanged();
populateFirmwareOptions(fw);
}*/
settings.endGroup();
settings.endGroup();
}
void fwPreferencesDialog::on_ProfSave_PB_clicked()
{
QSettings settings;
settings.beginGroup("Profiles");
QString profile=QString("profile%1").arg(ui->ProfSlot_SB->value());
QString name=ui->ProfName_LE->text();
if (name.isEmpty()) {
int ret = QMessageBox::question(this, "Companion",
tr("Profile name is empty, profile slot %1 will be deleted.<br>Are you sure ?").arg(ui->ProfSlot_SB->value()) ,
QMessageBox::Yes | QMessageBox::No);
if (ret==QMessageBox::Yes) {
settings.remove(profile);
} else {
settings.beginGroup(profile);
ui->ProfName_LE->setText(settings.value("Name","").toString());
}
} else {
settings.beginGroup(profile);
settings.setValue("Name",name);
settings.setValue("default_channel_order", ui->channelorderCB->currentIndex());
settings.setValue("default_mode", ui->stickmodeCB->currentIndex());
settings.setValue("burnFirmware", ui->burnFirmware->isChecked());
settings.setValue("rename_firmware_files", ui->renameFirmware->isChecked());
settings.setValue("sdPath", ui->sdPath->text());
settings.setValue("SplashFileName", ui->SplashFileName->text());
current_firmware_variant = getFirmwareVariant();
settings.setValue("firmware", current_firmware_variant.id);
settings.endGroup();
settings.endGroup();
}
}
void fwPreferencesDialog::on_export_PB_clicked()
{
QSettings settings;
QString profile=QString("profile%1").arg(ui->ProfSlot_SB->value());
QString name=ui->ProfName_LE->text();
if (!name.isEmpty()) {
QString fileName = QFileDialog::getSaveFileName(this, tr("Export profile As"), settings.value("lastDir").toString() + "/" +name+".ini" , "*.ini");
if (fileName.isEmpty())
return;
QSettings exportfile(fileName, QSettings::IniFormat);
settings.beginGroup("Profiles");
settings.beginGroup(profile);
QStringList keys = settings.childKeys();
foreach (QString key, keys) {
exportfile.setValue(key,settings.value(key));
}
settings.endGroup();
}
settings.endGroup();
}
void fwPreferencesDialog::on_import_PB_clicked()
{
QSettings settings;
QString profile=QString("profile%1").arg(ui->ProfSlot_SB->value());
QString name=ui->ProfName_LE->text();
if (!name.isEmpty()) {
int ret = QMessageBox::question(this, "Companion",
tr("Profile slot is not empty, profile slot %1 will we overwritten.<br>Are you sure ?").arg(ui->ProfSlot_SB->value()) ,
QMessageBox::Yes | QMessageBox::No);
if (ret==QMessageBox::No) {
return;
}
}
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Profile to import"), settings.value("lastDir").toString(), "*.ini");
if (fileName.isEmpty())
return;
QSettings importfile(fileName, QSettings::IniFormat);
settings.beginGroup("Profiles");
settings.beginGroup(profile);
QStringList keys = importfile.childKeys();
foreach (QString key, keys) {
settings.setValue(key,importfile.value(key));
}
settings.endGroup();
settings.endGroup();
on_ProfSlot_SB_valueChanged();
}
void fwPreferencesDialog::on_SplashSelect_clicked()
{
QString supportedImageFormats;
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
}
QSettings settings;
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats));
if (!fileName.isEmpty()) {
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
QImage image(fileName);
if (image.isNull()) {
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
return;
}
ui->SplashFileName->setText(fileName);
}
}
void fwPreferencesDialog::on_clearImageButton_clicked() {
ui->SplashFileName->clear();
}
void fwPreferencesDialog::on_checkFWUpdates_clicked()
{
FirmwareVariant variant = getFirmwareVariant();
if (ui->burnFirmware->isChecked()) {
QSettings settings;
current_firmware_variant = variant;
settings.setValue("firmware", variant.id);
}
MainWindow * mw = (MainWindow *)this->parent();
mw->checkForUpdates(true, variant.id);
firmwareChanged();
}
void fwPreferencesDialog::shrink()
{
resize(0,0);
}
+52
View File
@@ -0,0 +1,52 @@
#ifndef FWPREFERENCESDIALOG_H
#define FWPREFERENCESDIALOG_H
#include <QDialog>
#include <QCheckBox>
#include "eeprominterface.h"
namespace Ui {
class fwPreferencesDialog;
}
class Joystick;
class fwPreferencesDialog : public QDialog
{
Q_OBJECT
public:
explicit fwPreferencesDialog(QWidget *parent = 0);
~fwPreferencesDialog();
private:
Ui::fwPreferencesDialog *ui;
QList<QCheckBox *> optionsCheckBoxes;
bool updateLock;
void populateLocale();
void populateFirmwareOptions(const FirmwareInfo *);
FirmwareVariant getFirmwareVariant();
void initSettings();
QCheckBox * voice;
private slots:
void shrink();
void writeValues();
void firmwareLangChanged();
void baseFirmwareChanged();
void firmwareOptionChanged(bool state);
void firmwareChanged();
void on_fw_dnld_clicked();
void on_voice_dnld_clicked();
void on_sdPathButton_clicked();
void on_checkFWUpdates_clicked();
void on_ProfSlot_SB_valueChanged();
void on_ProfSave_PB_clicked();
void on_export_PB_clicked();
void on_import_PB_clicked();
void on_SplashSelect_clicked();
void on_clearImageButton_clicked();
};
#endif // FWPREFERENCESDIALOG_H
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 381 B

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 852 B

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 B

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before

Width:  |  Height:  |  Size: 731 B

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 65 KiB

+481
View File
@@ -0,0 +1,481 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>preferencesDialog</class>
<widget class="QDialog" name="preferencesDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>685</width>
<height>418</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>685</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Preferences</string>
</property>
<layout class="QGridLayout" name="gridLayout_4" columnstretch="1">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="verticalSpacing">
<number>2</number>
</property>
<property name="margin">
<number>4</number>
</property>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>8</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="1">
<widget class="QLineEdit" name="snapshotPath">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Simu BackLight</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>Simulator capture folder</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Joystick</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Remember simulator switches</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="simuSW">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QComboBox" name="joystickCB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="joystickChkB">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="snapshotClipboardCKB">
<property name="text">
<string>Use clipboard only</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="joystickcalButton">
<property name="text">
<string>Calibrate</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="backLightColor">
<item>
<property name="text">
<string>Blue</string>
</property>
</item>
<item>
<property name="text">
<string>Green</string>
</property>
</item>
<item>
<property name="text">
<string>Red</string>
</property>
</item>
<item>
<property name="text">
<string>Orange</string>
</property>
</item>
<item>
<property name="text">
<string>Yellow</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="snapshotPathButton">
<property name="text">
<string>Open Folder</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_7">
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Personal splash library</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="libraryPath">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="libraryPathButton">
<property name="text">
<string>Open Folder</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QComboBox" name="splashincludeCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Include companion splashes</string>
</property>
</item>
<item>
<property name="text">
<string>Only user defined splashes</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Splash library behaviour</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Custom TX splash screen</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="SplashFileName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="SplashSelect">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Open Image</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QToolButton" name="splashLibraryButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="clearImageButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="InvertPixels">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Invert Pixels</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="imageLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>128</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>128</width>
<height>64</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="companion.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>preferencesDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>370</x>
<y>49</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>preferencesDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>390</x>
<y>55</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
+44 -4
View File
@@ -49,6 +49,8 @@
#include "comparedialog.h"
#include "logsdialog.h"
#include "preferencesdialog.h"
#include "apppreferencesdialog.h"
#include "fwpreferencesdialog.h"
#include "flashinterface.h"
#include "fusesdialog.h"
#include "downloaddialog.h"
@@ -819,6 +821,32 @@ void MainWindow::preferences()
updateMenus();
}
void MainWindow::appPreferences()
{
appPreferencesDialog *pd = new appPreferencesDialog(this);
pd->exec();
updateMenus();
}
void MainWindow::fwPreferences()
{
fwPreferencesDialog *pd = new fwPreferencesDialog(this);
pd->exec();
FirmwareInfo *firmware = GetCurrentFirmware();
if (ActiveProfile) {
setWindowTitle(tr("Companion - Models and Settings Editor - %1 - profile %2").arg(firmware->name).arg(ActiveProfileName));
}
else {
setWindowTitle(tr("Companion - Models and Settings Editor - %1").arg(firmware->name));
}
foreach (QMdiSubWindow *window, mdiArea->subWindowList()) {
MdiChild *mdiChild = qobject_cast<MdiChild *>(window->widget());
mdiChild->eepromInterfaceChanged();
}
updateMenus();
}
void MainWindow::contributors()
{
contributorsDialog *cd = new contributorsDialog(this,0);
@@ -1667,10 +1695,18 @@ void MainWindow::createActions()
logsAct->setStatusTip(tr("Open log file"));
connect(logsAct, SIGNAL(triggered()), this, SLOT(logFile()));
preferencesAct = new QAction(CompanionIcon("preferences.png"), tr("&General Preferences..."), this);
preferencesAct->setStatusTip(tr("Edit general preferences"));
preferencesAct = new QAction(tr("&Old Preferences Dialog..."), this);
preferencesAct->setStatusTip(tr("Used the old Preferences Dialog"));
connect(preferencesAct, SIGNAL(triggered()), this, SLOT(preferences()));
appPreferencesAct = new QAction(CompanionIcon("apppreferences.png"), tr("&Application Preferences..."), this);
appPreferencesAct->setStatusTip(tr("Edit application preferences"));
connect(appPreferencesAct, SIGNAL(triggered()), this, SLOT(appPreferences()));
fwPreferencesAct = new QAction(CompanionIcon("fwpreferences.png"), tr("&Download Firmware and Voice..."), this);
fwPreferencesAct->setStatusTip(tr("Download firmware and voice files"));
connect(fwPreferencesAct, SIGNAL(triggered()), this, SLOT(fwPreferences()));
checkForUpdatesAct = new QAction(CompanionIcon("update.png"), tr("&Check for updates..."), this);
checkForUpdatesAct->setStatusTip(tr("Check for new version of Companion"));
connect(checkForUpdatesAct, SIGNAL(triggered()), this, SLOT(doUpdates()));
@@ -1891,6 +1927,7 @@ void MainWindow::createMenus()
fileMenu->addAction(printAct);
fileMenu->addAction(compareAct);
fileMenu->addSeparator();
fileMenu->addAction(fwPreferencesAct);
fileMenu->addMenu(profilesMenu);
profilesMenu->setIcon(CompanionIcon("profiles.png"));
@@ -1927,8 +1964,9 @@ void MainWindow::createMenus()
iconThemeSizeMenu->addAction(bigIconAct);
iconThemeSizeMenu->addAction(hugeIconAct);
settingsMenu->addSeparator();
settingsMenu->addAction(preferencesAct);
settingsMenu->addAction(appPreferencesAct);
settingsMenu->addAction(customizeSplashAct);
settingsMenu->addAction(preferencesAct);
settingsMenu->addAction(burnConfigAct);
burnMenu = menuBar()->addMenu(tr("&Read/Write"));
@@ -2010,7 +2048,9 @@ void MainWindow::createToolBars()
fileToolBar->addAction(saveAct);
fileToolBar->addAction(logsAct);
fileToolBar->addSeparator();
fileToolBar->addAction(preferencesAct);
fileToolBar->addAction(appPreferencesAct);
fileToolBar->addAction(fwPreferencesAct);
fileToolBar->addAction(customizeSplashAct);
profileButton = new QToolButton;
profileButton->setPopupMode(QToolButton::InstantPopup);
profileButton->setMenu(createProfilesMenu());
+5
View File
@@ -64,6 +64,7 @@ QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
friend class preferencesDialog;
friend class fwPreferencesDialog;
friend class MdiChild; // TODO GetAvrdudeArgs could be external to this class
Q_OBJECT
@@ -144,6 +145,8 @@ private slots:
void print();
void loadBackup();
void preferences();
void appPreferences();
void fwPreferences();
void updateMenus();
MdiChild *createMdiChild();
void setActiveSubWindow(QWidget *window);
@@ -220,6 +223,8 @@ private:
QAction *saveAsAct;
QAction *exitAct;
QAction *preferencesAct;
QAction *appPreferencesAct;
QAction *fwPreferencesAct;
QAction *checkForUpdatesAct;
QAction *contributorsAct;
QAction *changelogAct;
+1 -1
View File
@@ -4,7 +4,7 @@
#include "eeprominterface.h"
#include "splashlibrary.h"
#include "helpers.h"
#ifdef JOYSTICKS
#ifdef JOYSTICKS
#include "joystick.h"
#include "joystickdialog.h"
#endif
+1 -1
View File
@@ -5,7 +5,7 @@
#include <QCheckBox>
#include "eeprominterface.h"
namespace Ui {
namespace Ui {
class preferencesDialog;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 876 B

After

Width:  |  Height:  |  Size: 463 B

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 661 B

After

Width:  |  Height:  |  Size: 999 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 877 B

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 961 B

After

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 947 B

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 930 B

After

Width:  |  Height:  |  Size: 912 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 998 B

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 891 B

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 371 B

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1001 B

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 B

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 684 B

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 998 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 399 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 988 B

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 694 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 797 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Some files were not shown because too many files have changed in this diff Show More