aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Mi <codeminister@publicstatic.de>2014-01-23 18:36:26 (GMT)
committerGregor Mi <codeminister@publicstatic.de>2014-01-23 18:36:26 (GMT)
commit7babcb82097e3823fa0a1eaa609c443a3ac6abc6 (patch)
tree41d4d7658fa814c7cba16c7d240a3340081efba0
parentf8b6b62e464e4cae04351994c0c569c450e34bcf (diff)
Add sessionsconfigwidge.ui and remove manual UI code. Add stub for "Number of entries in recent file list"
-rw-r--r--kate/CMakeLists.txt4
-rw-r--r--kate/app/kateconfigdialog.cpp76
-rw-r--r--kate/app/kateconfigdialog.h13
-rw-r--r--kate/app/ui/sessionconfigwidget.ui127
4 files changed, 163 insertions, 57 deletions
diff --git a/kate/CMakeLists.txt b/kate/CMakeLists.txt
index 52e67db..1afdffb 100644
--- a/kate/CMakeLists.txt
+++ b/kate/CMakeLists.txt
@@ -51,6 +51,10 @@ set (KATE_APPLICATION_SRCS
app/main.cpp
)
+qt5_wrap_ui(KATE_APPLICATION_SRCS
+ app/ui/sessionconfigwidget.ui
+)
+
# create kde init executable
kf5_add_kdeinit_executable(kate ${KATE_APPLICATION_SRCS})
target_link_libraries(kdeinit_kate
diff --git a/kate/app/kateconfigdialog.cpp b/kate/app/kateconfigdialog.cpp
index 2189941..52b58b3 100644
--- a/kate/app/kateconfigdialog.cpp
+++ b/kate/app/kateconfigdialog.cpp
@@ -20,6 +20,8 @@
#include "kateconfigdialog.h"
+#include "ui_sessionconfigwidget.h"
+
#include "katemainwindow.h"
#include "katedocmanager.h"
@@ -43,7 +45,6 @@
#include <QFrame>
#include <QGroupBox>
#include <QLabel>
-#include <QRadioButton>
#include <QSpinBox>
#include <QVBoxLayout>
@@ -137,56 +138,29 @@ KateConfigDialog::KateConfigDialog(KateMainWindow *parent, KTextEditor::View *vi
//END General page
//BEGIN Session page
- QFrame *sessionsFrame = new QFrame;
- item = addSubPage(applicationItem, sessionsFrame, i18n("Sessions"));
+ QWidget *sessionsPage = new QWidget();
+ item = addSubPage(applicationItem, sessionsPage, i18n("Sessions"));
item->setHeader(i18n("Session Management"));
item->setIcon(QIcon::fromTheme(QStringLiteral("view-history")));
- layout = new QVBoxLayout(sessionsFrame);
- layout->setMargin(0);
-
- // GROUP with the one below: "Startup"
- buttonGroup = new QGroupBox(i18n("Elements of Sessions"), sessionsFrame);
- vbox = new QVBoxLayout;
- layout->addWidget(buttonGroup);
+ sessionConfigUi = new Ui::SessionConfigWidget();
+ sessionConfigUi->setupUi(sessionsPage);
// restore view config
- m_restoreVC = new QCheckBox(buttonGroup);
- m_restoreVC->setText(i18n("Include &window configuration"));
- m_restoreVC->setChecked(cgGeneral.readEntry("Restore Window Configuration", true));
- m_restoreVC->setWhatsThis(i18n("Check this if you want all your views and frames restored each time you open Kate"));
- connect(m_restoreVC, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
-
- vbox->addWidget(m_restoreVC);
- buttonGroup->setLayout(vbox);
-
- QGroupBox *sessionsStart = new QGroupBox(i18n("Behavior on Application Startup"), sessionsFrame);
- vbox = new QVBoxLayout;
- layout->addWidget(sessionsStart);
-
- m_startNewSessionRadioButton = new QRadioButton(i18n("&Start new session"), sessionsStart);
- m_loadLastUserSessionRadioButton = new QRadioButton(i18n("&Load last-used session"), sessionsStart);
- m_manuallyChooseSessionRadioButton = new QRadioButton(i18n("&Manually choose a session"), sessionsStart);
-
- QString sesStart(cgGeneral.readEntry("Startup Session", "manual"));
- if (sesStart == QStringLiteral("new")) {
- m_startNewSessionRadioButton->setChecked(true);
- } else if (sesStart == QStringLiteral("last")) {
- m_loadLastUserSessionRadioButton->setChecked(true);
- } else {
- m_manuallyChooseSessionRadioButton->setChecked(true);
- }
-
- connect(m_startNewSessionRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
- connect(m_loadLastUserSessionRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
- connect(m_manuallyChooseSessionRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
-
- vbox->addWidget(m_startNewSessionRadioButton);
- vbox->addWidget(m_loadLastUserSessionRadioButton);
- vbox->addWidget(m_manuallyChooseSessionRadioButton);
- sessionsStart->setLayout(vbox);
-
- layout->addStretch(1); // :-] works correct without autoadd
+ sessionConfigUi->restoreVC->setChecked( cgGeneral.readEntry("Restore Window Configuration", true) );
+ connect(sessionConfigUi->restoreVC, SIGNAL(toggled(bool)), this, SLOT(slotChanged()) );
+
+ QString sesStart (cgGeneral.readEntry ("Startup Session", "manual"));
+ if (sesStart == QStringLiteral("new"))
+ sessionConfigUi->startNewSessionRadioButton->setChecked (true);
+ else if (sesStart == QStringLiteral("last"))
+ sessionConfigUi->loadLastUserSessionRadioButton->setChecked (true);
+ else
+ sessionConfigUi->manuallyChooseSessionRadioButton->setChecked (true);
+
+ connect(sessionConfigUi->startNewSessionRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
+ connect(sessionConfigUi->loadLastUserSessionRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
+ connect(sessionConfigUi->manuallyChooseSessionRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotChanged()));
//END Session page
//BEGIN Plugins page
@@ -230,7 +204,9 @@ KateConfigDialog::KateConfigDialog(KateMainWindow *parent, KTextEditor::View *vi
}
KateConfigDialog::~KateConfigDialog()
-{}
+{
+ delete sessionConfigUi;
+}
void KateConfigDialog::addEditorPages()
{
@@ -325,11 +301,11 @@ void KateConfigDialog::slotApply()
if (m_dataChanged) {
KConfigGroup cg = KConfigGroup(config, "General");
- cg.writeEntry("Restore Window Configuration", m_restoreVC->isChecked());
+ cg.writeEntry("Restore Window Configuration", sessionConfigUi->restoreVC->isChecked());
- if (m_startNewSessionRadioButton->isChecked()) {
+ if (sessionConfigUi->startNewSessionRadioButton->isChecked()) {
cg.writeEntry("Startup Session", "new");
- } else if (m_loadLastUserSessionRadioButton->isChecked()) {
+ } else if (sessionConfigUi->loadLastUserSessionRadioButton->isChecked()) {
cg.writeEntry("Startup Session", "last");
} else {
cg.writeEntry("Startup Session", "manual");
diff --git a/kate/app/kateconfigdialog.h b/kate/app/kateconfigdialog.h
index b09e27c..b34e310 100644
--- a/kate/app/kateconfigdialog.h
+++ b/kate/app/kateconfigdialog.h
@@ -34,8 +34,10 @@
class QCheckBox;
class QSpinBox;
-class QRadioButton;
class KateMainWindow;
+namespace Ui {
+ class SessionConfigWidget;
+}
struct PluginPageListItem {
KTextEditor::Plugin *plugin;
@@ -74,12 +76,9 @@ private:
QCheckBox *m_modNotifications;
QCheckBox *m_saveMetaInfos;
QSpinBox *m_daysMetaInfos;
- QCheckBox *m_restoreVC;
-
- // sessions start group:
- QRadioButton *m_startNewSessionRadioButton;
- QRadioButton *m_loadLastUserSessionRadioButton;
- QRadioButton *m_manuallyChooseSessionRadioButton;
+
+ // Sessions Page
+ Ui::SessionConfigWidget *sessionConfigUi;
QHash<KPageWidgetItem *, PluginPageListItem *> m_pluginPages;
QList<KTextEditor::ConfigPage *> m_editorPages;
diff --git a/kate/app/ui/sessionconfigwidget.ui b/kate/app/ui/sessionconfigwidget.ui
new file mode 100644
index 0000000..021d99a
--- /dev/null
+++ b/kate/app/ui/sessionconfigwidget.ui
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SessionConfigWidget</class>
+ <widget class="QWidget" name="SessionConfigWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>490</width>
+ <height>294</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="gbElements">
+ <property name="title">
+ <string>Session elements</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>The session contains the list of open documents, recently opened files list, bookmarks, cursor position etc. When the session is loaded all elements are restored.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Number of entries in recent file list:</string>
+ </property>
+ <property name="buddy">
+ <cstring>spinBoxRecentFilesCount</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBoxRecentFilesCount"/>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="restoreVC">
+ <property name="whatsThis">
+ <string>Check this if you want all your views and frames restored each time you open Kate.</string>
+ </property>
+ <property name="text">
+ <string>Include &amp;window configuration</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="gbAppStartup">
+ <property name="title">
+ <string>Behaviour on Application Startup</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QRadioButton" name="startNewSessionRadioButton">
+ <property name="text">
+ <string>&amp;Start new session</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="loadLastUserSessionRadioButton">
+ <property name="text">
+ <string>&amp;Load last used session</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="manuallyChooseSessionRadioButton">
+ <property name="text">
+ <string>&amp;Manually choose a session</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>spinBoxRecentFilesCount</tabstop>
+ <tabstop>restoreVC</tabstop>
+ <tabstop>startNewSessionRadioButton</tabstop>
+ <tabstop>loadLastUserSessionRadioButton</tabstop>
+ <tabstop>manuallyChooseSessionRadioButton</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>