diff --git a/dpkg/quardCRT/usr/share/applications/open-with-quardCRT.desktop b/dpkg/quardCRT/usr/share/applications/open-with-quardCRT.desktop new file mode 100644 index 00000000..e20f79b3 --- /dev/null +++ b/dpkg/quardCRT/usr/share/applications/open-with-quardCRT.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Icon=/opt/quardCRT/quardCRT.png +NoDisplay=true +Exec=/usr/bin/quardCRT -m true -s %U %f +Name=quardCRT +Comment=open with quardCRT +MimeType=x-scheme-handler/file;x-scheme-handler/dir; + diff --git a/src/globalsetting.cpp b/src/globalsetting.cpp index 89ed57d3..8689c34a 100644 --- a/src/globalsetting.cpp +++ b/src/globalsetting.cpp @@ -6,3 +6,19 @@ GlobalSetting::GlobalSetting(QObject *parent) QApplication::applicationName(),QApplication::applicationName(),parent) { } + +#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0) +void GlobalSetting::setValue(QAnyStringView key, const QVariant &value) +#else +void GlobalSetting::setValue(const QString &key, const QVariant &value) +#endif +{ + QSettings::setValue(key, value); + if(realtime) + sync(); +} + +void GlobalSetting::setRealtimeSave(bool realtime) +{ + this->realtime = realtime; +} diff --git a/src/globalsetting.h b/src/globalsetting.h index 9c3e43ab..5262c5e5 100644 --- a/src/globalsetting.h +++ b/src/globalsetting.h @@ -8,6 +8,17 @@ class GlobalSetting : public QSettings Q_OBJECT public: explicit GlobalSetting(QObject *parent = nullptr); + +#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0) + void setValue(QAnyStringView key, const QVariant &value); +#else + void setValue(const QString &key, const QVariant &value); +#endif + void setRealtimeSave(bool realtime); + bool isRealtimeSave() const { return realtime;} + +private: + bool realtime = false; }; #endif // GLOBALSETTING_H diff --git a/src/main.cpp b/src/main.cpp index 7ab6a46c..80ad5875 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "qfonticon.h" @@ -164,12 +165,21 @@ int main(int argc, char *argv[]) AppComLineParser->process(application); + GlobalSetting settings; + bool debugMode = settings.value("Debug/DebugMode",false).toBool(); + if(debugMode) { + uint32_t debugLevel = settings.value("Debug/DebugLevel",0).toUInt(); + QString debugLogFile = settings.value("Debug/DebugLogFile","").toString(); + qDebug() << "DebugMode: " << debugMode; + qDebug() << "DebugLevel: " << debugLevel; + qDebug() << "DebugLogFile: " << debugLogFile; + } + QString dark_theme = "true"; QString app_lang; bool isMiniUI = false; QString dir; - GlobalSetting settings; settings.beginGroup("Global/Startup"); if(settings.contains("dark_theme")) dark_theme = settings.value("dark_theme").toString(); @@ -192,6 +202,10 @@ int main(int argc, char *argv[]) isMiniUI = AppComLineParser->getOpt("miniui") == "true"?true:false; if(AppComLineParser->isSetOpt("start_dir")) dir = AppComLineParser->getOpt("start_dir"); + QFileInfo start_dir(dir); + if(start_dir.isFile()) { + dir = start_dir.absolutePath(); + } settings.endGroup(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b032868c..1507346f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -658,6 +658,8 @@ void MainWindow::menuAndToolBarRetranslateUi(void) { } void MainWindow::menuAndToolBarInit(void) { + GlobalSetting settings; + ui->toolBar->setIconSize(QSize(16,16)); ui->toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); @@ -834,6 +836,8 @@ void MainWindow::menuAndToolBarInit(void) { ui->toolBar->addSeparator(); autoSaveOptionsAction = new QAction(this); autoSaveOptionsAction->setCheckable(true); + bool checked = settings.value("Global/Options/AutoSaveOptions",false).toBool(); + autoSaveOptionsAction->setChecked(checked); optionsMenu->addAction(autoSaveOptionsAction); saveSettingsNowAction = new QAction(this); optionsMenu->addAction(saveSettingsNowAction); @@ -885,7 +889,6 @@ void MainWindow::menuAndToolBarInit(void) { cleanAllBookmarkAction = new QAction(this); bookmarkMenu->addAction(cleanAllBookmarkAction); bookmarkMenu->addSeparator(); - GlobalSetting settings; int size = settings.beginReadArray("Global/Bookmark"); for(int i=0;igetTermWidget()->setKeyBindings(keyBinding); diff --git a/theme/dark/darkstyle.qss b/theme/dark/darkstyle.qss index aa97213d..12d9f7bb 100644 --- a/theme/dark/darkstyle.qss +++ b/theme/dark/darkstyle.qss @@ -1476,7 +1476,7 @@ QTabWidget::pane:selected { } QTabWidget::tab-bar { - alignment: left; + alignment: left; } /* QTabBar ---------------------------------------------------------------- diff --git a/theme/light/lightstyle.qss b/theme/light/lightstyle.qss index 532b3c90..f0658aa3 100644 --- a/theme/light/lightstyle.qss +++ b/theme/light/lightstyle.qss @@ -1476,7 +1476,7 @@ QTabWidget::pane:selected { } QTabWidget::tab-bar { - alignment: left; + alignment: left; } /* QTabBar ----------------------------------------------------------------