further development of Qt settings

This commit is contained in:
Martchus 2016-04-09 02:33:45 +02:00
parent 323c3b8824
commit aa880c3ed5
5 changed files with 145 additions and 74 deletions

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>514</width>
<height>158</height>
<width>430</width>
<height>172</height>
</rect>
</property>
<property name="windowTitle">
@ -39,12 +39,18 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="6" column="1">
<widget class="QToolButton" name="paletteToolButton">
<property name="enabled">
<bool>false</bool>
@ -87,6 +93,12 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>More options ...</string>
</property>
@ -94,7 +106,7 @@
</item>
</layout>
</item>
<item row="4" column="0">
<item row="6" column="0">
<widget class="QLabel" name="paletteLabel">
<property name="text">
<string>Palette</string>
@ -104,30 +116,6 @@
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="styleSheetHorizontalLayout">
<property name="spacing">
<number>4</number>
</property>
<item>
<widget class="Widgets::ClearLineEdit" name="styleSheetLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="styleSheetPushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Select file ...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="fontLabel">
<property name="text">
@ -159,20 +147,28 @@
</property>
</widget>
</item>
<item row="4" column="2" alignment="Qt::AlignHCenter">
<item row="6" column="2" alignment="Qt::AlignHCenter">
<widget class="QCheckBox" name="paletteCheckBox">
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Widgets::PathSelection" name="styleSheetPathSelection" native="true">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Widgets::ClearLineEdit</class>
<extends>QLineEdit</extends>
<header location="global">qtutilities/widgets/clearlineedit.h</header>
<class>Widgets::PathSelection</class>
<extends>QWidget</extends>
<header>widgets/pathselection.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
@ -225,38 +221,6 @@
</hint>
</hints>
</connection>
<connection>
<sender>styleSheetCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>styleSheetLineEdit</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>462</x>
<y>104</y>
</hint>
<hint type="destinationlabel">
<x>196</x>
<y>105</y>
</hint>
</hints>
</connection>
<connection>
<sender>styleSheetCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>styleSheetPushButton</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>462</x>
<y>104</y>
</hint>
<hint type="destinationlabel">
<x>368</x>
<y>105</y>
</hint>
</hints>
</connection>
<connection>
<sender>paletteCheckBox</sender>
<signal>toggled(bool)</signal>
@ -273,5 +237,21 @@
</hint>
</hints>
</connection>
<connection>
<sender>styleSheetCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>styleSheetPathSelection</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>378</x>
<y>119</y>
</hint>
<hint type="destinationlabel">
<x>198</x>
<y>119</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialogs::QtEnvOptionPage</class>
<widget class="QWidget" name="Dialogs::QtEnvOptionPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>336</width>
<height>66</height>
</rect>
</property>
<property name="windowTitle">
<string>Environment/paths</string>
</property>
<property name="styleSheet">
<string notr="true">QGroupBox { font-weight: bold };</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="pluginDirLabel">
<property name="text">
<string>Additional plugin directory</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Widgets::PathSelection" name="pluginPathSelection" native="true"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="iconThemePathLabel">
<property name="text">
<string>Additional icon theme path</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Widgets::PathSelection" name="iconThemePathSelection" native="true"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="translationsPathLabel">
<property name="text">
<string>Additional translations path</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Widgets::PathSelection" name="translationPathSelection" native="true"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Widgets::PathSelection</class>
<extends>QWidget</extends>
<header>widgets/pathselection.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -24,6 +24,12 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editable">
<bool>true</bool>
</property>

View File

@ -7,8 +7,11 @@
#include "../paletteeditor/paletteeditor.h"
#include "../widgets/clearlineedit.h"
#include "ui_qtappearanceoptionpage.h"
#include "ui_qtlanguageoptionpage.h"
#include "ui_qtenvoptionpage.h"
#include <QStyleFactory>
#include <QFontDialog>
@ -32,7 +35,8 @@ OptionCategory *qtOptionCategory(QObject *parent)
category->setIcon(QIcon::fromTheme(QStringLiteral("qtcreator")));
category->assignPages(QList<OptionPage *>()
<< new QtAppearanceOptionPage
<< new QtLanguageOptionPage);
<< new QtLanguageOptionPage
<< new QtEnvOptionPage);
return category;
}
@ -49,8 +53,8 @@ bool QtAppearanceOptionPage::apply()
if(hasBeenShown()) {
// read style sheet
QString styleSheet;
if(!ui()->styleSheetLineEdit->text().isEmpty()) {
QFile file(ui()->styleSheetLineEdit->text());
if(!ui()->styleSheetPathSelection->lineEdit()->text().isEmpty()) {
QFile file(ui()->styleSheetPathSelection->lineEdit()->text());
if(!file.open(QFile::ReadOnly)) {
return false;
}
@ -79,7 +83,7 @@ void QtAppearanceOptionPage::reset()
{
if(hasBeenShown()) {
ui()->widgetStyleComboBox->setCurrentText(QApplication::style() ? QApplication::style()->objectName() : QString());
ui()->styleSheetLineEdit->setText(QString() /* TODO */);
ui()->styleSheetPathSelection->lineEdit()->setText(QString() /* TODO */);
ui()->fontComboBox->setCurrentFont(QGuiApplication::font());
ui()->fontPushButton->setPalette(QGuiApplication::palette());
}
@ -94,12 +98,7 @@ QWidget *QtAppearanceOptionPage::setupWidget()
ui()->widgetStyleComboBox->addItems(QStyleFactory::keys());
// setup style sheet selection
QObject::connect(ui()->styleSheetPushButton, &QPushButton::clicked, [this] {
QString styleSheetPath = QFileDialog::getOpenFileName(this->widget());
if(!styleSheetPath.isEmpty()) {
ui()->styleSheetLineEdit->setText(styleSheetPath);
}
});
ui()->styleSheetPathSelection->provideCustomFileMode(QFileDialog::ExistingFile);
// setup font selection
QObject::connect(ui()->fontPushButton, &QPushButton::clicked, [this] {
@ -142,4 +141,26 @@ void QtLanguageOptionPage::reset()
}
}
QtEnvOptionPage::QtEnvOptionPage(QWidget *parentWidget) :
QtEnvOptionPageBase(parentWidget)
{}
QtEnvOptionPage::~QtEnvOptionPage()
{}
bool QtEnvOptionPage::apply()
{
if(hasBeenShown()) {
}
return true;
}
void QtEnvOptionPage::reset()
{
if(hasBeenShown()) {
}
}
}

View File

@ -23,6 +23,8 @@ END_DECLARE_OPTION_PAGE
DECLARE_UI_FILE_BASED_OPTION_PAGE(QtLanguageOptionPage)
DECLARE_UI_FILE_BASED_OPTION_PAGE(QtEnvOptionPage)
}
#endif // QT_UTILITIES_QTSETTINGS_H