mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 23:20:05 +00:00
Added custom theme file selection dialog
This commit is contained in:
parent
8e114c555f
commit
ccf5f6a3d8
7 changed files with 311 additions and 222 deletions
|
|
@ -121,6 +121,7 @@ public:
|
|||
&mapboxApiKey_,
|
||||
&mapTilerApiKey_,
|
||||
&theme_,
|
||||
&themeFile_,
|
||||
&defaultAlertAction_,
|
||||
&clockFormat_,
|
||||
&customStyleDrawLayer_,
|
||||
|
|
@ -242,6 +243,7 @@ public:
|
|||
settings::SettingsInterface<std::int64_t> nmeaBaudRate_ {};
|
||||
settings::SettingsInterface<std::string> nmeaSource_ {};
|
||||
settings::SettingsInterface<std::string> theme_ {};
|
||||
settings::SettingsInterface<std::string> themeFile_ {};
|
||||
settings::SettingsInterface<std::string> warningsProvider_ {};
|
||||
settings::SettingsInterface<bool> antiAliasingEnabled_ {};
|
||||
settings::SettingsInterface<bool> showMapAttribution_ {};
|
||||
|
|
@ -526,6 +528,45 @@ void SettingsDialogImpl::SetupGeneralTab()
|
|||
types::GetUiStyleName);
|
||||
theme_.SetResetButton(self_->ui->resetThemeButton);
|
||||
|
||||
themeFile_.SetSettingsVariable(generalSettings.theme_file());
|
||||
themeFile_.SetEditWidget(self_->ui->themeFileLineEdit);
|
||||
themeFile_.SetResetButton(self_->ui->resetThemeFileButton);
|
||||
//themeFile_.EnableTrimming();
|
||||
|
||||
QObject::connect(
|
||||
self_->ui->themeFileSelectButton,
|
||||
&QAbstractButton::clicked,
|
||||
self_,
|
||||
[this]()
|
||||
{
|
||||
static const std::string themeFilter = "Qt6Ct Theme File (*.conf)";
|
||||
static const std::string allFilter = "All Files (*)";
|
||||
|
||||
QFileDialog* dialog = new QFileDialog(self_);
|
||||
|
||||
dialog->setFileMode(QFileDialog::ExistingFile);
|
||||
|
||||
dialog->setNameFilters(
|
||||
{QObject::tr(themeFilter.c_str()), QObject::tr(allFilter.c_str())});
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
QObject::connect(
|
||||
dialog,
|
||||
&QFileDialog::fileSelected,
|
||||
self_,
|
||||
[this](const QString& file)
|
||||
{
|
||||
QString path = QDir::toNativeSeparators(file);
|
||||
logger_->info("Selected theme file: {}", path.toStdString());
|
||||
self_->ui->themeFileLineEdit->setText(path);
|
||||
|
||||
// setText dows not emit the textEdited signal
|
||||
Q_EMIT self_->ui->themeFileLineEdit->textEdited(path);
|
||||
});
|
||||
|
||||
dialog->open();
|
||||
});
|
||||
|
||||
auto radarSites = config::RadarSite::GetAll();
|
||||
|
||||
// Sort radar sites by ID
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue