Skip to content

Commit

Permalink
src:Add option to open current settings file
Browse files Browse the repository at this point in the history
Signed-off-by: xiaoming <2014500726@smail.xtu.edu.cn>
  • Loading branch information
QQxiaoming committed Dec 5, 2023
1 parent 2239644 commit 43f64f3
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [[Unrelease](https://github.com/QQxiaoming/quardCRT)]

- 增加设置选项里打开当前设置文件功能

## [[V0.3.1](https://github.com/QQxiaoming/quardCRT/releases/tag/V0.3.1)] - 2023-12-05

- 增加密码输入框支持显示/隐藏功能
Expand Down
31 changes: 31 additions & 0 deletions src/globaloptions/globaloptionsadvancedwidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,37 @@
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="labelConfigFile">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Config File</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditConfigFile">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonOpenConfigFile">
<property name="text">
<string notr="true">...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
Expand Down
10 changes: 7 additions & 3 deletions src/globaloptions/globaloptionswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
#include <QComboBox>
#include <QMessageBox>
#include <QFontDialog>
#include <QDesktopServices>

#include "filedialog.h"
#include "globalsetting.h"

#include "globaloptionswindow.h"

#include "ui_globaloptionswindow.h"
#include "ui_globaloptionsgeneralwidget.h"
#include "ui_globaloptionsappearancewidget.h"
Expand Down Expand Up @@ -82,8 +84,8 @@ GlobalOptionsWindow::GlobalOptionsWindow(QWidget *parent) :
retranslateUi();

GlobalSetting settings;
globalOptionsAdvancedWidget->ui->lineEditConfigFile->setText(settings.fileName());
settings.beginGroup("Global/Options");

font = QApplication::font();
#if defined(Q_OS_WIN) && defined(Q_CC_MSVC)
int fontId = QFontDatabase::addApplicationFont(QApplication::applicationDirPath() + "/inziu-iosevkaCC-SC-regular.ttf");
Expand Down Expand Up @@ -203,7 +205,9 @@ GlobalOptionsWindow::GlobalOptionsWindow(QWidget *parent) :
globalOptionsAdvancedWidget->ui->checkBoxGithubCopilot->setChecked(false);
}
});

connect(globalOptionsAdvancedWidget->ui->toolButtonOpenConfigFile,&QToolButton::clicked, this, [&](){
QDesktopServices::openUrl(QUrl::fromLocalFile(globalOptionsAdvancedWidget->ui->lineEditConfigFile->text()));
});
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &GlobalOptionsWindow::buttonBoxAccepted);
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &GlobalOptionsWindow::buttonBoxRejected);

Expand Down

0 comments on commit 43f64f3

Please sign in to comment.