27 #include "../../../common/PlatformUtils.h"
28 #include "../../../common/SystemApplicationSettings.h"
29 #include "../../../common/UserApplicationSettings.h"
30 #include "../../../qt/widgets/srs/SRSManagerDialog.h"
31 #include "../../../qt/widgets/utils/ColorPickerToolButton.h"
32 #include "../../../srs/Config.h"
33 #include "../ApplicationController.h"
36 #include "ui_GeneralConfigWidgetForm.h"
40 #include <QPushButton>
45 m_ui(new Ui::GeneralConfigWidgetForm),
49 m_resumeText = tr(
"Changes the general configurations of the application.");
60 QMessageBox msgBox(
this);
62 msgBox.setText(tr(
"The system must be restarted for the changes to take effect."));
63 msgBox.setInformativeText(tr(
"Do you want to do it now?"));
64 msgBox.setWindowTitle(tr(
"Restart system"));
66 std::auto_ptr<QPushButton> restartButton;
67 restartButton.reset(msgBox.addButton(tr(
"Restart now"), QMessageBox::ActionRole));
69 std::auto_ptr<QPushButton> laterResButton;
70 laterResButton.reset(msgBox.addButton(tr(
"Restart later"), QMessageBox::DestructiveRole));
71 msgBox.addButton(QMessageBox::NoButton);
73 msgBox.setDefaultButton(restartButton.get());
77 if(msgBox.clickedButton() == restartButton.get())
84 QSettings settings(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
86 settings.setValue(
"srs/default_srid", m_defaultSRID);
87 settings.setValue(
"color/selection_color", m_colorPicker->getColor().name());
88 settings.setValue(
"toolbars/icon_size", m_ui->m_toolBarIconSizeSpinBox->value());
89 settings.setValue(
"icon_theme/selected_theme", m_ui->m_iconThemeComboBox->currentText());
93 changeApplyButtonState(
false);
102 ns =
"dpi.inpe.br.apf";
103 helpFile =
"apf/settings/generalconfig/GeneralConfig.html";
109 m_ui->m_defaultSRSToolButton->setIcon(QIcon::fromTheme(
"srs"));
113 m_colorPicker->setFixedSize(70, 24);
116 QGridLayout* layout =
new QGridLayout(m_ui->m_selectionColorFrame);
117 layout->setContentsMargins(0, 0, 0, 0);
118 layout->setSizeConstraint(QLayout::SetFixedSize);
119 layout->addWidget(m_colorPicker);
122 QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::instance()->organizationName(), QApplication::instance()->applicationName());
130 QColor selectionColor = QColor(selectionColorName);
131 m_colorPicker->setColor(selectionColor);
135 m_ui->m_toolBarIconSizeSpinBox->setValue(iconSize);
139 QDir iconThemesDir(iconThemesDirPath.c_str());
142 QStringList themes = iconThemesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
143 m_ui->m_iconThemeComboBox->clear();
144 m_ui->m_iconThemeComboBox->addItems(themes);
147 connect(m_ui->m_defaultSRSToolButton, SIGNAL(pressed()), SLOT(onDefaultSRSToolButtonPressed()));
148 connect(m_colorPicker, SIGNAL(colorChanged(
const QColor&)), SLOT(onSelectionColorChanged(
const QColor&)));
149 connect(m_ui->m_toolBarIconSizeSpinBox, SIGNAL(valueChanged(
int)), SLOT(onToolBarIconSizeValueChanged(
int)));
150 connect(m_ui->m_iconThemeComboBox, SIGNAL(currentIndexChanged(
const QString&)), SLOT(onIconThemeCurrentIndexChanged(
const QString&)));
155 m_defaultSRID !=
TE_UNKNOWN_SRS ? m_ui->m_defaultSRSLineEdit->setText(
"EPSG:" + QString::number(m_defaultSRID)) : m_ui->m_defaultSRSLineEdit->setText(tr(
"Unknown SRS"));
161 srsDialog.setWindowTitle(tr(
"Choose the Default SRS"));
163 if(srsDialog.exec() == QDialog::Rejected)
170 changeApplyButtonState(
true);
175 changeApplyButtonState(
true);
180 m_needRestart =
true;
181 changeApplyButtonState(
true);
186 m_needRestart =
true;
187 changeApplyButtonState(
true);
TECOMMONEXPORT std::string FindInTerraLibPath(const std::string &p)
Returns the path relative to a directory or file in the context of TerraLib.
static ApplicationController & getInstance()
It returns a reference to the singleton instance.
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
void setSelectionColor(const QColor &c)
Sets the application selection color.