]> git.lyx.org Git - features.git/commitdiff
Juergen's QSendto.
authorJohn Levon <levon@movementarian.org>
Wed, 16 Oct 2002 21:26:35 +0000 (21:26 +0000)
committerJohn Levon <levon@movementarian.org>
Wed, 16 Oct 2002 21:26:35 +0000 (21:26 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5429 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/Dialogs.C
src/frontends/qt2/Dialogs2.C
src/frontends/qt2/Dialogs_impl.h
src/frontends/qt2/Makefile.dialogs
src/frontends/qt2/QSendto.C [new file with mode: 0644]
src/frontends/qt2/QSendto.h [new file with mode: 0644]
src/frontends/qt2/QSendtoDialog.C [new file with mode: 0644]
src/frontends/qt2/QSendtoDialog.h [new file with mode: 0644]
src/frontends/qt2/ui/QSendtoDialog.ui [new file with mode: 0644]

index 462204f30212cf34a1ce73b1dbae6dae72094c75..109d07fd785022478cbf0acb47945d5d8aa170ae 100644 (file)
@@ -1,3 +1,13 @@
+2002-10-16  Juergen Spitzmueller  <j.spitzmueller@gmx.de>
+
+       * ui/QSendtoDialog.ui:
+       * QSendtoDialog.[Ch]:
+       * QSendto.[Ch]:
+       * Makefile.dialogs:
+       * Dialogs.C:
+       * Dialogs2.C:
+       * Dialogs_impl.h: Implement Sendto (Custom Export) dialog
+
 2002-10-16  Lars Gullik Bjønnes  <larsbj@birdstep.com>
 
        * qfont_loader.C (font_info): correct calculation of font size
@@ -27,7 +37,7 @@
 2002-10-12  Dekel Tsur  <dekelts@tau.ac.il>
 
        * qfont_loader.C (available): Implemented.
-
+       
 2002-10-09  Edwin Leuven <leuven@fee.uva.nl>
 
        * QDocument.C: Brand new document dialog
index ec32c2ac4159443e24ec2f5f97dc9675575e5d72..bff0b0265c56c10a2db0f2f899645a2643956d81 100644 (file)
@@ -65,6 +65,7 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
          print(lv, d),
          ref(lv, d),
          search(lv, d),
+         sendto(lv, d),
          spellchecker(lv, d),
          tabularcreate(lv, d),
          texinfo(lv, d),
index e3190c7d0af77a58229851a4adf4b5c31b21abd4..479dae737e232c151dfd4ea35b83c075c425a39c 100644 (file)
@@ -204,7 +204,9 @@ void Dialogs::showSearch()
 
 
 void Dialogs::showSendto()
-{}
+{
+       pimpl_->sendto.controller().show();
+}
 
 
 void Dialogs::showSpellchecker()
index 1af45e89f1cd1da897d57f248db0ca0950f1eb31..d91b502d6687f16b24a7cf5674872efd6e68d9be 100644 (file)
@@ -96,7 +96,8 @@
 #include "QRefDialog.h"
 #include "QSearch.h"
 #include "QSearchDialog.h"
-//#include "QSendto.h"
+#include "QSendto.h"
+#include "QSendtoDialog.h"
 #include "QShowFile.h"
 #include "QShowFileDialog.h"
 #include "QSpellchecker.h"
@@ -189,6 +190,9 @@ RefDialog;
 typedef GUI<ControlSearch, QSearch, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
 SearchDialog;
 
+typedef GUI<ControlSendto, QSendto, OkApplyCancelPolicy, Qt2BC>
+SendtoDialog;
+
 typedef GUI<ControlSpellchecker, QSpellchecker, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
 SpellcheckerDialog;
 
@@ -240,6 +244,7 @@ struct Dialogs::Impl {
        PrintDialog         print;
        RefDialog           ref;
        SearchDialog        search;
+       SendtoDialog        sendto;
        SpellcheckerDialog  spellchecker;
        TabularCreateDialog tabularcreate;
        TexinfoDialog       texinfo;
index 6ffb2a63656c6e3c288e07cf14923f3fe3b58d06..a24279e122f2763b81697cec9268b26d7a3c644d 100644 (file)
@@ -23,6 +23,7 @@ DIALOGS = \
        QPrint \
        QRef \
        QSearch \
+       QSendto \
        QShowFile \
        QSpellchecker \
        QTabularCreate \
@@ -77,6 +78,8 @@ DIALOGSOURCES = \
        QRef.C QRefDialog.C \
        QSearch.h QSearchDialog.h \
        QSearch.C QSearchDialog.C \
+       QSendto.h QSendtoDialog.h \
+       QSendto.C QSendtoDialog.C \
        QShowFile.h QShowFileDialog.h \
        QShowFile.C QShowFileDialog.C \
        QSpellchecker.h QSpellcheckerDialog.h \
@@ -119,6 +122,7 @@ MOCDIALOGS = \
        QPrintDialog_moc.C \
        QRefDialog_moc.C \
        QSearchDialog_moc.C \
+       QSendtoDialog_moc.C \
        QShowFileDialog_moc.C \
        QSpellcheckerDialog_moc.C \
        QTabularCreateDialog_moc.C \
@@ -176,6 +180,8 @@ UIDIALOGS = \
        QRefDialogBase.C \
        QSearchDialogBase.h \
        QSearchDialogBase.C \
+       QSendtoDialogBase.h \
+       QSendtoDialogBase.C \
        QShowFileDialogBase.h \
        QShowFileDialogBase.C \
        QSpellcheckerDialogBase.h \
@@ -228,6 +234,7 @@ UIMOCDIALOGS = \
        QPrintDialogBase_moc.C \
        QRefDialogBase_moc.C \
        QSearchDialogBase_moc.C \
+       QSendtoDialogBase_moc.C \
        QShowFileDialogBase_moc.C \
        QSpellcheckerDialogBase_moc.C \
        QTabularCreateDialogBase_moc.C \
diff --git a/src/frontends/qt2/QSendto.C b/src/frontends/qt2/QSendto.C
new file mode 100644 (file)
index 0000000..c0917d5
--- /dev/null
@@ -0,0 +1,101 @@
+/**
+ * \file QSendto.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Juergen Spitzmueller
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "Qt2BC.h"
+#include "ControlSendto.h"
+#include "QSendtoDialog.h"
+#include "QSendto.h"
+
+#include <qcombobox.h>
+#include <qlabel.h>
+#include <qlistbox.h>
+#include <qpushbutton.h>
+
+#include "debug.h"
+#include "gettext.h"
+#include "converter.h"
+
+using std::vector;
+
+typedef Qt2CB<ControlSendto, Qt2DB<QSendtoDialog> > base_class;
+
+QSendto::QSendto()
+       : base_class(_("Send document to command"))
+{
+}
+
+
+void QSendto::build_dialog()
+{
+       dialog_.reset(new QSendtoDialog(this));
+
+       // Manage the ok, apply, restore and cancel/close buttons
+       bc().setOK(dialog_->okPB);
+       bc().setApply(dialog_->applyPB);
+       bc().setCancel(dialog_->closePB);
+}
+
+
+void QSendto::update_contents()
+{
+       all_formats_ = controller().allFormats();
+
+       // Check whether the current contents of the browser will be
+       // changed by loading the contents of formats
+       vector<string> keys;
+       keys.resize(all_formats_.size());
+
+       vector<string>::iterator result = keys.begin();
+       vector<Format const *>::const_iterator it  = all_formats_.begin();
+       vector<Format const *>::const_iterator end = all_formats_.end();
+       for (; it != end; ++it, ++result) {
+               *result = (*it)->prettyname();
+       }
+
+       // Reload the browser
+       dialog_->formatLB->clear();
+
+       for (vector<string>::const_iterator it = keys.begin();
+            it < keys.end(); ++it) {
+               dialog_->formatLB->insertItem(it->c_str());
+       }
+
+       dialog_->commandCO->insertItem(controller().getCommand().c_str());
+}
+
+void QSendto::apply()
+{
+       int const line(dialog_->formatLB->currentItem());
+
+       if (line < 0 || line > dialog_->formatLB->count())
+               return;
+
+       string const cmd(dialog_->commandCO->currentText().latin1());
+
+       controller().setFormat(all_formats_[line]);
+       controller().setCommand(cmd);
+}
+
+bool QSendto::isValid()
+{
+       int const line(dialog_->formatLB->currentItem());
+
+       if (line < 0 || line > dialog_->formatLB->count())
+               return false;
+       
+       else return dialog_->formatLB->count() != 0 &&
+               !string(dialog_->commandCO->currentText()).empty();
+}
diff --git a/src/frontends/qt2/QSendto.h b/src/frontends/qt2/QSendto.h
new file mode 100644 (file)
index 0000000..fc50d49
--- /dev/null
@@ -0,0 +1,51 @@
+// -*- C++ -*-
+/**
+ * \file QSendto.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Juergen Spitzmueller
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#ifndef QSENDTO_H
+#define QSENDTO_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "Qt2Base.h"
+#include <vector>
+
+class ControlSendto;
+class QSendtoDialog;
+class Format;
+
+/** This class provides a Qt implementation of the Custom Export Dialog.
+ */
+class QSendto
+       : public Qt2CB<ControlSendto, Qt2DB<QSendtoDialog> >
+{
+public:
+       ///
+       friend class QSendtoDialog;
+       ///
+       QSendto();
+
+protected:
+       virtual bool isValid();
+
+private:
+       /// Apply from dialog
+       virtual void apply();
+       /// Update the dialog
+       virtual void update_contents();
+       /// Build the dialog
+       virtual void build_dialog();
+       ///
+       std::vector<Format const *> all_formats_;
+};
+
+#endif // QSENDTO_H
diff --git a/src/frontends/qt2/QSendtoDialog.C b/src/frontends/qt2/QSendtoDialog.C
new file mode 100644 (file)
index 0000000..19542aa
--- /dev/null
@@ -0,0 +1,57 @@
+/**
+ * \file QSendtoDialog.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Juergen Spitzmueller
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <vector>
+#include "ControlSendto.h"
+#include "gettext.h"
+#include "debug.h"
+
+#include "converter.h"
+#include "LString.h"
+
+#include <qcombobox.h>
+#include <qlabel.h>
+#include <qlistbox.h>
+#include <qpushbutton.h>
+
+#include "QSendtoDialog.h"
+#include "QSendto.h"
+
+
+QSendtoDialog::QSendtoDialog(QSendto * form)
+       : QSendtoDialogBase(0, 0, false, 0),
+       form_(form)
+{
+       connect(okPB, SIGNAL(clicked()),
+               form, SLOT(slotOK()));
+       connect(applyPB, SIGNAL(clicked()),
+               form, SLOT(slotApply()));
+       connect(closePB, SIGNAL(clicked()),
+               form, SLOT(slotClose()));
+}
+
+
+void QSendtoDialog::changed_adaptor()
+{
+       form_->changed();
+}
+
+
+void QSendtoDialog::closeEvent(QCloseEvent * e)
+{
+       form_->slotWMHide();
+       e->accept();
+}
diff --git a/src/frontends/qt2/QSendtoDialog.h b/src/frontends/qt2/QSendtoDialog.h
new file mode 100644 (file)
index 0000000..fff32b8
--- /dev/null
@@ -0,0 +1,42 @@
+// -*- C++ -*-
+/**
+ * \file QSendtoDialog.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Juergen Spitzmueller
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#ifndef QSENDTODIALOG_H
+#define QSENDTODIALOG_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "ui/QSendtoDialogBase.h"
+
+class QSendto;
+
+class QSendtoDialog : public QSendtoDialogBase
+{
+       Q_OBJECT
+
+public:
+       QSendtoDialog(QSendto * form);
+
+protected slots:
+       virtual void changed_adaptor();
+       virtual void slotFormatHighlighted(const QString&) {};
+       virtual void slotFormatSelected(const QString&) {};
+
+protected:
+       virtual void closeEvent(QCloseEvent * e);
+
+private:
+       QSendto * form_;
+};
+
+#endif // QSENDTODIALOG_H
diff --git a/src/frontends/qt2/ui/QSendtoDialog.ui b/src/frontends/qt2/ui/QSendtoDialog.ui
new file mode 100644 (file)
index 0000000..f501a5b
--- /dev/null
@@ -0,0 +1,267 @@
+<!DOCTYPE UI><UI>
+<class>QSendtoDialogBase</class>
+<include location="global">config.h</include>
+<include location="local">gettext.h</include>
+<widget>
+    <class>QDialog</class>
+    <property stdset="1">
+        <name>name</name>
+        <cstring>QSendtoDialogBase</cstring>
+    </property>
+    <property stdset="1">
+        <name>geometry</name>
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>278</width>
+            <height>262</height>
+        </rect>
+    </property>
+    <property stdset="1">
+        <name>caption</name>
+        <string>Custom Export</string>
+    </property>
+    <property stdset="1">
+        <name>sizeGripEnabled</name>
+        <bool>true</bool>
+    </property>
+    <widget>
+        <class>QComboBox</class>
+        <property stdset="1">
+            <name>name</name>
+            <cstring>commandCO</cstring>
+        </property>
+        <property stdset="1">
+            <name>geometry</name>
+            <rect>
+                <x>15</x>
+                <y>185</y>
+                <width>245</width>
+                <height>22</height>
+            </rect>
+        </property>
+        <property stdset="1">
+            <name>sizePolicy</name>
+            <sizepolicy>
+                <hsizetype>3</hsizetype>
+                <vsizetype>0</vsizetype>
+            </sizepolicy>
+        </property>
+        <property stdset="1">
+            <name>focusPolicy</name>
+            <enum>StrongFocus</enum>
+        </property>
+        <property stdset="1">
+            <name>editable</name>
+            <bool>true</bool>
+        </property>
+        <property stdset="1">
+            <name>sizeLimit</name>
+            <number>10</number>
+        </property>
+        <property stdset="1">
+            <name>maxCount</name>
+            <number>666</number>
+        </property>
+        <property stdset="1">
+            <name>insertionPolicy</name>
+            <enum>AtTop</enum>
+        </property>
+        <property stdset="1">
+            <name>autoCompletion</name>
+            <bool>true</bool>
+        </property>
+        <property stdset="1">
+            <name>duplicatesEnabled</name>
+            <bool>false</bool>
+        </property>
+        <property>
+            <name>toolTip</name>
+            <string>Process the converted file with this command ($$FName = file name)</string>
+        </property>
+    </widget>
+    <widget>
+        <class>QLabel</class>
+        <property stdset="1">
+            <name>name</name>
+            <cstring>commandLA</cstring>
+        </property>
+        <property stdset="1">
+            <name>geometry</name>
+            <rect>
+                <x>15</x>
+                <y>165</y>
+                <width>126</width>
+                <height>16</height>
+            </rect>
+        </property>
+        <property stdset="1">
+            <name>text</name>
+            <string>&amp;Command:</string>
+        </property>
+        <property>
+            <name>buddy</name>
+            <cstring>commandCO</cstring>
+        </property>
+    </widget>
+    <widget>
+        <class>QLabel</class>
+        <property stdset="1">
+            <name>name</name>
+            <cstring>formatLA</cstring>
+        </property>
+        <property stdset="1">
+            <name>geometry</name>
+            <rect>
+                <x>15</x>
+                <y>10</y>
+                <width>115</width>
+                <height>16</height>
+            </rect>
+        </property>
+        <property stdset="1">
+            <name>text</name>
+            <string>&amp;Export formats:</string>
+        </property>
+        <property>
+            <name>buddy</name>
+            <cstring>formatLB</cstring>
+        </property>
+    </widget>
+    <widget>
+        <class>QListBox</class>
+        <item>
+            <property>
+                <name>text</name>
+                <string>New Item</string>
+            </property>
+        </item>
+        <property stdset="1">
+            <name>name</name>
+            <cstring>formatLB</cstring>
+        </property>
+        <property stdset="1">
+            <name>geometry</name>
+            <rect>
+                <x>15</x>
+                <y>30</y>
+                <width>245</width>
+                <height>125</height>
+            </rect>
+        </property>
+        <property stdset="1">
+            <name>maximumSize</name>
+            <size>
+                <width>32767</width>
+                <height>32767</height>
+            </size>
+        </property>
+        <property>
+            <name>toolTip</name>
+            <string>Available export converters</string>
+        </property>
+    </widget>
+    <widget>
+        <class>QLayoutWidget</class>
+        <property stdset="1">
+            <name>name</name>
+            <cstring>Layout6</cstring>
+        </property>
+        <property stdset="1">
+            <name>geometry</name>
+            <rect>
+                <x>11</x>
+                <y>225</y>
+                <width>256</width>
+                <height>24</height>
+            </rect>
+        </property>
+        <hbox>
+            <property stdset="1">
+                <name>margin</name>
+                <number>0</number>
+            </property>
+            <property stdset="1">
+                <name>spacing</name>
+                <number>6</number>
+            </property>
+            <widget>
+                <class>QPushButton</class>
+                <property stdset="1">
+                    <name>name</name>
+                    <cstring>okPB</cstring>
+                </property>
+                <property stdset="1">
+                    <name>text</name>
+                    <string>OK</string>
+                </property>
+                <property stdset="1">
+                    <name>autoDefault</name>
+                    <bool>true</bool>
+                </property>
+                <property stdset="1">
+                    <name>default</name>
+                    <bool>false</bool>
+                </property>
+            </widget>
+            <widget>
+                <class>QPushButton</class>
+                <property stdset="1">
+                    <name>name</name>
+                    <cstring>applyPB</cstring>
+                </property>
+                <property stdset="1">
+                    <name>text</name>
+                    <string>&amp;Apply</string>
+                </property>
+            </widget>
+            <widget>
+                <class>QPushButton</class>
+                <property stdset="1">
+                    <name>name</name>
+                    <cstring>closePB</cstring>
+                </property>
+                <property stdset="1">
+                    <name>text</name>
+                    <string>Cancel</string>
+                </property>
+            </widget>
+        </hbox>
+    </widget>
+</widget>
+<connections>
+    <connection>
+        <sender>formatLB</sender>
+        <signal>highlighted(const QString&amp;)</signal>
+        <receiver>QSendtoDialogBase</receiver>
+        <slot>slotFormatHighlighted(const QString&amp;)</slot>
+    </connection>
+    <connection>
+        <sender>formatLB</sender>
+        <signal>selected(const QString&amp;)</signal>
+        <receiver>QSendtoDialogBase</receiver>
+        <slot>slotFormatSelected(const QString&amp;)</slot>
+    </connection>
+    <connection>
+        <sender>formatLB</sender>
+        <signal>highlighted(const QString&amp;)</signal>
+        <receiver>QSendtoDialogBase</receiver>
+        <slot>changed_adaptor()</slot>
+    </connection>
+    <connection>
+        <sender>commandCO</sender>
+        <signal>textChanged(const QString&amp;)</signal>
+        <receiver>QSendtoDialogBase</receiver>
+        <slot>changed_adaptor()</slot>
+    </connection>
+    <slot access="public">changed_adaptor()</slot>
+    <slot access="public">slotFormatHighlighted(const QString&amp;)</slot>
+    <slot access="public">slotFormatSelected(const QString&amp;)</slot>
+</connections>
+<tabstops>
+    <tabstop>formatLB</tabstop>
+    <tabstop>okPB</tabstop>
+    <tabstop>applyPB</tabstop>
+    <tabstop>closePB</tabstop>
+</tabstops>
+</UI>