Show (experimental) Qt settings
This commit is contained in:
parent
3c96c33bf3
commit
5220e2cc6a
|
@ -6,6 +6,8 @@
|
|||
#include <tagparser/tag.h>
|
||||
#include <tagparser/backuphelper.h>
|
||||
|
||||
#include <qtutilities/settingsdialog/qtsettings.h>
|
||||
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
#include <QApplication>
|
||||
|
@ -38,7 +40,7 @@ MultipleTagHandling &multipleTagHandling()
|
|||
}
|
||||
bool &hideTagSelectionComboBox()
|
||||
{
|
||||
static bool v = true;
|
||||
static bool v = false;
|
||||
return v;
|
||||
}
|
||||
bool &forceFullParse()
|
||||
|
@ -292,6 +294,13 @@ QString &editorScript()
|
|||
return v;
|
||||
}
|
||||
|
||||
// Qt settings
|
||||
Dialogs::QtSettings &qtSettings()
|
||||
{
|
||||
static Dialogs::QtSettings v;
|
||||
return v;
|
||||
}
|
||||
|
||||
void restore()
|
||||
{
|
||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), QApplication::applicationName());
|
||||
|
@ -318,7 +327,7 @@ void restore()
|
|||
multipleTagHandling() = MultipleTagHandling::SeparateEditors;
|
||||
break;
|
||||
}
|
||||
hideTagSelectionComboBox() = settings.value(QStringLiteral("hidetagselectioncombobox"), true).toBool();
|
||||
hideTagSelectionComboBox() = settings.value(QStringLiteral("hidetagselectioncombobox"), false).toBool();
|
||||
settings.beginGroup(QStringLiteral("autocorrection"));
|
||||
insertTitleFromFilename() = settings.value(QStringLiteral("inserttitlefromfilename"), false).toBool();
|
||||
trimWhitespaces() = settings.value(QStringLiteral("trimwhitespaces"), true).toBool();
|
||||
|
@ -441,6 +450,8 @@ void restore()
|
|||
externalScript() = settings.value(QStringLiteral("file")).toString();
|
||||
editorScript() = settings.value(QStringLiteral("script")).toString();
|
||||
settings.endGroup();
|
||||
|
||||
qtSettings().restore(settings);
|
||||
}
|
||||
|
||||
void save()
|
||||
|
@ -524,6 +535,8 @@ void save()
|
|||
settings.setValue(QStringLiteral("file"), Settings::externalScript());
|
||||
settings.setValue(QStringLiteral("script"), Settings::editorScript());
|
||||
settings.endGroup();
|
||||
|
||||
qtSettings().save(settings);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,10 @@ enum class TagUsage;
|
|||
enum class ElementPosition;
|
||||
}
|
||||
|
||||
namespace Dialogs {
|
||||
class QtSettings;
|
||||
}
|
||||
|
||||
namespace Settings {
|
||||
|
||||
// general
|
||||
|
@ -111,6 +115,9 @@ int &scriptSource();
|
|||
QString &externalScript();
|
||||
QString &editorScript();
|
||||
|
||||
// Qt settings
|
||||
Dialogs::QtSettings &qtSettings();
|
||||
|
||||
void restore();
|
||||
void save();
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <qtutilities/resources/qtconfigarguments.h>
|
||||
#include <qtutilities/resources/resources.h>
|
||||
#include <qtutilities/settingsdialog/qtsettings.h>
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
|
@ -19,12 +20,13 @@ int runWidgetsGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs,
|
|||
{
|
||||
SET_QT_APPLICATION_INFO;
|
||||
QApplication a(argc, argv);
|
||||
Settings::restore();
|
||||
// apply settings specified via command line args after the settings chosen in the GUI to give the CLI options precedence
|
||||
Settings::qtSettings().apply();
|
||||
qtConfigArgs.applySettings(Settings::qtSettings().hasCustomFont());
|
||||
// load resources needed by classes of qtutilities
|
||||
QtUtilitiesResources::init();
|
||||
// apply settings specified via command line args
|
||||
qtConfigArgs.applySettings();
|
||||
LOAD_QT_TRANSLATIONS;
|
||||
Settings::restore();
|
||||
int res;
|
||||
if(launchRenamingUtility) {
|
||||
RenameFilesDialog w;
|
||||
|
|
|
@ -234,8 +234,8 @@ void MainWindow::fileSelected()
|
|||
if(!m_internalFileSelection) {
|
||||
const QModelIndexList selectedIndexes = m_ui->filesTreeView->selectionModel()->selectedRows();
|
||||
if(selectedIndexes.count() == 1) {
|
||||
QString path(m_fileModel->filePath(m_fileFilterModel->mapToSource(selectedIndexes.at(0))));
|
||||
QFileInfo fileInfo(path);
|
||||
const QString path(m_fileModel->filePath(m_fileFilterModel->mapToSource(selectedIndexes.at(0))));
|
||||
const QFileInfo fileInfo(path);
|
||||
if(fileInfo.isFile()) {
|
||||
startParsing(path);
|
||||
m_ui->pathLineEdit->setText(fileInfo.dir().path());
|
||||
|
@ -269,13 +269,16 @@ void MainWindow::handleFileStatusChange(bool opened, bool hasTag)
|
|||
/*!
|
||||
* \brief Handles that the current path has changed by the tag editor widget itself.
|
||||
*/
|
||||
void MainWindow::handleCurrentPathChanged(const QString ¤tPath)
|
||||
void MainWindow::handleCurrentPathChanged(const QString &newPath)
|
||||
{
|
||||
// ensure the current file is still selected
|
||||
m_internalFileSelection = true;
|
||||
const QModelIndex index = m_fileFilterModel->mapFromSource(m_fileModel->index(currentPath));
|
||||
const QModelIndex index = m_fileFilterModel->mapFromSource(m_fileModel->index(newPath));
|
||||
if(index.isValid()) {
|
||||
m_ui->filesTreeView->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Rows | QItemSelectionModel::ClearAndSelect);
|
||||
m_ui->pathLineEdit->setText(QFileInfo(newPath).dir().path());
|
||||
m_ui->pathLineEdit->setProperty("classNames", QStringList());
|
||||
updateStyle(m_ui->pathLineEdit);
|
||||
}
|
||||
m_internalFileSelection = false;
|
||||
// ensure this is the active window
|
||||
|
|
|
@ -60,7 +60,7 @@ private slots:
|
|||
void showSaveAsDlg();
|
||||
void saveFileInformation();
|
||||
void handleFileStatusChange(bool opened, bool hasTag);
|
||||
void handleCurrentPathChanged(const QString ¤tPath);
|
||||
void handleCurrentPathChanged(const QString &newPath);
|
||||
|
||||
// settings
|
||||
void showSettingsDlg();
|
||||
|
|
|
@ -603,12 +603,15 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
|
|||
category->assignPages(QList<Dialogs::OptionPage *>() << new FileBrowserGeneralOptionPage);
|
||||
categories << category;
|
||||
|
||||
categories << Dialogs::qtOptionCategory(this);
|
||||
categories << Settings::qtSettings().category();
|
||||
|
||||
categoryModel()->setCategories(categories);
|
||||
|
||||
setMinimumSize(800, 450);
|
||||
setWindowIcon(QIcon::fromTheme(QStringLiteral("preferences-other"), QIcon(QStringLiteral(":/tageditor/icons/hicolor/32x32/settingscategories/preferences-other.png"))));
|
||||
|
||||
// some settings could be applied without restarting the application, good idea?
|
||||
//connect(this, &Dialogs::SettingsDialog::applied, bind(&Dialogs::QtSettings::apply, &Settings::qtSettings()));
|
||||
}
|
||||
|
||||
SettingsDialog::~SettingsDialog()
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include <qtutilities/settingsdialog/settingsdialog.h>
|
||||
#include <qtutilities/settingsdialog/optionpage.h>
|
||||
#include <qtutilities/settingsdialog/qtsettings.h>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
|
Loading…
Reference in New Issue