- enhancement: show custom theme folder in options dialog -> enviroment -> folders

This commit is contained in:
royqh1979@gmail.com 2022-01-28 23:38:35 +08:00
parent 4a06534d39
commit 2cac889c92
4 changed files with 66 additions and 20 deletions

View File

@ -2,6 +2,7 @@ Red Panda C++ Version 0.14.1
- enhancement: custom theme - enhancement: custom theme
- fix: failed to show function tip, when there are parameters having '[' and ']' - fix: failed to show function tip, when there are parameters having '[' and ']'
- enhancement: display localized theme name in the option dialog - enhancement: display localized theme name in the option dialog
- enhancement: show custom theme folder in options dialog -> enviroment -> folders
Red Panda C++ Version 0.14.0 Red Panda C++ Version 0.14.0
- enhancement: custom icon set ( in the configuration folder) - enhancement: custom icon set ( in the configuration folder)

View File

@ -40,7 +40,16 @@ EnvironmentFoldersWidget::~EnvironmentFoldersWidget()
void EnvironmentFoldersWidget::doLoad() void EnvironmentFoldersWidget::doLoad()
{ {
ui->txtConfigFolder->setText(pSettings->dirs().config()); ui->txtConfigFolder->setText(pSettings->dirs().config());
ui->txtIconSetFolder->setText(pSettings->dirs().config(Settings::Dirs::DataType::IconSet)); ui->txtIconSetFolder->setEnabled(pSettings->environment().useCustomIconSet());
ui->btnOpenIconSetFolderInFileBrowser->setEnabled(pSettings->environment().useCustomIconSet());
if (pSettings->environment().useCustomIconSet()) {
ui->txtIconSetFolder->setText(pSettings->dirs().config(Settings::Dirs::DataType::IconSet));
}
ui->txtThemeFolder->setEnabled(pSettings->environment().useCustomTheme());
ui->btnOpenThemeFolderInFileBrowser->setEnabled(pSettings->environment().useCustomTheme());
if (pSettings->environment().useCustomTheme()) {
ui->txtThemeFolder->setText(pSettings->dirs().config(Settings::Dirs::DataType::Theme));
}
} }
void EnvironmentFoldersWidget::doSave() void EnvironmentFoldersWidget::doSave()
@ -75,6 +84,7 @@ void EnvironmentFoldersWidget::on_btnResetDefault_clicked()
void EnvironmentFoldersWidget::updateIcons(const QSize &size) void EnvironmentFoldersWidget::updateIcons(const QSize &size)
{ {
pIconsManager->setIcon(ui->btnOpenConfigFolderInBrowser,IconsManager::ACTION_FILE_OPEN_FOLDER); pIconsManager->setIcon(ui->btnOpenConfigFolderInBrowser,IconsManager::ACTION_FILE_OPEN_FOLDER);
pIconsManager->setIcon(ui->btnOpenThemeFolderInFileBrowser,IconsManager::ACTION_FILE_OPEN_FOLDER);
pIconsManager->setIcon(ui->btnOpenIconSetFolderInFileBrowser,IconsManager::ACTION_FILE_OPEN_FOLDER); pIconsManager->setIcon(ui->btnOpenIconSetFolderInFileBrowser,IconsManager::ACTION_FILE_OPEN_FOLDER);
} }
@ -87,3 +97,12 @@ void EnvironmentFoldersWidget::on_btnOpenIconSetFolderInFileBrowser_clicked()
} }
void EnvironmentFoldersWidget::on_btnOpenThemeFolderInFileBrowser_clicked()
{
QDesktopServices::openUrl(
QUrl("file:///"+
includeTrailingPathDelimiter(pSettings->dirs().config(Settings::Dirs::DataType::Theme)),QUrl::TolerantMode));
}

View File

@ -47,6 +47,8 @@ private slots:
// SettingsWidget interface // SettingsWidget interface
void on_btnOpenIconSetFolderInFileBrowser_clicked(); void on_btnOpenIconSetFolderInFileBrowser_clicked();
void on_btnOpenThemeFolderInFileBrowser_clicked();
protected: protected:
void updateIcons(const QSize &size) override; void updateIcons(const QSize &size) override;
}; };

View File

@ -14,14 +14,21 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="1"> <item row="2" column="2">
<widget class="QLineEdit" name="txtConfigFolder"> <widget class="QToolButton" name="btnOpenIconSetFolderInFileBrowser">
<property name="readOnly"> <property name="toolTip">
<bool>true</bool> <string>Open in browser</string>
</property>
<property name="text">
<string>Open in browser</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/images/newlook24/053-open.png</normaloff>:/icons/images/newlook24/053-open.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="5" column="0">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -34,7 +41,21 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="2" column="0" colspan="3"> <item row="0" column="1">
<widget class="QLineEdit" name="txtConfigFolder">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Custom icon sets folder:</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QWidget" name="widget" native="true"> <widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@ -60,13 +81,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Configuration folder:</string>
</property>
</widget>
</item>
<item row="0" column="2"> <item row="0" column="2">
<widget class="QToolButton" name="btnOpenConfigFolderInBrowser"> <widget class="QToolButton" name="btnOpenConfigFolderInBrowser">
<property name="toolTip"> <property name="toolTip">
@ -81,24 +95,34 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Custom icon sets folder:</string> <string>Configuration folder:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="1">
<widget class="QLineEdit" name="txtIconSetFolder"> <widget class="QLineEdit" name="txtIconSetFolder">
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Custom theme folder:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="txtThemeFolder"/>
</item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="QToolButton" name="btnOpenIconSetFolderInFileBrowser"> <widget class="QToolButton" name="btnOpenThemeFolderInFileBrowser">
<property name="toolTip"> <property name="toolTip">
<string>Open in browser</string> <string>Open custom theme folder in file browser</string>
</property> </property>
<property name="text"> <property name="text">
<string>Open in browser</string> <string>Open in browser</string>