The QNote dialog

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7280 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2003-07-15 12:48:24 +00:00
parent 69572ae035
commit dc85736c7f
12 changed files with 364 additions and 2 deletions

View File

@ -229,7 +229,7 @@
vertical spaces vertical spaces
@bJürgen Spitzmüller @bJürgen Spitzmüller
@iE-mail: j.spitzmueller@gmx.de @iE-mail: j.spitzmueller@gmx.de
Many improvements to xforms dialogs Qt frontend, bugfixes
@bBen Stanley @bBen Stanley
@iE-mail: bds02@uow.edu.au @iE-mail: bds02@uow.edu.au
fix bugs with error insets placement fix bugs with error insets placement

View File

@ -1,3 +1,7 @@
2003-07-09 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* CREDITS: update.
2003-07-10 John Levon <levon@movementarian.org> 2003-07-10 John Levon <levon@movementarian.org>
* ui/classic.ui: fix toolbars to new scheme, fix space inserts * ui/classic.ui: fix toolbars to new scheme, fix space inserts

View File

@ -60,6 +60,7 @@ src/frontends/qt2/QMath.C
src/frontends/qt2/QMathDialog.C src/frontends/qt2/QMathDialog.C
src/frontends/qt2/QMathMatrixDialog.C src/frontends/qt2/QMathMatrixDialog.C
src/frontends/qt2/QMinipage.C src/frontends/qt2/QMinipage.C
src/frontends/qt2/QNote.C
src/frontends/qt2/QParagraph.C src/frontends/qt2/QParagraph.C
src/frontends/qt2/QPrefs.C src/frontends/qt2/QPrefs.C
src/frontends/qt2/QPrefsDialog.C src/frontends/qt2/QPrefsDialog.C

View File

@ -4,6 +4,15 @@
sure that it is initialized to some reasonable value, so that the sure that it is initialized to some reasonable value, so that the
(ugly) Qt/Mac code can do its magic (conditionally on Q_WS_MAC). (ugly) Qt/Mac code can do its magic (conditionally on Q_WS_MAC).
2003-07-09 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* ui/QNoteDialog.ui:
* QNoteDialog.[Ch]:
* QNote.[Ch]:
* Makefile.dialogs:
* Dialogs.C:
* Dialogs2.C: New Annotation (Note) dialog
2003-07-11 André Pönitz <poenitz@lyx.org> 2003-07-11 André Pönitz <poenitz@lyx.org>
* Alert_pimpl.C: * Alert_pimpl.C:

View File

@ -27,6 +27,7 @@
#include "ControlLog.h" #include "ControlLog.h"
#include "ControlMath.h" #include "ControlMath.h"
#include "ControlMinipage.h" #include "ControlMinipage.h"
#include "ControlNote.h"
#include "ControlParagraph.h" #include "ControlParagraph.h"
#include "ControlRef.h" #include "ControlRef.h"
#include "ControlShowFile.h" #include "ControlShowFile.h"
@ -57,6 +58,7 @@
#include "QLog.h" #include "QLog.h"
#include "QMath.h" #include "QMath.h"
#include "QMinipage.h" #include "QMinipage.h"
#include "QNote.h"
#include "QParagraph.h" #include "QParagraph.h"
#include "QRef.h" #include "QRef.h"
#include "QShowFile.h" #include "QShowFile.h"
@ -84,7 +86,7 @@ char const * const dialognames[] = { "aboutlyx", "bibitem", "bibtex", "changes",
"character", "citation", "error", "errorlist", "ert", "external", "file", "character", "citation", "error", "errorlist", "ert", "external", "file",
"float", "graphics", "include", "index", "label", "latexlog", "float", "graphics", "include", "index", "label", "latexlog",
"mathpanel", "mathdelimiter", "mathmatrix", "mathpanel", "mathdelimiter", "mathmatrix",
"minipage", "paragraph", "ref", "tabular", "tabularcreate", "texinfo", "minipage", "note", "paragraph", "ref", "tabular", "tabularcreate", "texinfo",
#ifdef HAVE_LIBAIKSAURUS #ifdef HAVE_LIBAIKSAURUS
"thesaurus", "thesaurus",
@ -207,6 +209,10 @@ Dialog * Dialogs::build(string const & name)
dialog->setController(new ControlMinipage(*dialog)); dialog->setController(new ControlMinipage(*dialog));
dialog->setView(new QMinipage(*dialog)); dialog->setView(new QMinipage(*dialog));
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "note") {
dialog->setController(new ControlNote(*dialog));
dialog->setView(new QNote(*dialog));
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "paragraph") { } else if (name == "paragraph") {
dialog->setController(new ControlParagraph(*dialog)); dialog->setController(new ControlParagraph(*dialog));
dialog->setView(new QParagraph(*dialog)); dialog->setView(new QParagraph(*dialog));

View File

@ -47,6 +47,7 @@ libqt2_la_SOURCES = \
QLyXKeySym.C QLyXKeySym.h \ QLyXKeySym.C QLyXKeySym.h \
QMath.C QMath.h \ QMath.C QMath.h \
QMinipage.C QMinipage.h \ QMinipage.C QMinipage.h \
QNote.C QNote.h \
QParagraph.C QParagraph.h \ QParagraph.C QParagraph.h \
QPrefs.C QPrefs.h \ QPrefs.C QPrefs.h \
QPrint.C QPrint.h \ QPrint.C QPrint.h \

View File

@ -33,6 +33,7 @@ UIFILES = \
QMathDialogBase.ui \ QMathDialogBase.ui \
QMathMatrixDialogBase.ui \ QMathMatrixDialogBase.ui \
QMinipageDialogBase.ui \ QMinipageDialogBase.ui \
QNoteDialogBase.ui \
QParagraphDialogBase.ui \ QParagraphDialogBase.ui \
QPrefAsciiModule.ui \ QPrefAsciiModule.ui \
QPrefColorsModule.ui \ QPrefColorsModule.ui \
@ -100,6 +101,7 @@ MOCFILES = \
QMathDialog.C QMathDialog.h \ QMathDialog.C QMathDialog.h \
QMathMatrixDialog.C QMathMatrixDialog.h \ QMathMatrixDialog.C QMathMatrixDialog.h \
QMinipageDialog.C QMinipageDialog.h \ QMinipageDialog.C QMinipageDialog.h \
QNoteDialog.C QNoteDialog.h \
QParagraphDialog.C QParagraphDialog.h \ QParagraphDialog.C QParagraphDialog.h \
QPrefsDialog.C QPrefsDialog.h \ QPrefsDialog.C QPrefsDialog.h \
QRefDialog.C QRefDialog.h \ QRefDialog.C QRefDialog.h \

71
src/frontends/qt2/QNote.C Normal file
View File

@ -0,0 +1,71 @@
/**
* \file QNote.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>
#include "ControlNote.h"
#include "qt_helpers.h"
#include "insets/insetnote.h"
#include <qradiobutton.h>
#include <qpushbutton.h>
#include "QNoteDialog.h"
#include "QNote.h"
#include "Qt2BC.h"
typedef QController<ControlNote, QView<QNoteDialog> > base_class;
QNote::QNote(Dialog & parent)
: base_class(parent, _("LyX: Annotation Settings"))
{}
void QNote::build_dialog()
{
dialog_.reset(new QNoteDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setCancel(dialog_->closePB);
}
void QNote::update_contents()
{
QRadioButton * rb = 0;
string type(controller().params().type);
if (type == "Note")
rb = dialog_->noteRB;
else if (type == "Comment")
rb = dialog_->commentRB;
else if (type == "Greyedout")
rb = dialog_->greyedoutRB;
rb->setChecked(true);
}
void QNote::apply()
{
string type;
if (dialog_->greyedoutRB->isChecked())
type = "Greyedout";
else if (dialog_->commentRB->isChecked())
type = "Comment";
else
type = "Note";
controller().params().type = type;
}

39
src/frontends/qt2/QNote.h Normal file
View File

@ -0,0 +1,39 @@
// -*- C++ -*-
/**
* \file QNote.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 QNOTE_H
#define QNOTE_H
#include "QDialogView.h"
class ControlNote;
class QNoteDialog;
/** This class provides a QT implementation of the Note Dialog.
*/
class QNote : public QController<ControlNote, QView<QNoteDialog> >
{
public:
friend class QNoteDialog;
/// Constructor
QNote(Dialog &);
private:
/// Apply changes
virtual void apply();
/// Build the dialog
virtual void build_dialog();
/// Update dialog before showing it
virtual void update_contents();
};
#endif // QNOTE_H

View File

@ -0,0 +1,41 @@
/**
* \file QNoteDialog.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>
#include "QNote.h"
#include "QNoteDialog.h"
#include <qpushbutton.h>
QNoteDialog::QNoteDialog(QNote * form)
: QNoteDialogBase(0, 0, false, 0),
form_(form)
{
connect(okPB, SIGNAL(clicked()),
form, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose()));
}
void QNoteDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
void QNoteDialog::change_adaptor()
{
form_->changed();
}

View File

@ -0,0 +1,32 @@
// -*- C++ -*-
/**
* \file QNoteDialog.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 QNOTEDIALOG_H
#define QNOTEDIALOG_H
#include "ui/QNoteDialogBase.h"
class QNote;
class QNoteDialog : public QNoteDialogBase {
Q_OBJECT
public:
QNoteDialog(QNote * form);
protected slots:
virtual void change_adaptor();
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QNote * form_;
};
#endif // QNOTEDIALOG_H

View File

@ -0,0 +1,156 @@
<!DOCTYPE UI><UI>
<class>QNoteDialogBase</class>
<include location="global">config.h</include>
<include location="local">qt_helpers.h</include>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>QNoteDialogBase</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>188</width>
<height>146</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Annotation Settings</string>
</property>
<property stdset="1">
<name>sizeGripEnabled</name>
<bool>true</bool>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget row="1" column="0" >
<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>default</name>
<bool>false</bool>
</property>
</widget>
<widget row="1" column="1" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>closePB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Close</string>
</property>
<property stdset="1">
<name>default</name>
<bool>true</bool>
</property>
</widget>
<widget row="0" column="0" rowspan="1" colspan="2" >
<class>QButtonGroup</class>
<property stdset="1">
<name>name</name>
<cstring>NoteBG</cstring>
</property>
<property stdset="1">
<name>title</name>
<string>Type</string>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QRadioButton</class>
<property stdset="1">
<name>name</name>
<cstring>noteRB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Note</string>
</property>
<property>
<name>toolTip</name>
<string>LyX internal only</string>
</property>
</widget>
<widget>
<class>QRadioButton</class>
<property stdset="1">
<name>name</name>
<cstring>commentRB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>C&amp;omment</string>
</property>
<property>
<name>toolTip</name>
<string>Export to LaTeX but don't print</string>
</property>
</widget>
<widget>
<class>QRadioButton</class>
<property stdset="1">
<name>name</name>
<cstring>greyedoutRB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Greyed out</string>
</property>
<property>
<name>toolTip</name>
<string>Print as grey text</string>
</property>
</widget>
</vbox>
</widget>
</grid>
</widget>
<connections>
<connection>
<sender>noteRB</sender>
<signal>toggled(bool)</signal>
<receiver>QNoteDialogBase</receiver>
<slot>change_adaptor()</slot>
</connection>
<connection>
<sender>greyedoutRB</sender>
<signal>toggled(bool)</signal>
<receiver>QNoteDialogBase</receiver>
<slot>change_adaptor()</slot>
</connection>
<connection>
<sender>commentRB</sender>
<signal>toggled(bool)</signal>
<receiver>QNoteDialogBase</receiver>
<slot>change_adaptor()</slot>
</connection>
<slot access="public">change_adaptor()</slot>
</connections>
</UI>