diff --git a/ground/src/libs/libqxt/src/core/logengines/qxtbasicstdloggerengine.cpp b/ground/src/libs/libqxt/src/core/logengines/qxtbasicstdloggerengine.cpp index e31547adb..44be3a83d 100644 --- a/ground/src/libs/libqxt/src/core/logengines/qxtbasicstdloggerengine.cpp +++ b/ground/src/libs/libqxt/src/core/logengines/qxtbasicstdloggerengine.cpp @@ -196,7 +196,7 @@ void QxtBasicSTDLoggerEngine::writeToStdErr(const QString &level, const QListm_lineEdit, SIGNAL(validChanged(bool)), this, SIGNAL(validChanged(bool))); connect(m_d->m_lineEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinished())); - m_d->m_lineEdit->setMinimumWidth(200); + m_d->m_lineEdit->setMinimumWidth(50); m_d->m_hLayout->addWidget(m_d->m_lineEdit); m_d->m_hLayout->setSizeConstraint(QLayout::SetMinimumSize); diff --git a/ground/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/ground/src/plugins/coreplugin/dialogs/settingsdialog.cpp index 266cb3cdc..2d9d77d18 100644 --- a/ground/src/plugins/coreplugin/dialogs/settingsdialog.cpp +++ b/ground/src/plugins/coreplugin/dialogs/settingsdialog.cpp @@ -53,7 +53,10 @@ using namespace Core::Internal; SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId, const QString &pageId) - : QDialog(parent), m_applied(false) + : QDialog(parent), + m_applied(false), + m_windowWidth(0), + m_windowHeight(0) { setupUi(this); #ifdef Q_OS_MAC @@ -67,7 +70,11 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId, QSettings *settings = ICore::instance()->settings(); initialCategory = settings->value("General/LastPreferenceCategory", QVariant(QString())).toString(); initialPage = settings->value("General/LastPreferencePage", QVariant(QString())).toString(); + m_windowWidth = settings->value("General/SettingsWindowWidth", 0).toInt(); + m_windowHeight = settings->value("General/SettingsWindowHeight", 0).toInt(); } + if (m_windowWidth > 0 && m_windowHeight > 0) + resize(m_windowWidth, m_windowHeight); buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); connect(buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply())); @@ -77,6 +84,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId, connect(this, SIGNAL(settingsDialogShown(Core::Internal::SettingsDialog*)), m_instanceManager, SLOT(settingsDialogShown(Core::Internal::SettingsDialog*))); connect(this, SIGNAL(settingsDialogRemoved()), m_instanceManager, SLOT(settingsDialogRemoved())); + splitter->setCollapsible(0, false); splitter->setCollapsible(1, false); pageTree->header()->setVisible(false); @@ -250,5 +258,7 @@ void SettingsDialog::done(int val) QSettings *settings = ICore::instance()->settings(); settings->setValue("General/LastPreferenceCategory", m_currentCategory); settings->setValue("General/LastPreferencePage", m_currentPage); + settings->setValue("General/SettingsWindowWidth", this->width()); + settings->setValue("General/SettingsWindowHeight", this->height()); QDialog::done(val); } diff --git a/ground/src/plugins/coreplugin/dialogs/settingsdialog.h b/ground/src/plugins/coreplugin/dialogs/settingsdialog.h index 82602ed99..9fce427b5 100644 --- a/ground/src/plugins/coreplugin/dialogs/settingsdialog.h +++ b/ground/src/plugins/coreplugin/dialogs/settingsdialog.h @@ -78,6 +78,8 @@ private: bool m_applied; QString m_currentCategory; QString m_currentPage; + int m_windowWidth; + int m_windowHeight; }; } // namespace Internal diff --git a/ground/src/plugins/coreplugin/fancytabwidget.cpp b/ground/src/plugins/coreplugin/fancytabwidget.cpp index c11216385..59b5a1bd3 100644 --- a/ground/src/plugins/coreplugin/fancytabwidget.cpp +++ b/ground/src/plugins/coreplugin/fancytabwidget.cpp @@ -162,6 +162,12 @@ void FancyTabBar::leaveEvent(QEvent *e) } } +void FancyTabBar::updateTabNameIcon(int index, const QIcon &icon, const QString &label) +{ + m_tabs[index].icon = icon; + m_tabs[index].text = label; +} + QSize FancyTabBar::sizeHint() const { QSize sh = tabSizeHint(); @@ -359,6 +365,13 @@ void FancyTabWidget::removeTab(int index) m_tabBar->removeTab(index); } +void FancyTabWidget::updateTabNameIcon(int index, const QIcon &icon, const QString &label) +{ + m_tabBar->updateTabNameIcon(index, icon, label); + m_tabBar->repaint(); +} + + void FancyTabWidget::setBackgroundBrush(const QBrush &brush) { QPalette pal = m_tabBar->palette(); diff --git a/ground/src/plugins/coreplugin/fancytabwidget.h b/ground/src/plugins/coreplugin/fancytabwidget.h index 956c90f33..6d8c362f3 100644 --- a/ground/src/plugins/coreplugin/fancytabwidget.h +++ b/ground/src/plugins/coreplugin/fancytabwidget.h @@ -78,6 +78,7 @@ public: void removeTab(int index) { m_tabs.removeAt(index); } + void updateTabNameIcon(int index, const QIcon &icon, const QString &label); void setCurrentIndex(int index); int currentIndex() const { return m_currentIndex; } @@ -123,6 +124,7 @@ public: void insertCornerWidget(int pos, QWidget *widget); int cornerWidgetCount() const; void setTabToolTip(int index, const QString &toolTip); + void updateTabNameIcon(int index, const QIcon &icon, const QString &label); void paintEvent(QPaintEvent *event); diff --git a/ground/src/plugins/coreplugin/generalsettings.ui b/ground/src/plugins/coreplugin/generalsettings.ui index b33497825..c4cc2c252 100644 --- a/ground/src/plugins/coreplugin/generalsettings.ui +++ b/ground/src/plugins/coreplugin/generalsettings.ui @@ -16,187 +16,183 @@ General settings - - - - - - - User &interface color: - - - colorButton - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 64 - 0 - - - - false - - - - - - - Reset to default - - - R - - - - :/core/images/reset.png:/core/images/reset.png - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + + Terminal: + + - - - - - - Terminal: - - - - - - - - - - Reset to default - - - R - - - - :/core/images/reset.png:/core/images/reset.png - - - - + + + + External editor: + + - - - - - - External editor: - - - - - - - - - - Reset to default - - - R - - - - :/core/images/reset.png:/core/images/reset.png - - - - - - - ? - - - - + + + + When files are externally modified: + + + true + + - - - - - - When files are externally modified: - - - true - - - - - - - - 0 - 0 - - - - 0 - - - - Always ask + + + + + + + User interface color: + + + + + + + Reset to default + + + R + + + + :/core/images/reset.png:/core/images/reset.png + + + + + + + + + + Reset to default + + + R + + + + :/core/images/reset.png:/core/images/reset.png + + + + + + + ? + + + + + + + + 0 + + + + + Reset to default - - - Reload all modified files + R - - - - Ignore modifications + + + :/core/images/reset.png:/core/images/reset.png - - - - + + + + + + + 0 + 0 + + + + + 64 + 0 + + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + + + + + + 0 + 0 + + + + 0 + + + + Always ask + + + + + Reload all modified files + + + + + Ignore modifications + + + + + + + + Qt::Horizontal + + + + 132 + 20 + + + + + + @@ -220,11 +216,9 @@ Utils::QtColorButton QToolButton -
utils/qtcolorbutton.h
+
utils/qtcolorbutton.h
- - - + diff --git a/ground/src/plugins/coreplugin/modemanager.cpp b/ground/src/plugins/coreplugin/modemanager.cpp index 28b63f200..167165ed8 100644 --- a/ground/src/plugins/coreplugin/modemanager.cpp +++ b/ground/src/plugins/coreplugin/modemanager.cpp @@ -175,6 +175,14 @@ void ModeManager::updateModeToolTip() } } +void ModeManager::updateModeNameIcon(IMode *mode, const QIcon &icon, const QString &label) +{ + int index = indexOf(mode->uniqueModeName()); + if (index < 0) + return; + m_modeStack->updateTabNameIcon(index, icon, label); +} + void ModeManager::aboutToRemoveObject(QObject *obj) { IMode *mode = Aggregation::query(obj); diff --git a/ground/src/plugins/coreplugin/modemanager.h b/ground/src/plugins/coreplugin/modemanager.h index 4b29aace6..1092fc402 100644 --- a/ground/src/plugins/coreplugin/modemanager.h +++ b/ground/src/plugins/coreplugin/modemanager.h @@ -39,6 +39,7 @@ QT_BEGIN_NAMESPACE class QSignalMapper; class QMenu; +class QIcon; QT_END_NAMESPACE namespace Core { @@ -67,6 +68,7 @@ public: void addAction(Command *command, int priority, QMenu *menu = 0); void addWidget(QWidget *widget); + void updateModeNameIcon(IMode *mode, const QIcon &icon, const QString &label); signals: void currentModeAboutToChange(Core::IMode *mode); diff --git a/ground/src/plugins/coreplugin/uavgadgetmode.cpp b/ground/src/plugins/coreplugin/uavgadgetmode.cpp index d2c0ee82d..42f64cca9 100644 --- a/ground/src/plugins/coreplugin/uavgadgetmode.cpp +++ b/ground/src/plugins/coreplugin/uavgadgetmode.cpp @@ -87,11 +87,21 @@ QString UAVGadgetMode::name() const return m_name; } +void UAVGadgetMode::setName(QString name) +{ + m_name = name; +} + QIcon UAVGadgetMode::icon() const { return m_icon; } +void UAVGadgetMode::setIcon(QIcon icon) +{ + m_icon = icon; +} + int UAVGadgetMode::priority() const { return m_priority; diff --git a/ground/src/plugins/coreplugin/uavgadgetmode.h b/ground/src/plugins/coreplugin/uavgadgetmode.h index 6c7e941b7..a89490a40 100644 --- a/ground/src/plugins/coreplugin/uavgadgetmode.h +++ b/ground/src/plugins/coreplugin/uavgadgetmode.h @@ -63,6 +63,8 @@ public: const char* uniqueModeName() const; QList context() const; UAVGadgetManager* uavGadgetManager() const { return m_uavGadgetManager; } + void setName(QString name); + void setIcon(QIcon icon); private slots: void grabUAVGadgetManager(Core::IMode *mode); diff --git a/ground/src/plugins/coreplugin/uavgadgetoptionspage.ui b/ground/src/plugins/coreplugin/uavgadgetoptionspage.ui index a34dbd7dd..6aa3765c1 100644 --- a/ground/src/plugins/coreplugin/uavgadgetoptionspage.ui +++ b/ground/src/plugins/coreplugin/uavgadgetoptionspage.ui @@ -57,22 +57,6 @@ - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 20 - 0 - - - - diff --git a/ground/src/plugins/coreplugin/workspacesettings.cpp b/ground/src/plugins/coreplugin/workspacesettings.cpp index 7c9456a58..fd554c200 100644 --- a/ground/src/plugins/coreplugin/workspacesettings.cpp +++ b/ground/src/plugins/coreplugin/workspacesettings.cpp @@ -27,6 +27,8 @@ #include "workspacesettings.h" #include +#include +#include #include #include "ui_workspacesettings.h" @@ -73,7 +75,10 @@ QWidget *WorkspaceSettings::createPage(QWidget *parent) m_page = new Ui::WorkspaceSettings(); QWidget *w = new QWidget(parent); m_page->setupUi(w); + + // Read workspaces from settings m_page->numberOfWorkspacesSpinBox->setMaximum(MAX_WORKSPACES); + m_modeManager = Core::ICore::instance()->modeManager(); m_settings = Core::ICore::instance()->settings(); m_settings->beginGroup(QLatin1String("Workspace")); const int numberOfWorkspaces = m_settings->value(QLatin1String("NumberOfWorkspaces"), 2).toInt(); @@ -89,26 +94,26 @@ QWidget *WorkspaceSettings::createPage(QWidget *parent) if (i <= numberOfWorkspaces) m_page->workspaceComboBox->addItem(QIcon(iconName), name); } + m_page->iconPathChooser->setExpectedKind(Utils::PathChooser::File); + m_page->iconPathChooser->setPromptDialogFilter(tr("Images (*.png *.jpg *.bmp *.xpm)")); + m_page->iconPathChooser->setPromptDialogTitle(tr("Choose icon")); m_settings->endGroup(); connect(m_page->workspaceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectWorkspace(int))); connect(m_page->numberOfWorkspacesSpinBox, SIGNAL(valueChanged(int)), this, SLOT(numberOfWorkspacesChanged(int))); connect(m_page->nameEdit, SIGNAL(textEdited(QString)), this, SLOT(textEdited(QString))); + connect(m_page->iconPathChooser, SIGNAL(browsingFinished()), this, SLOT(iconChanged())); m_currentIndex = 0; - QString iconName = m_iconNames.at(m_currentIndex); - m_page->iconEdit->setText(iconName); - m_page->iconLabel->setPixmap(QIcon(iconName).pixmap(16, 16)); - m_page->nameEdit->setText(m_names.at(m_currentIndex)); + selectWorkspace(m_currentIndex); + return w; } void WorkspaceSettings::apply() { - - m_iconNames.replace(m_currentIndex, m_page->iconEdit->text()); - m_names.replace(m_currentIndex, m_page->nameEdit->text()); + selectWorkspace(m_currentIndex, true); m_settings->beginGroup(QLatin1String("Workspace")); m_settings->setValue(QLatin1String("NumberOfWorkspaces"), m_page->numberOfWorkspacesSpinBox->value()); @@ -118,6 +123,11 @@ void WorkspaceSettings::apply() QString defaultIconName = "Icon" + numberString; m_settings->setValue(defaultName, m_names.at(i-1)); m_settings->setValue(defaultIconName, m_iconNames.at(i-1)); + QString modeName = "Mode" + numberString; + Core::Internal::UAVGadgetMode *mode = qobject_cast(m_modeManager->mode(modeName)); + if (mode) { + m_modeManager->updateModeNameIcon(mode, QIcon(m_iconNames.at(i-1)), m_names.at(i-1)); + } } m_settings->endGroup(); @@ -133,6 +143,12 @@ void WorkspaceSettings::textEdited(QString name) m_page->workspaceComboBox->setItemText(m_currentIndex, m_page->nameEdit->text()); } +void WorkspaceSettings::iconChanged() +{ + QString iconName = m_page->iconPathChooser->path(); + m_page->workspaceComboBox->setItemIcon(m_currentIndex, QIcon(iconName)); +} + void WorkspaceSettings::numberOfWorkspacesChanged(int value) { int count = m_page->workspaceComboBox->count(); @@ -147,18 +163,19 @@ void WorkspaceSettings::numberOfWorkspacesChanged(int value) } } -void WorkspaceSettings::selectWorkspace(int index) +void WorkspaceSettings::selectWorkspace(int index, bool store) { - // write old values of workspace not shown anymore - m_iconNames.replace(m_currentIndex, m_page->iconEdit->text()); - m_names.replace(m_currentIndex, m_page->nameEdit->text()); - m_page->workspaceComboBox->setItemIcon(m_currentIndex, QIcon(m_page->iconEdit->text())); - m_page->workspaceComboBox->setItemText(m_currentIndex, m_page->nameEdit->text()); + if (store || (index != m_currentIndex)) { + // write old values of workspace not shown anymore + m_iconNames.replace(m_currentIndex, m_page->iconPathChooser->path()); + m_names.replace(m_currentIndex, m_page->nameEdit->text()); + m_page->workspaceComboBox->setItemIcon(m_currentIndex, QIcon(m_page->iconPathChooser->path())); + m_page->workspaceComboBox->setItemText(m_currentIndex, m_page->nameEdit->text()); + } - // display current workspace + // display current workspace QString iconName = m_iconNames.at(index); - m_page->iconEdit->setText(iconName); - m_page->iconLabel->setPixmap(QIcon(iconName).pixmap(16, 16)); + m_page->iconPathChooser->setPath(iconName); m_page->nameEdit->setText(m_names.at(index)); m_currentIndex = index; } diff --git a/ground/src/plugins/coreplugin/workspacesettings.h b/ground/src/plugins/coreplugin/workspacesettings.h index e333d0c19..6e66533dc 100644 --- a/ground/src/plugins/coreplugin/workspacesettings.h +++ b/ground/src/plugins/coreplugin/workspacesettings.h @@ -36,6 +36,8 @@ class QSettings; namespace Core { + class ModeManager; + namespace Internal { namespace Ui { @@ -62,12 +64,14 @@ public: signals: public slots: - void selectWorkspace(int index); + void selectWorkspace(int index, bool store = false); void numberOfWorkspacesChanged(int value); void textEdited(QString string); + void iconChanged(); private: Ui::WorkspaceSettings *m_page; QSettings *m_settings; + ModeManager *m_modeManager; QStringList m_iconNames; QStringList m_names; int m_currentIndex; diff --git a/ground/src/plugins/coreplugin/workspacesettings.ui b/ground/src/plugins/coreplugin/workspacesettings.ui index 987eaee3f..8e19687df 100644 --- a/ground/src/plugins/coreplugin/workspacesettings.ui +++ b/ground/src/plugins/coreplugin/workspacesettings.ui @@ -7,11 +7,11 @@ 0 0 400 - 300 + 320 - + 0 0 @@ -19,182 +19,166 @@ Form - - - - 10 - 10 - 371 - 101 - + + + 0 - - - 0 - 0 - - - - Workspaces - - - - - 10 - 20 - 331 - 31 - - - - - - - Number of workspaces: - - - - - - - 1 - - - 10 - - - 2 - - - - - - - - - 10 - 60 - 331 - 31 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - horizontalLayoutWidget - horizontalLayoutWidget_2 - horizontalLayoutWidget_3 - - - - - 10 - 120 - 371 - 111 - - - - - 0 - 0 - - - - Details - - - - - 10 - 20 - 331 - 31 - - - - - - - Icon: - - - - - - - - - - - - - - - - - false - - - Choose - - - - - - - - - 10 - 60 - 331 - 41 - - - - - - - Name: - - - - - - - - - - - - - 20 - 240 - 311 - 16 - - - - <b>Note:</b> A restart is needed for changes to take effect. - - + + + + + 0 + 0 + + + + Workspaces + + + + + + Number of workspaces: + + + + + + + Qt::Horizontal + + + + 0 + 20 + + + + + + + + Change details of workspace: + + + + + + + + + + + 0 + 0 + + + + 1 + + + 10 + + + 2 + + + + + + + + + + + 0 + 0 + + + + Details + + + + + + Icon: + + + + + + + + + + + + + Name: + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Note:</span> A restart is needed for changes to number of workspaces to take effect.</p></body></html> + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Note:</span> A restart is needed for changes to number of workspaces to take effect.</p></body></html> + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Utils::PathChooser + QWidget +
utils/pathchooser.h
+ 1 +
+
diff --git a/ground/src/plugins/hitl/hitloptionspage.cpp b/ground/src/plugins/hitl/hitloptionspage.cpp index c54dd8321..68abe443e 100644 --- a/ground/src/plugins/hitl/hitloptionspage.cpp +++ b/ground/src/plugins/hitl/hitloptionspage.cpp @@ -45,52 +45,29 @@ QWidget *HITLOptionsPage::createPage(QWidget *parent) m_optionsPage = new Ui::HITLOptionsPage(); QWidget* optionsPageWidget = new QWidget; m_optionsPage->setupUi(optionsPageWidget); - connect(m_optionsPage->loadFileBin, SIGNAL(clicked()), this, SLOT(onLoadFileBinClicked())); - connect(m_optionsPage->loadFileData, SIGNAL(clicked()), this, SLOT(onLoadFileDataClicked())); + + m_optionsPage->executablePathChooser->setExpectedKind(Utils::PathChooser::File); + m_optionsPage->executablePathChooser->setPromptDialogTitle(tr("Choose FlightGear executable")); + m_optionsPage->dataDirectoryPathChooser->setExpectedKind(Utils::PathChooser::Directory); + m_optionsPage->dataDirectoryPathChooser->setPromptDialogTitle(tr("Choose FlightGear data directory")); // Restore the contents from the settings: - m_optionsPage->fgPathBin->setText(m_config->fgPathBin()); - m_optionsPage->fgPathData->setText(m_config->fgPathData()); + m_optionsPage->executablePathChooser->setPath(m_config->fgPathBin()); + m_optionsPage->dataDirectoryPathChooser->setPath(m_config->fgPathData()); m_optionsPage->fgManualControl->setChecked(m_config->fgManualControl()); + return optionsPageWidget; } void HITLOptionsPage::apply() { - m_config->setFGPathBin( m_optionsPage->fgPathBin->text()); - m_config->setFGPathData( m_optionsPage->fgPathData->text()); + m_config->setFGPathBin( m_optionsPage->executablePathChooser->path()); + m_config->setFGPathData( m_optionsPage->dataDirectoryPathChooser->path()); m_config->setFGManualControl( m_optionsPage->fgManualControl->isChecked()); } void HITLOptionsPage::finish() { - disconnect(this); delete m_optionsPage; } - -void HITLOptionsPage::onLoadFileBinClicked() -{ - QFileDialog::Options options; - QString selectedFilter; - QString fileName = QFileDialog::getOpenFileName(qobject_cast(this), - tr("QFileDialog::getOpenFileName()"), - m_optionsPage->fgPathBin->text(), - tr("All Files (*)"), - &selectedFilter, - options); - if (!fileName.isEmpty()) m_optionsPage->fgPathBin->setText(fileName); -} - -void HITLOptionsPage::onLoadFileDataClicked() -{ - QFileDialog::Options options; - QString selectedFilter; - QString fileName = QFileDialog::getExistingDirectory(qobject_cast(this), - tr("Open Directory"), - m_optionsPage->fgPathData->text(), - QFileDialog::ShowDirsOnly - | QFileDialog::DontResolveSymlinks); - if (!fileName.isEmpty()) m_optionsPage->fgPathData->setText(fileName); -} - diff --git a/ground/src/plugins/hitl/hitloptionspage.ui b/ground/src/plugins/hitl/hitloptionspage.ui index 27a0c93f9..52382e435 100644 --- a/ground/src/plugins/hitl/hitloptionspage.ui +++ b/ground/src/plugins/hitl/hitloptionspage.ui @@ -1,162 +1,106 @@ - - - HITLOptionsPage - - - - 0 - 0 - 675 - 300 - - - - - 0 - 0 - - - - Form - - - - - -1 - -1 - 481 - 339 - - - - - QLayout::SetMinimumSize - - - 10 - - - 5 - - - 10 - - - 10 - - - - - 10 - - - QLayout::SetMinimumSize - - - 10 - - - - - - 0 - 0 - - - - FlightGear Executable - - - - - - - - 0 - 0 - - - - - - - - - - - Browse - - - - - - - - - QLayout::SetMinimumSize - - - - - - 0 - 0 - - - - FlightGear Data Directory - - - - - - - - - - Browse - - - - - - - - - QLayout::SetMinimumSize - - - - - Manual aircraft control (can be used when hardware is not available) - - - - - - - - - Qt::Horizontal - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - + + + HITLOptionsPage + + + + 0 + 0 + 400 + 320 + + + + + 0 + 0 + + + + Form + + + + 0 + + + + + + 0 + 0 + + + + FlightGear executable: + + + + + + + + 0 + 0 + + + + FlightGear data directory: + + + + + + + + 1 + 0 + + + + + + + + + + + + 0 + 0 + + + + Manual aircraft control (can be used when hardware is not available) + + + Manual aircraft control (can be used when hardware is not available) + + + + + + + Qt::Vertical + + + + 20 + 182 + + + + + + + + + Utils::PathChooser + QWidget +
utils/pathchooser.h
+ 1 +
+
+ + +
diff --git a/ground/src/plugins/map/map.pro b/ground/src/plugins/map/map.pro index b5eb51fa3..1b7e43e4f 100644 --- a/ground/src/plugins/map/map.pro +++ b/ground/src/plugins/map/map.pro @@ -17,3 +17,4 @@ SOURCES += mapplugin.cpp \ mapgadgetwidget.cpp \ mapgadgetoptionspage.cpp OTHER_FILES += MapGadget.pluginspec +FORMS += mapgadgetoptionspage.ui diff --git a/ground/src/plugins/map/mapgadgetoptionspage.cpp b/ground/src/plugins/map/mapgadgetoptionspage.cpp index 4866f636c..b684638f9 100644 --- a/ground/src/plugins/map/mapgadgetoptionspage.cpp +++ b/ground/src/plugins/map/mapgadgetoptionspage.cpp @@ -34,6 +34,8 @@ #include #include +#include "ui_mapgadgetoptionspage.h" + MapGadgetOptionsPage::MapGadgetOptionsPage(MapGadgetConfiguration *config, QObject *parent) : IOptionsPage(parent), @@ -43,80 +45,30 @@ MapGadgetOptionsPage::MapGadgetOptionsPage(MapGadgetConfiguration *config, QObje QWidget *MapGadgetOptionsPage::createPage(QWidget *parent) { - QWidget *widget = new QWidget; - QVBoxLayout *vl = new QVBoxLayout(); - widget->setLayout(vl); + m_page = new Ui::MapGadgetOptionsPage(); + QWidget *w = new QWidget(parent); + m_page->setupUi(w); - QHBoxLayout *providerLayout = new QHBoxLayout(); - QWidget *mp = new QWidget; - mp->setLayout(providerLayout); - QWidget *label = new QLabel("Map Provider:"); - m_providerComboBox = new QComboBox(); - m_providerComboBox->addItem("OpenStreetMap"); - m_providerComboBox->addItem("Google"); - m_providerComboBox->addItem("Google Sat"); -// m_providerComboBox->addItem("Yahoo"); - providerLayout->addWidget(label); - providerLayout->addWidget(m_providerComboBox); - - QHBoxLayout *zoomLayout = new QHBoxLayout(); - QWidget *x = new QWidget; - x->setLayout(zoomLayout); - label = new QLabel("Default zoom:"); - m_zoomSpin = new QSpinBox(); - m_zoomSpin->setMaximum(18); - zoomLayout->addWidget(label); - zoomLayout->addWidget(m_zoomSpin); - - QHBoxLayout *latLayout = new QHBoxLayout(); - QWidget *y = new QWidget; - y->setLayout(latLayout); - label = new QLabel("Default latitude:"); - m_latSpin = new QDoubleSpinBox(); - m_latSpin->setDecimals(8); - m_latSpin->setMinimum(-90); - m_latSpin->setMaximum(90); - latLayout->addWidget(label); - latLayout->addWidget(m_latSpin); - - QHBoxLayout *longLayout = new QHBoxLayout(); - QWidget *z = new QWidget; - z->setLayout(longLayout); - label = new QLabel("Default longitude:"); - m_longSpin = new QDoubleSpinBox(); - m_longSpin->setDecimals(8); - m_longSpin->setMinimum(-180); - m_longSpin->setMaximum(180); - longLayout->addWidget(label); - longLayout->addWidget(m_longSpin); - QSpacerItem *spacer = new QSpacerItem(100, 100, QSizePolicy::Expanding, QSizePolicy::Expanding); - - vl->addWidget(mp); - vl->addWidget(x); - vl->addWidget(y); - vl->addWidget(z); - vl->addSpacerItem(spacer); - - int index = m_providerComboBox->findText(m_config->mapProvider()); + int index = m_page->providerComboBox->findText(m_config->mapProvider()); index = (index >= 0) ? index : 0; - m_providerComboBox->setCurrentIndex(index); - m_zoomSpin->setValue(m_config->zoom()); - m_latSpin->setValue(m_config->latitude()); - m_longSpin->setValue(m_config->longitude()); + m_page->providerComboBox->setCurrentIndex(index); + m_page->zoomSpinBox->setValue(m_config->zoom()); + m_page->latitudeSpinBox->setValue(m_config->latitude()); + m_page->longitudeSpinBox->setValue(m_config->longitude()); - return widget; + return w; } void MapGadgetOptionsPage::apply() { - m_config->setMapProvider(m_providerComboBox->currentText()); - m_config->setZoom(m_zoomSpin->value()); - m_config->setLatitude(m_latSpin->value()); - m_config->setLongitude(m_longSpin->value()); + m_config->setMapProvider(m_page->providerComboBox->currentText()); + m_config->setZoom(m_page->zoomSpinBox->value()); + m_config->setLatitude(m_page->latitudeSpinBox->value()); + m_config->setLongitude(m_page->longitudeSpinBox->value()); } void MapGadgetOptionsPage::finish() { - + delete m_page; } diff --git a/ground/src/plugins/map/mapgadgetoptionspage.h b/ground/src/plugins/map/mapgadgetoptionspage.h index 6e6f39e64..e3771f297 100644 --- a/ground/src/plugins/map/mapgadgetoptionspage.h +++ b/ground/src/plugins/map/mapgadgetoptionspage.h @@ -30,13 +30,15 @@ #include "coreplugin/dialogs/ioptionspage.h" -namespace Core { -class IUAVGadgetConfiguration; -} class MapGadgetConfiguration; -class QComboBox; -class QSpinBox; -class QDoubleSpinBox; + +namespace Core { + class IUAVGadgetConfiguration; +} + +namespace Ui { + class MapGadgetOptionsPage; +} using namespace Core; @@ -55,11 +57,7 @@ signals: public slots: private: MapGadgetConfiguration *m_config; - QComboBox *m_providerComboBox; - QSpinBox *m_zoomSpin; - QDoubleSpinBox *m_latSpin; - QDoubleSpinBox *m_longSpin; - + Ui::MapGadgetOptionsPage *m_page; }; #endif // MAPGADGETOPTIONSPAGE_H diff --git a/ground/src/plugins/map/mapgadgetoptionspage.ui b/ground/src/plugins/map/mapgadgetoptionspage.ui new file mode 100644 index 000000000..ee91b339d --- /dev/null +++ b/ground/src/plugins/map/mapgadgetoptionspage.ui @@ -0,0 +1,130 @@ + + + MapGadgetOptionsPage + + + + 0 + 0 + 400 + 300 + + + + Form + + + + 0 + + + + + Map provider: + + + + + + + + OpenStreetMap + + + + + Google + + + + + Google Sat + + + + + + + + Default zoom: + + + + + + + 18 + + + + + + + Default latitude: + + + + + + + 8 + + + -90.000000000000000 + + + 90.000000000000000 + + + + + + + Default longitude: + + + + + + + 8 + + + -180.000000000000000 + + + 180.000000000000000 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + diff --git a/ground/src/plugins/modelview/modelview.pro b/ground/src/plugins/modelview/modelview.pro index 8d1434b3a..e6ed37612 100644 --- a/ground/src/plugins/modelview/modelview.pro +++ b/ground/src/plugins/modelview/modelview.pro @@ -1,20 +1,21 @@ -TEMPLATE = lib -TARGET = ModelViewGadget -include(../../openpilotgcsplugin.pri) -include(../../plugins/coreplugin/coreplugin.pri) -include(../../libs/glc_lib/glc_lib.pri) -include(modelview_dependencies.pri) -INCLUDEPATH += ../../libs/glc_lib/install/include/GLC_lib -HEADERS += modelviewplugin.h \ - modelviewgadgetconfiguration.h \ - modelviewgadget.h \ - modelviewgadgetwidget.h \ - modelviewgadgetfactory.h \ - modelviewgadgetoptionspage.h -SOURCES += modelviewplugin.cpp \ - modelviewgadgetconfiguration.cpp \ - modelviewgadget.cpp \ - modelviewgadgetfactory.cpp \ - modelviewgadgetwidget.cpp \ - modelviewgadgetoptionspage.cpp -OTHER_FILES += ModelViewGadget.pluginspec +TEMPLATE = lib +TARGET = ModelViewGadget +include(../../openpilotgcsplugin.pri) +include(../../plugins/coreplugin/coreplugin.pri) +include(../../libs/glc_lib/glc_lib.pri) +include(modelview_dependencies.pri) +INCLUDEPATH += ../../libs/glc_lib/install/include/GLC_lib +HEADERS += modelviewplugin.h \ + modelviewgadgetconfiguration.h \ + modelviewgadget.h \ + modelviewgadgetwidget.h \ + modelviewgadgetfactory.h \ + modelviewgadgetoptionspage.h +SOURCES += modelviewplugin.cpp \ + modelviewgadgetconfiguration.cpp \ + modelviewgadget.cpp \ + modelviewgadgetfactory.cpp \ + modelviewgadgetwidget.cpp \ + modelviewgadgetoptionspage.cpp +OTHER_FILES += ModelViewGadget.pluginspec +FORMS += modelviewoptionspage.ui diff --git a/ground/src/plugins/modelview/modelviewgadgetoptionspage.cpp b/ground/src/plugins/modelview/modelviewgadgetoptionspage.cpp index 0dce4f86e..78eeeac84 100644 --- a/ground/src/plugins/modelview/modelviewgadgetoptionspage.cpp +++ b/ground/src/plugins/modelview/modelviewgadgetoptionspage.cpp @@ -28,6 +28,8 @@ #include "modelviewgadgetoptionspage.h" #include "modelviewgadgetconfiguration.h" +#include "ui_modelviewoptionspage.h" + ModelViewGadgetOptionsPage::ModelViewGadgetOptionsPage(ModelViewGadgetConfiguration *config, QObject *parent) : IOptionsPage(parent), @@ -37,60 +39,32 @@ ModelViewGadgetOptionsPage::ModelViewGadgetOptionsPage(ModelViewGadgetConfigurat QWidget *ModelViewGadgetOptionsPage::createPage(QWidget *parent) { - QWidget *widget = new QWidget; - QVBoxLayout *vl = new QVBoxLayout(); - widget->setLayout(vl); + m_page = new Ui::ModelViewOptionsPage(); + QWidget *w = new QWidget(parent); + m_page->setupUi(w); - QWidget *label = new QLabel("3D Object File:"); - vl->addWidget(label); - - m_acFileLabel = new QLabel(m_config->acFilename()); - QWidget* acPushbutton = new QPushButton("Change model"); - vl->addWidget(m_acFileLabel); - vl->addWidget(acPushbutton); + m_page->modelPathChooser->setExpectedKind(Utils::PathChooser::File); + m_page->modelPathChooser->setPromptDialogFilter(tr("3D model (*.dae *.3ds)")); + m_page->modelPathChooser->setPromptDialogTitle(tr("Choose 3D model")); + m_page->backgroundPathChooser->setExpectedKind(Utils::PathChooser::File); + m_page->backgroundPathChooser->setPromptDialogFilter(tr("Images (*.png *.jpg *.bmp *.xpm)")); + m_page->backgroundPathChooser->setPromptDialogTitle(tr("Choose background image")); - QSpacerItem *spacer = new QSpacerItem(100, 100, QSizePolicy::Expanding, QSizePolicy::Expanding); - vl->addSpacerItem(spacer); - label = new QLabel("Background image file:"); - vl->addWidget(label); - - m_bgFileLabel = new QLabel(m_config->bgFilename()); - QWidget* bgPushbutton = new QPushButton("Change background"); - vl->addWidget(m_bgFileLabel); - vl->addWidget(bgPushbutton); + m_page->modelPathChooser->setPath(m_config->acFilename()); + m_page->backgroundPathChooser->setPath(m_config->bgFilename()); - QSpacerItem *spacer2 = new QSpacerItem(100, 100, QSizePolicy::Expanding, QSizePolicy::Expanding); - vl->addSpacerItem(spacer2); - - connect(acPushbutton, SIGNAL(clicked()), this, SLOT(changeAC()) ); - connect(bgPushbutton, SIGNAL(clicked()), this, SLOT(changeBG()) ); - - return widget; + return w; } void ModelViewGadgetOptionsPage::apply() { - //m_config->setAcFilename(m_acFileName->selectedFiles()); - //m_config->setBgFilename(m_bgFileName->selectedFiles()); + m_config->setAcFilename(m_page->modelPathChooser->path()); + m_config->setBgFilename(m_page->backgroundPathChooser->path()); } void ModelViewGadgetOptionsPage::finish() { + delete m_page; } -void ModelViewGadgetOptionsPage::changeAC() -{ - QString ac = QFileDialog::getOpenFileName(qobject_cast(this), - tr("Model 3D File"), "../artwork/", tr("3D File (*.dae *.3ds)") ); - m_config->setAcFilename(ac); - m_acFileLabel->setText(ac); -} - -void ModelViewGadgetOptionsPage::changeBG() -{ - QString bg = QFileDialog::getOpenFileName(qobject_cast(this), - tr("Background Image File"), "../artwork", tr("Image Files (*.png *.jpg *.bmp)") ); - m_config->setBgFilename(bg); - m_bgFileLabel->setText(bg); -} diff --git a/ground/src/plugins/modelview/modelviewgadgetoptionspage.h b/ground/src/plugins/modelview/modelviewgadgetoptionspage.h index 9e9b8dfcd..c64ec6f23 100644 --- a/ground/src/plugins/modelview/modelviewgadgetoptionspage.h +++ b/ground/src/plugins/modelview/modelviewgadgetoptionspage.h @@ -35,11 +35,14 @@ #include #include -namespace Core { -class IUAVGadgetConfiguration; -} class ModelViewGadgetConfiguration; class QFileDialog; +namespace Core { + class IUAVGadgetConfiguration; +} +namespace Ui { + class ModelViewOptionsPage; +} using namespace Core; @@ -62,13 +65,10 @@ signals: public slots: private slots: - void changeAC(); - void changeBG(); private: ModelViewGadgetConfiguration *m_config; - QLabel *m_acFileLabel; - QLabel *m_bgFileLabel; + Ui::ModelViewOptionsPage *m_page; }; #endif // MODELVIEWGADGETOPTIONSPAGE_H diff --git a/ground/src/plugins/modelview/modelviewoptionspage.ui b/ground/src/plugins/modelview/modelviewoptionspage.ui new file mode 100644 index 000000000..f8277be63 --- /dev/null +++ b/ground/src/plugins/modelview/modelviewoptionspage.ui @@ -0,0 +1,65 @@ + + + ModelViewOptionsPage + + + + 0 + 0 + 400 + 300 + + + + Form + + + + 0 + + + + + 3D model: + + + + + + + Background image: + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Utils::PathChooser + QWidget +
utils/pathchooser.h
+ 1 +
+
+ + +
diff --git a/ground/src/plugins/systemhealth/systemhealthgadgetoptionspage.cpp b/ground/src/plugins/systemhealth/systemhealthgadgetoptionspage.cpp index 9d864b17f..6ef830da6 100644 --- a/ground/src/plugins/systemhealth/systemhealthgadgetoptionspage.cpp +++ b/ground/src/plugins/systemhealth/systemhealthgadgetoptionspage.cpp @@ -50,9 +50,10 @@ QWidget *SystemHealthGadgetOptionsPage::createPage(QWidget *parent) options_page->setupUi(optionsPageWidget); // Restore the contents from the settings: - options_page->svgSourceFile->setText(m_config->getSystemFile()); - - connect(options_page->loadFile, SIGNAL(clicked()), this, SLOT(on_loadFile_clicked())); + options_page->svgFilePathChooser->setExpectedKind(Utils::PathChooser::File); + options_page->svgFilePathChooser->setPromptDialogFilter(tr("SVG image (*.svg)")); + options_page->svgFilePathChooser->setPromptDialogTitle(tr("Choose SVG image")); + options_page->svgFilePathChooser->setPath(m_config->getSystemFile()); return optionsPageWidget; } @@ -64,30 +65,11 @@ QWidget *SystemHealthGadgetOptionsPage::createPage(QWidget *parent) */ void SystemHealthGadgetOptionsPage::apply() { - m_config->setSystemFile(options_page->svgSourceFile->text()); -} - -/** - -Opens an open file dialog. - -*/ -void SystemHealthGadgetOptionsPage::on_loadFile_clicked() -{ - QFileDialog::Options options; - QString selectedFilter; - QString fileName = QFileDialog::getOpenFileName(qobject_cast(this), - tr("QFileDialog::getOpenFileName()"), - options_page->svgSourceFile->text(), - tr("All Files (*);;SVG Files (*.svg)"), - &selectedFilter, - options); - if (!fileName.isEmpty()) options_page->svgSourceFile->setText(fileName); - + m_config->setSystemFile(options_page->svgFilePathChooser->path()); } void SystemHealthGadgetOptionsPage::finish() { - + delete options_page; } diff --git a/ground/src/plugins/systemhealth/systemhealthgadgetoptionspage.ui b/ground/src/plugins/systemhealth/systemhealthgadgetoptionspage.ui index 405eea6f4..a5306de24 100644 --- a/ground/src/plugins/systemhealth/systemhealthgadgetoptionspage.ui +++ b/ground/src/plugins/systemhealth/systemhealthgadgetoptionspage.ui @@ -1,109 +1,61 @@ - - - SystemHealthGadgetOptionsPage - - - - 0 - 0 - 486 - 300 - - - - - 0 - 0 - - - - Form - - - - - -1 - -1 - 481 - 339 - - - - - QLayout::SetMinimumSize - - - 10 - - - 5 - - - 10 - - - 10 - - - - - 10 - - - QLayout::SetMaximumSize - - - 10 - - - - - Subsystem SVG: - - - - - - - - - - Load file... - - - - - - - - - Qt::Horizontal - - - - - - - Qt::Horizontal - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - + + + SystemHealthGadgetOptionsPage + + + + 0 + 0 + 486 + 300 + + + + + 0 + 0 + + + + Form + + + + 0 + + + + + Subsystem SVG: + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Utils::PathChooser + QWidget +
utils/pathchooser.h
+ 1 +
+
+ + +
diff --git a/ground/src/plugins/uavobjectbrowser/uavobjectbrowser.pro b/ground/src/plugins/uavobjectbrowser/uavobjectbrowser.pro index 066b7294d..482573693 100644 --- a/ground/src/plugins/uavobjectbrowser/uavobjectbrowser.pro +++ b/ground/src/plugins/uavobjectbrowser/uavobjectbrowser.pro @@ -23,4 +23,5 @@ SOURCES += browserplugin.cpp \ browseritemdelegate.cpp \ fieldtreeitem.cpp OTHER_FILES += UAVObjectBrowser.pluginspec -FORMS += uavobjectbrowser.ui +FORMS += uavobjectbrowser.ui \ + uavobjectbrowseroptionspage.ui diff --git a/ground/src/plugins/uavobjectbrowser/uavobjectbrowseroptionspage.cpp b/ground/src/plugins/uavobjectbrowser/uavobjectbrowseroptionspage.cpp index 452535b98..e5a5a2fe9 100644 --- a/ground/src/plugins/uavobjectbrowser/uavobjectbrowseroptionspage.cpp +++ b/ground/src/plugins/uavobjectbrowser/uavobjectbrowseroptionspage.cpp @@ -34,6 +34,8 @@ #include #include +#include "ui_uavobjectbrowseroptionspage.h" + UAVObjectBrowserOptionsPage::UAVObjectBrowserOptionsPage(UAVObjectBrowserConfiguration *config, QObject *parent) : IOptionsPage(parent), @@ -43,103 +45,26 @@ UAVObjectBrowserOptionsPage::UAVObjectBrowserOptionsPage(UAVObjectBrowserConfigu QWidget *UAVObjectBrowserOptionsPage::createPage(QWidget *parent) { - QWidget *widget = new QWidget; - QVBoxLayout *vl = new QVBoxLayout(); - widget->setLayout(vl); + m_page = new Ui::UAVObjectBrowserOptionsPage(); + QWidget *w = new QWidget(parent); + m_page->setupUi(w); - QHBoxLayout *recentColorLayout = new QHBoxLayout(); - QWidget *ru = new QWidget; - ru->setLayout(recentColorLayout); - QWidget *label = new QLabel(tr("Recently updated highlight color:")); - QHBoxLayout *rubLayout = new QHBoxLayout(); - QWidget *rub = new QWidget; - rub->setLayout(rubLayout); - m_ruLabel = new QLabel(" "); - m_ruLabel->setMinimumWidth(40); - m_ruButton = new QPushButton(tr("Choose")); - rubLayout->addWidget(m_ruLabel); - rubLayout->addWidget(m_ruButton); - recentColorLayout->addWidget(label); - recentColorLayout->addWidget(rub); + m_page->recentlyUpdatedButton->setColor(m_config->recentlyUpdatedColor()); + m_page->manuallyChangedButton->setColor(m_config->manuallyChangedColor()); + m_page->recentlyUpdatedTimeoutSpinBox->setValue(m_config->recentlyUpdatedTimeout()); - QHBoxLayout *manualColorLayout = new QHBoxLayout(); - QWidget *mc = new QWidget; - mc->setLayout(manualColorLayout); - label = new QLabel(tr("Manually changed color:")); - QHBoxLayout *mcbLayout = new QHBoxLayout(); - QWidget *mcb = new QWidget; - mcb->setLayout(mcbLayout); - m_mcLabel = new QLabel(" "); - m_mcLabel->setMinimumWidth(40); - m_mcButton = new QPushButton(tr("Choose")); - mcbLayout->addWidget(m_mcLabel); - mcbLayout->addWidget(m_mcButton); - manualColorLayout->addWidget(label); - manualColorLayout->addWidget(mcb); - - QHBoxLayout *timeoutLayout = new QHBoxLayout(); - QWidget *x = new QWidget; - x->setLayout(timeoutLayout); - label = new QLabel("Recently updated highlight timeout (ms):"); - m_timeoutSpin = new QSpinBox(); - m_timeoutSpin->setSingleStep(100); - m_timeoutSpin->setMaximum(1000000000); - timeoutLayout->addWidget(label); - timeoutLayout->addWidget(m_timeoutSpin); - - QSpacerItem *spacer = new QSpacerItem(100, 100, QSizePolicy::Expanding, QSizePolicy::Expanding); - - vl->addWidget(ru); - vl->addWidget(mc); - vl->addWidget(x); - vl->addSpacerItem(spacer); - - m_ruColor = m_config->recentlyUpdatedColor(); - QString s = QString("background-color: %1").arg(m_ruColor.name()); - m_ruLabel->setStyleSheet(s); - m_mcColor = m_config->manuallyChangedColor(); - s = QString("background-color: %1").arg(m_mcColor.name()); - m_mcLabel->setStyleSheet(s); - m_timeoutSpin->setValue(m_config->recentlyUpdatedTimeout()); - - connect(m_ruButton, SIGNAL(clicked()), this, SLOT(ruButtonClicked())); - connect(m_mcButton, SIGNAL(clicked()), this, SLOT(mcButtonClicked())); - - return widget; + return w; } void UAVObjectBrowserOptionsPage::apply() { - m_config->setRecentlyUpdatedColor(m_ruColor); - m_config->setManuallyChangedColor(m_mcColor); - m_config->setRecentlyUpdatedTimeout(m_timeoutSpin->value()); + m_config->setRecentlyUpdatedColor(m_page->recentlyUpdatedButton->color()); + m_config->setManuallyChangedColor(m_page->manuallyChangedButton->color()); + m_config->setRecentlyUpdatedTimeout(m_page->recentlyUpdatedTimeoutSpinBox->value()); } void UAVObjectBrowserOptionsPage::finish() { - disconnect(m_ruButton, SIGNAL(clicked()), this, SLOT(ruButtonClicked())); - disconnect(m_mcButton, SIGNAL(clicked()), this, SLOT(mcButtonClicked())); - delete m_ruButton; - delete m_mcButton; - delete m_ruLabel; - delete m_mcLabel; - delete m_timeoutSpin; + delete m_page; } - -void UAVObjectBrowserOptionsPage::ruButtonClicked() -{ - QColor c = QColorDialog::getColor(m_ruColor); - m_ruColor = c.isValid() ? c : m_ruColor; - QString s = QString("background-color: %1").arg(m_ruColor.name()); - m_ruLabel->setStyleSheet(s); -} - -void UAVObjectBrowserOptionsPage::mcButtonClicked() -{ - QColor c = QColorDialog::getColor(m_mcColor); - m_mcColor = c.isValid() ? c : m_mcColor; - QString s = QString("background-color: %1").arg(m_mcColor.name()); - m_mcLabel->setStyleSheet(s); -} - diff --git a/ground/src/plugins/uavobjectbrowser/uavobjectbrowseroptionspage.h b/ground/src/plugins/uavobjectbrowser/uavobjectbrowseroptionspage.h index 9b6db6612..f5d3c8f56 100644 --- a/ground/src/plugins/uavobjectbrowser/uavobjectbrowseroptionspage.h +++ b/ground/src/plugins/uavobjectbrowser/uavobjectbrowseroptionspage.h @@ -30,6 +30,8 @@ #include "coreplugin/dialogs/ioptionspage.h" #include +#include + namespace Core { class IUAVGadgetConfiguration; @@ -41,6 +43,10 @@ class QSpinBox; using namespace Core; +namespace Ui { + class UAVObjectBrowserOptionsPage; +} + class UAVObjectBrowserOptionsPage : public IOptionsPage { Q_OBJECT @@ -54,18 +60,9 @@ public: signals: private slots: - void ruButtonClicked(); - void mcButtonClicked(); private: UAVObjectBrowserConfiguration *m_config; - QColor m_ruColor; - QColor m_mcColor; - QLabel *m_ruLabel; - QLabel *m_mcLabel; - QPushButton *m_ruButton; - QPushButton *m_mcButton; - QSpinBox *m_timeoutSpin; - + Ui::UAVObjectBrowserOptionsPage *m_page; }; #endif // UAVOBJECTBROWSEROPTIONSPAGE_H diff --git a/ground/src/plugins/uavobjectbrowser/uavobjectbrowseroptionspage.ui b/ground/src/plugins/uavobjectbrowser/uavobjectbrowseroptionspage.ui new file mode 100644 index 000000000..474e26dc6 --- /dev/null +++ b/ground/src/plugins/uavobjectbrowser/uavobjectbrowseroptionspage.ui @@ -0,0 +1,129 @@ + + + UAVObjectBrowserOptionsPage + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + Recently updated color: + + + + + + + Manually changed color: + + + + + + + Recently updated timeout (ms): + + + + + + + Qt::Horizontal + + + + 0 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + + 64 + 0 + + + + + + + + + + + + 0 + 0 + + + + + 64 + 0 + + + + + + + + + + + + 0 + 0 + + + + 100000000 + + + 100 + + + + + + + + Utils::QtColorButton + QToolButton +
utils/qtcolorbutton.h
+
+
+ + +