]> git.lyx.org Git - features.git/commitdiff
Separate PrefShortcuts from PrefUi, in preparation for a shortcuts configuration...
authorBo Peng <bpeng@lyx.org>
Tue, 16 Oct 2007 14:41:46 +0000 (14:41 +0000)
committerBo Peng <bpeng@lyx.org>
Tue, 16 Oct 2007 14:41:46 +0000 (14:41 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20989 a592a061-630c-0410-9148-cb99ea01b6c8

development/scons/scons_manifest.py
src/frontends/qt4/GuiPrefs.cpp
src/frontends/qt4/GuiPrefs.h
src/frontends/qt4/Makefile.am
src/frontends/qt4/ui/PrefShortcutsUi.ui [new file with mode: 0644]
src/frontends/qt4/ui/PrefUi.ui

index fb519458e802c067361cbe8926e310b1ee14971f..19c06f6e3650803224fcad45f6f91990ead41a7e 100644 (file)
@@ -974,6 +974,7 @@ src_frontends_qt4_ui_files = Split('''
     PrefPlaintextUi.ui
     PrefPrinterUi.ui
     PrefScreenFontsUi.ui
+    PrefShortcutsUi.ui
     PrefSpellcheckerUi.ui
     PrefUi.ui
     PrefsUi.ui
index f17e9acd41a7435153c9c277805b361666291dca..a6d42c34c57616ffb5d9b043309b613467e53a61 100644 (file)
@@ -1583,12 +1583,8 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form, QWidget * parent)
                TextLabel1, SLOT(setEnabled(bool)));
        connect(uiFilePB, SIGNAL(clicked()),
                this, SLOT(select_ui()));
-       connect(bindFilePB, SIGNAL(clicked()),
-               this, SLOT(select_bind()));
        connect(uiFileED, SIGNAL(textChanged(const QString &)),
                this, SIGNAL(changed()));
-       connect(bindFileED, SIGNAL(textChanged(const QString &)),
-               this, SIGNAL(changed()));
        connect(restoreCursorCB, SIGNAL(clicked()),
                this, SIGNAL(changed()));
        connect(loadSessionCB, SIGNAL(clicked()),
@@ -1616,7 +1612,6 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form, QWidget * parent)
 void PrefUserInterface::apply(LyXRC & rc) const
 {
        rc.ui_file = internal_path(fromqstr(uiFileED->text()));
-       rc.bind_file = internal_path(fromqstr(bindFileED->text()));
        rc.use_lastfilepos = restoreCursorCB->isChecked();
        rc.load_session = loadSessionCB->isChecked();
        if (loadWindowSizeCB->isChecked()) {
@@ -1637,7 +1632,6 @@ void PrefUserInterface::apply(LyXRC & rc) const
 void PrefUserInterface::update(LyXRC const & rc)
 {
        uiFileED->setText(toqstr(external_path(rc.ui_file)));
-       bindFileED->setText(toqstr(external_path(rc.bind_file)));
        restoreCursorCB->setChecked(rc.use_lastfilepos);
        loadSessionCB->setChecked(rc.load_session);
        bool loadWindowSize = rc.geometry_width == 0 && rc.geometry_height == 0;
@@ -1668,16 +1662,6 @@ void PrefUserInterface::select_ui()
 }
 
 
-void PrefUserInterface::select_bind()
-{
-       docstring const name =
-               from_utf8(internal_path(fromqstr(bindFileED->text())));
-       docstring file = form_->browsebind(name);
-       if (!file.empty())
-               bindFileED->setText(toqstr(file));
-}
-
-
 void PrefUserInterface::on_loadWindowSizeCB_toggled(bool loadwindowsize)
 {
        windowWidthLA->setDisabled(loadwindowsize);
@@ -1687,6 +1671,46 @@ void PrefUserInterface::on_loadWindowSizeCB_toggled(bool loadwindowsize)
 }
 
 
+/////////////////////////////////////////////////////////////////////
+//
+// PrefShortcuts
+//
+/////////////////////////////////////////////////////////////////////
+
+PrefShortcuts::PrefShortcuts(GuiPreferences * form, QWidget * parent)
+       : PrefModule(_("Shortcuts"), form, parent)
+{
+       setupUi(this);
+
+       connect(bindFilePB, SIGNAL(clicked()),
+               this, SLOT(select_bind()));
+       connect(bindFileED, SIGNAL(textChanged(const QString &)),
+               this, SIGNAL(changed()));
+}
+
+
+void PrefShortcuts::apply(LyXRC & rc) const
+{
+       rc.bind_file = internal_path(fromqstr(bindFileED->text()));
+}
+
+
+void PrefShortcuts::update(LyXRC const & rc)
+{
+       bindFileED->setText(toqstr(external_path(rc.bind_file)));
+}
+
+
+void PrefShortcuts::select_bind()
+{
+       docstring const name =
+               from_utf8(internal_path(fromqstr(bindFileED->text())));
+       docstring file = form_->browsebind(name);
+       if (!file.empty())
+               bindFileED->setText(toqstr(file));
+}
+
+
 PrefIdentity::PrefIdentity(QWidget * parent)
        : PrefModule(_("Identity"), 0, parent)
 {
@@ -1734,6 +1758,7 @@ GuiPreferences::GuiPreferences(LyXView & lv)
        connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
 
        add(new PrefUserInterface(this));
+       add(new PrefShortcuts(this));
        add(new PrefScreenFonts(this));
        add(new PrefColors(this));
        add(new PrefDisplay);
index 70ad48eee0ea0e2f1f9daebdd356b9cf1c3932e2..d4ca92472d68bb37b9b0ee1794c8839f9666eb9d 100644 (file)
@@ -30,6 +30,7 @@
 #include "ui_PrefColorsUi.h"
 #include "ui_PrefDisplayUi.h"
 #include "ui_PrefPathsUi.h"
+#include "ui_PrefShortcutsUi.h"
 #include "ui_PrefSpellcheckerUi.h"
 #include "ui_PrefConvertersUi.h"
 #include "ui_PrefFileformatsUi.h"
@@ -338,12 +339,26 @@ public:
 
 public Q_SLOTS:
        void select_ui();
-       void select_bind();
        void on_loadWindowSizeCB_toggled(bool);
 
 };
 
 
+class PrefShortcuts : public PrefModule, public Ui::PrefShortcuts
+{
+       Q_OBJECT
+public:
+       PrefShortcuts(GuiPreferences * form, QWidget * parent = 0);
+
+       void apply(LyXRC & rc) const;
+       void update(LyXRC const & rc);
+
+public Q_SLOTS:
+       void select_bind();
+
+};
+
+
 class PrefIdentity : public PrefModule, public Ui::PrefIdentityUi
 {
        Q_OBJECT
index 583e0c85f9c2c6e845100b9a8884accd47606559..0cb90ec9d0193852e1e8504c99ffa7022a388bdb 100644 (file)
@@ -276,6 +276,7 @@ UIFILES = \
        PrefPlaintextUi.ui \
        PrefPrinterUi.ui \
        PrefScreenFontsUi.ui \
+       PrefShortcutsUi.ui \
        PrefSpellcheckerUi.ui \
        PrefsUi.ui \
        PrefUi.ui \
diff --git a/src/frontends/qt4/ui/PrefShortcutsUi.ui b/src/frontends/qt4/ui/PrefShortcutsUi.ui
new file mode 100644 (file)
index 0000000..5781040
--- /dev/null
@@ -0,0 +1,74 @@
+<ui version="4.0" >
+ <class>PrefShortcuts</class>
+ <widget class="QWidget" name="PrefShortcuts" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>398</width>
+    <height>418</height>
+   </rect>
+  </property>
+  <property name="sizePolicy" >
+   <sizepolicy>
+    <hsizetype>1</hsizetype>
+    <vsizetype>1</vsizetype>
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle" >
+   <string/>
+  </property>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item row="1" column="2" >
+    <widget class="QPushButton" name="bindFilePB" >
+     <property name="text" >
+      <string>B&amp;rowse...</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0" >
+    <widget class="QLabel" name="bindFileLA" >
+     <property name="text" >
+      <string>&amp;Bind file:</string>
+     </property>
+     <property name="buddy" >
+      <cstring>bindFileED</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1" >
+    <widget class="QLineEdit" name="bindFileED" />
+   </item>
+   <item row="5" column="1" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <tabstops>
+  <tabstop>bindFileED</tabstop>
+  <tabstop>bindFilePB</tabstop>
+ </tabstops>
+ <includes>
+  <include location="local" >qt_helpers.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
index 6fdd3a6fb79bb1b2408b89675f9e8d0a0e79fa0d..4edfe17e82407ff651e294dc427e52342efd322e 100644 (file)
      </layout>
     </widget>
    </item>
-   <item row="1" column="2" >
-    <widget class="QPushButton" name="bindFilePB" >
-     <property name="text" >
-      <string>B&amp;rowse...</string>
-     </property>
-    </widget>
-   </item>
    <item row="0" column="0" >
     <widget class="QLabel" name="uiFileLA" >
      <property name="text" >
      </property>
     </widget>
    </item>
-   <item row="1" column="0" >
-    <widget class="QLabel" name="bindFileLA" >
-     <property name="text" >
-      <string>&amp;Bind file:</string>
-     </property>
-     <property name="buddy" >
-      <cstring>bindFileED</cstring>
-     </property>
-    </widget>
-   </item>
    <item row="0" column="1" >
     <widget class="QLineEdit" name="uiFileED" />
    </item>
      </property>
     </widget>
    </item>
-   <item row="1" column="1" >
-    <widget class="QLineEdit" name="bindFileED" />
-   </item>
    <item row="2" column="0" colspan="3" >
     <widget class="QGroupBox" name="GeometryGB" >
      <property name="sizePolicy" >
  <tabstops>
   <tabstop>uiFileED</tabstop>
   <tabstop>uiFilePB</tabstop>
-  <tabstop>bindFileED</tabstop>
-  <tabstop>bindFilePB</tabstop>
   <tabstop>loadWindowSizeCB</tabstop>
   <tabstop>windowWidthSB</tabstop>
   <tabstop>windowHeightSB</tabstop>