diff options
Diffstat (limited to 'kvoctrain/kvoctrain/entry-dialogs')
27 files changed, 5123 insertions, 0 deletions
diff --git a/kvoctrain/kvoctrain/entry-dialogs/AdjEntryPage.cpp b/kvoctrain/kvoctrain/entry-dialogs/AdjEntryPage.cpp new file mode 100644 index 00000000..ce97d871 --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/AdjEntryPage.cpp @@ -0,0 +1,108 @@ +/*************************************************************************** + + dialog page for adjectives (comparison) + + ----------------------------------------------------------------------- + + begin : Sat Dec 4 18:09:29 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "AdjEntryPage.h" +#include "EntryDlg.h" + +#include <langset.h> + +#include <qlineedit.h> + + +AdjEntryPage::AdjEntryPage(EntryDlg *_dlgbook, bool multi_sel, const Comparison &comp, QWidget *parent, const char *name) + : AdjEntryPageForm( parent, name ), dlgbook(_dlgbook) +{ + comparisons = comp; + + connect( lev1Field, SIGNAL(textChanged(const QString&)), SLOT(lev1Changed(const QString&)) ); + connect( lev2Field, SIGNAL(textChanged(const QString&)), SLOT(lev2Changed(const QString&)) ); + connect( lev3Field, SIGNAL(textChanged(const QString&)), SLOT(lev3Changed(const QString&)) ); + + setData(multi_sel, comp); +} + + +void AdjEntryPage::setData(bool multi_sel, const Comparison &comp) +{ + if (multi_sel) { + lev1Field->setEnabled(false); + lev2Field->setEnabled(false); + lev3Field->setEnabled(false); + } + else { + lev1Field->setText (comp.l1()); + lev2Field->setText (comp.l2()); + lev3Field->setText (comp.l3()); + } + setModified(false); +} + + +void AdjEntryPage::lev1Changed(const QString& s) +{ + setModified(true); + comparisons.setL1 (s); +} + + +void AdjEntryPage::lev2Changed(const QString& s) +{ + setModified(true); + comparisons.setL2 (s); +} + + +void AdjEntryPage::lev3Changed(const QString& s) +{ + setModified(true); + comparisons.setL3 (s); +} + + +bool AdjEntryPage::isModified() +{ + return modified; +} + + +void AdjEntryPage::setEnabled(int enable) +{ + bool ena = enable == EntryDlg::EnableAll; + + lev1Field->setEnabled (ena); + lev2Field->setEnabled (ena); + lev3Field->setEnabled (ena); +} + + +void AdjEntryPage::setModified(bool mod) +{ + modified = mod; + if (mod) + emit sigModified(); +} + +#include "AdjEntryPage.moc" diff --git a/kvoctrain/kvoctrain/entry-dialogs/AdjEntryPage.h b/kvoctrain/kvoctrain/entry-dialogs/AdjEntryPage.h new file mode 100644 index 00000000..095e22d7 --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/AdjEntryPage.h @@ -0,0 +1,63 @@ +/*************************************************************************** + + dialog page for adjectives (comparison) + + ----------------------------------------------------------------------- + + begin : Sat Dec 4 18:09:29 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef AdjEntryPage_included +#define AdjEntryPage_included + +#include "AdjEntryPageForm.h" + +#include <grammarmanager.h> + +class EntryDlg; + +class AdjEntryPage : public AdjEntryPageForm +{ + Q_OBJECT + +public: + AdjEntryPage(EntryDlg *_dlgbook, bool multi_sel, const Comparison &comp, QWidget *parent = NULL, const char *name = NULL); + + void setData (bool multi_sel, const Comparison &comp); + + Comparison getComparison() const { return comparisons; } + + bool isModified(); + void setModified(bool mod = true); + void setEnabled(int enable_type); + +signals: + void sigModified(); + +protected slots: + void lev1Changed(const QString&); + void lev2Changed(const QString&); + void lev3Changed(const QString&); + +protected: + Comparison comparisons; + bool modified; + EntryDlg *dlgbook; +}; +#endif // AdjEntryPage_included diff --git a/kvoctrain/kvoctrain/entry-dialogs/AdjEntryPageForm.ui b/kvoctrain/kvoctrain/entry-dialogs/AdjEntryPageForm.ui new file mode 100644 index 00000000..a2213edb --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/AdjEntryPageForm.ui @@ -0,0 +1,146 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>AdjEntryPageForm</class> +<widget class="QWidget"> + <property name="name"> + <cstring>AdjEntryPageForm</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>576</width> + <height>129</height> + </rect> + </property> + <property name="caption"> + <string>-</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox1</cstring> + </property> + <property name="title"> + <string>Comparison of Adjectives</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>lev1Label</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Level &1:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>lev1Field</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>lev2Label</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Level &2:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>lev2Field</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>lev3Label</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Level &3:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>lev3Field</cstring> + </property> + </widget> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>lev1Field</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>lev2Field</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>lev3Field</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </grid> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kvoctrain/kvoctrain/entry-dialogs/AuxInfoEntryPage.cpp b/kvoctrain/kvoctrain/entry-dialogs/AuxInfoEntryPage.cpp new file mode 100644 index 00000000..b7c1837e --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/AuxInfoEntryPage.cpp @@ -0,0 +1,192 @@ +/*************************************************************************** + + edit "additional" properties + + ----------------------------------------------------------------------- + + begin : Thu Nov 25 17:29:44 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <qmultilineedit.h> + +#include "AuxInfoEntryPage.h" +#include "EntryDlg.h" + +#include <langset.h> + +#include <LineList.h> + +AuxInfoEntryPage::AuxInfoEntryPage +( + EntryDlg *_dlgbook, + bool multi_sel, + QString syno, + QString anto, + QString exam, + QString rem, + QString para, + QWidget *parent, + const char *name +) + : AuxInfoEntryPageForm( parent, name ), dlgbook(_dlgbook) + +{ + QFontMetrics fm (synonym_line->font()); + int sz = fm.lineSpacing(); + + synonym_line->setMaximumHeight(sz*3); + antonym_line->setMaximumHeight(sz*3); + para_line->setMaximumHeight(sz*3); + remark_line->setMaximumHeight(sz*3); + examp_line->setMaximumHeight(sz*3); + + connect( para_line, SIGNAL(textChanged()), SLOT(slotParaSelected()) ); + connect( remark_line, SIGNAL(textChanged()), SLOT(slotRemarkSelected()) ); + connect( examp_line, SIGNAL(textChanged()), SLOT(slotExampSelected()) ); + connect( antonym_line, SIGNAL(textChanged()), SLOT(slotAntonymSelected()) ); + connect( synonym_line, SIGNAL(textChanged()), SLOT(slotSynonymSelected()) ); + + setData(multi_sel, syno, anto, exam, rem, para); +} + + +void AuxInfoEntryPage::setData(bool multi_sel, QString syno, QString anto, QString example, QString remark, QString para) +{ + synonym_line->setText(syno); + antonym_line->setText(anto); + examp_line->setText(example); + remark_line->setText(remark); + para_line->setText(para); + + if (multi_sel) { + synonym_line ->setEnabled(false); + antonym_line ->setEnabled(false); + remark_line ->setEnabled(false); + examp_line ->setEnabled(false); + para_line ->setEnabled(false); + } + + setModified(false); +} + + +void AuxInfoEntryPage::slotSynonymSelected() +{ + setModified(true); + synonym = synonym_line->text(); +} + + +void AuxInfoEntryPage::slotAntonymSelected() +{ + setModified(true); + antonym = antonym_line->text(); +} + + +void AuxInfoEntryPage::slotRemarkSelected () +{ + setModified(true); + remark = remark_line->text(); +} + + +void AuxInfoEntryPage::slotExampSelected () +{ + setModified(true); + example = examp_line->text(); +} + + +void AuxInfoEntryPage::slotParaSelected () +{ + setModified(true); + paraphrase = para_line->text(); +} + + +QString AuxInfoEntryPage::getSynonym () +{ + normalize(synonym); + return synonym; +} + + +QString AuxInfoEntryPage::getAntonym () +{ + normalize(antonym); + return antonym; +} + + +QString AuxInfoEntryPage::getExample () +{ + normalize(example); + return example; +} + + +QString AuxInfoEntryPage::getRemark () +{ + normalize(remark); + return remark; +} + + +QString AuxInfoEntryPage::getParaphrase () +{ + normalize(paraphrase); + return paraphrase; +} + + +void AuxInfoEntryPage::normalize (QString &str) +{ + LineList ll (str); + ll.normalizeWS(); + str = ll.allLines(); +} + + +bool AuxInfoEntryPage::isModified() +{ + return modified; +} + + +void AuxInfoEntryPage::setEnabled(int enable) +{ + bool ena = enable == EntryDlg::EnableAll; + + synonym_line->setEnabled (ena); + antonym_line->setEnabled (ena); + para_line->setEnabled (ena); + remark_line->setEnabled (ena); + examp_line->setEnabled (ena); +} + + +void AuxInfoEntryPage::setModified(bool mod) +{ + modified = mod; + if (mod) + emit sigModified(); +} + +#include "AuxInfoEntryPage.moc" diff --git a/kvoctrain/kvoctrain/entry-dialogs/AuxInfoEntryPage.h b/kvoctrain/kvoctrain/entry-dialogs/AuxInfoEntryPage.h new file mode 100644 index 00000000..c9e78bf3 --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/AuxInfoEntryPage.h @@ -0,0 +1,86 @@ +/*************************************************************************** + + edit "additional" properties + + ----------------------------------------------------------------------- + + begin : Thu Nov 25 17:29:44 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef AuxInfoEntryPage_included +#define AuxInfoEntryPage_included + +#include "AuxInfoEntryPageForm.h" + +class EntryDlg; + +class AuxInfoEntryPage : public AuxInfoEntryPageForm +{ + Q_OBJECT + +public: + AuxInfoEntryPage + ( + EntryDlg *dlgbook, + bool multi_sel, + QString syno, + QString anto, + QString example, + QString remark, + QString para, + QWidget *parent = 0, + const char *name = 0 + ); + + void setData(bool multi_sel, QString syno, QString anto, QString example, QString remark, QString para); + + QString getSynonym (); + QString getAntonym (); + QString getExample (); + QString getRemark (); + QString getParaphrase(); + + bool isModified(); + void setModified(bool mod = true); + void setEnabled(int enable_type); + +signals: + void sigModified(); + +protected: + void normalize(QString &str); + +protected slots: + void slotAntonymSelected(); + void slotSynonymSelected(); + void slotExampSelected(); + void slotRemarkSelected(); + void slotParaSelected(); + +protected: + QString synonym; + QString antonym; + QString example; + QString remark; + QString paraphrase; + bool modified; + EntryDlg *dlgbook; +}; + +#endif // AuxInfoEntryPage_included diff --git a/kvoctrain/kvoctrain/entry-dialogs/AuxInfoEntryPageForm.ui b/kvoctrain/kvoctrain/entry-dialogs/AuxInfoEntryPageForm.ui new file mode 100644 index 00000000..632973bc --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/AuxInfoEntryPageForm.ui @@ -0,0 +1,229 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>AuxInfoEntryPageForm</class> +<widget class="QWidget"> + <property name="name"> + <cstring>AuxInfoEntryPageForm</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>576</width> + <height>494</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="caption"> + <string>-</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>GroupBox1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Additional Properties</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QMultiLineEdit" row="2" column="1"> + <property name="name"> + <cstring>examp_line</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>80</height> + </size> + </property> + </widget> + <widget class="QMultiLineEdit" row="3" column="1"> + <property name="name"> + <cstring>remark_line</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>80</height> + </size> + </property> + </widget> + <widget class="QMultiLineEdit" row="4" column="1"> + <property name="name"> + <cstring>para_line</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>80</height> + </size> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>synonym_label</cstring> + </property> + <property name="text"> + <string>S&ynonyms:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>synonym_line</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>antonym_label</cstring> + </property> + <property name="text"> + <string>Ant&onyms:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>antonym_line</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>examp_label</cstring> + </property> + <property name="text"> + <string>E&xample:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>examp_line</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>remark_label</cstring> + </property> + <property name="text"> + <string>&Remark:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>remark_line</cstring> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>para_label</cstring> + </property> + <property name="text"> + <string>&Paraphrase:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>para_line</cstring> + </property> + </widget> + <widget class="QMultiLineEdit" row="0" column="1"> + <property name="name"> + <cstring>synonym_line</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>80</height> + </size> + </property> + <property name="cursor"> + <cursor>0</cursor> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QMultiLineEdit" row="1" column="1"> + <property name="name"> + <cstring>antonym_line</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>80</height> + </size> + </property> + </widget> + </grid> + </widget> + </grid> +</widget> +<tabstops> + <tabstop>synonym_line</tabstop> + <tabstop>antonym_line</tabstop> + <tabstop>examp_line</tabstop> + <tabstop>remark_line</tabstop> + <tabstop>para_line</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kvoctrain/kvoctrain/entry-dialogs/CommonEntryPage.cpp b/kvoctrain/kvoctrain/entry-dialogs/CommonEntryPage.cpp new file mode 100644 index 00000000..9f5bc8b6 --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/CommonEntryPage.cpp @@ -0,0 +1,444 @@ +/*************************************************************************** + + edit common properties + + ----------------------------------------------------------------------- + + begin : Mon Jun 28 21:02:16 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "CommonEntryPage.h" +#include "EntryDlg.h" + +#include <qlineedit.h> +#include <qlabel.h> +#include <qlistbox.h> +#include <qcombobox.h> +#include <qcheckbox.h> +#include <qgroupbox.h> + +#include <kapplication.h> +#include <kdebug.h> +#include <klocale.h> +#include <kiconloader.h> +#include <kdialogbase.h> + +#include <QueryManager.h> +#include <langset.h> + +#include "DocPropDlg.h" +#include "blockall.h" +#include "PhoneticEntryPage.h" + + +CommonEntryPage::CommonEntryPage +( + EntryDlg *_dlgbook, + kvoctrainDoc *_doc, + bool multi_sel, + QString expr, + int less, + QComboBox *lessbox, + QString lang, + QString act_type, + QString pron, + QString act_usage, + QString label, + QueryManager &_querymanager, + bool active, + const QFont& _ipafont, + QWidget *parent, + const char *name +) + : + CommonEntryPageForm( parent, name ), + pronunce(pron), + expression(expr), + usageCollection (act_usage), + lesson(less), + type (act_type), + dlgbook(_dlgbook), + doc(_doc), + querymanager(_querymanager), + entry_active(active), + ipafont(_ipafont) +{ + + connect( b_usageDlg, SIGNAL(clicked()), SLOT(invokeUsageDlg()) ); + connect( b_LessDlg, SIGNAL(clicked()), SLOT(invokeLessDlg()) ); + connect( b_pronDlg, SIGNAL(clicked()), SLOT(invokePronDlg()) ); + connect( b_TypeDlg, SIGNAL(clicked()), SLOT(invokeTypeDlg()) ); + connect( usage_box, SIGNAL(selectionChanged()), SLOT(slotUsageChanged()) ); + connect( lesson_box, SIGNAL(activated(int)), SLOT(slotLessonSelected(int)) ); + connect( subtype_box, SIGNAL(activated(int)), SLOT(slotSubTypeSelected(int)) ); + connect( type_box, SIGNAL(activated(int)), SLOT(slotTypeSelected(int)) ); + connect( c_active, SIGNAL(toggled(bool)), SLOT(slotActiveChanged(bool)) ); + + connect( pronunce_line, SIGNAL(textChanged(const QString&)), SLOT(slotPronunceSelected(const QString&)) ); + connect( expr_line, SIGNAL(textChanged(const QString&)), SLOT(slotExprSelected(const QString&)) ); + + usage_label->setTitle(i18n("Usage (area) of an Expression", "&Usage Labels")); + pronunce_line->setFont(ipafont); + + lesson_box->setValidator (new BlockAllValidator() ); + type_box->setValidator (new BlockAllValidator() ); + subtype_box->setValidator (new BlockAllValidator() ); + + QPixmap list_pm = SmallIcon("view_text"); + b_LessDlg->setPixmap(list_pm); + b_TypeDlg->setPixmap(list_pm); + b_usageDlg->setPixmap(list_pm); + + QPixmap pron_pm = SmallIcon("view_icon"); + b_pronDlg->setPixmap(pron_pm); + + setData(multi_sel, expr, less, lessbox, lang, type, pronunce, act_usage, label, querymanager, active); +} + + +void CommonEntryPage::setData( + bool multi_sel, + QString expr, + int less, + QComboBox *lessBox, + QString /*lang*/, + QString type, + QString pronunce, + QString usage, + QString /*label*/, + QueryManager &/*querymanager*/, + bool active) +{ + setLessonBox (lessBox, less); + setUsageBox (usage); + + //expr_label->setText( label ); + expr_line->setText(expr); + + setTypeBox(type); + pronunce_line->setText(pronunce); + c_active->setChecked(active); + + int start = -1; + int i = 0; + while (start < 0 && i < (int) all_types.size()) { + if (all_types [i].shortStr() == QueryManager::getMainType(type)) + start = i; + i++; + } + int offset = -1; + while (offset < 0 && i < (int) all_types.size()) { + if (all_types [i].shortStr() == type) + offset = i - start; + i++; + } + if (offset >= 0) { + slotSubTypeSelected(offset); + subtype_box->setCurrentItem(offset); + } + + if (multi_sel) { + expr_line->setEnabled (false); + pronunce_line->setEnabled (false); + expr_line->setText (""); + pronunce_line->setText (""); + lesson_box->clearEdit(); + type_box->clearEdit(); + subtype_box->clearEdit(); + } + + lesson_dirty = false; + type_dirty = false; + usage_dirty = false; + active_dirty = false; + + setModified(false); +} + + +void CommonEntryPage::setTypeBox(const QString &act_type) +{ + all_types = QueryManager::getRelation(false); + all_maintypes = QueryManager::getRelation(true); + + QString s = QueryManager::getMainType(act_type)+QM_TYPE_DIV; + int curr_type = 0; + type_box->clear(); + type_box->insertItem (i18n("<none>")); + for (int i = 0; i < (int) all_maintypes.size(); i++) { + type_box->insertItem (all_maintypes[i].longStr()); + if (s == all_maintypes[i].shortStr()+QM_TYPE_DIV) + curr_type = i+1; + } + type_box->setCurrentItem(curr_type); + slotTypeSelected(curr_type); +} + + +void CommonEntryPage::setLessonBox(QComboBox *lessbox, int lesson) +{ + lesson_box->clear(); + for (int i = 0; i < lessbox->count(); i++) + lesson_box->insertItem (lessbox->text(i)); + if (lesson >= lesson_box->count() ) + lesson = 0; + lesson_box->setCurrentItem(lesson); +} + + +void CommonEntryPage::setUsageBox(const QString & act_usage) +{ + usages = UsageManager::getRelation(); + usage_box->clear(); + for (int i = 0; i < (int) usages.size(); i++) { + usage_box->insertItem (usages[i].longStr()); + if (UsageManager::contains(QString(usages[i].identStr()), act_usage)) { + usage_box->setSelected (i, true); + } + } + slotUsageChanged(); +} + + +void CommonEntryPage::slotUsageChanged() +{ + setModified(true); + usageCollection = ""; + usage_dirty = true; + QString s; + for (int i = 0; i < (int) usage_box->count(); i++) { + if (usage_box->isSelected(i)) { + + if (!usageCollection.isEmpty() ) + usageCollection += UL_USAGE_DIV; + usageCollection += usages[i].identStr(); + + if (!s.isEmpty() ) + s += ", "; + s += usages[i].shortStr(); + } + } + usage_line->setText (s); +} + + +void CommonEntryPage::slotLessonSelected (int l) +{ + setModified(true); + lesson = l; + lesson_dirty = true; +} + + +void CommonEntryPage::slotActiveChanged(bool state) +{ + setModified(true); + entry_active = state; + active_dirty = true; +} + + +void CommonEntryPage::slotExprSelected (const QString& s) +{ + setModified(true); + expression = s; +} + + +void CommonEntryPage::slotPronunceSelected (const QString& s) +{ + setModified(true); + pronunce = s; +} + + +void CommonEntryPage::slotSubTypeSelected(int i) +{ + setModified(true); + if (i < (int) current_subtypes.size()) { + type = current_subtypes[i]; + emit typeSelected(type); + type_dirty = true; + } +} + + +void CommonEntryPage::slotTypeSelected(int idx) +{ + setModified(true); + subtype_box->clear(); + current_subtypes.clear(); + bool first = true; + + if (idx == 0) { // 0 == none ! + type = ""; + emit typeSelected(type); + } + else { + type = all_maintypes[idx-1].shortStr(); + emit typeSelected(type); + QString main_patt = all_maintypes[idx-1].shortStr()+QM_TYPE_DIV; + int sub_idx; + if ( idx-1 < (int) all_types.size() ){ + for (sub_idx = 0; sub_idx < (int) all_types.size(); sub_idx++) { + if (all_types[sub_idx].shortStr().left(main_patt.length()) == main_patt) { + if (first) { + subtype_box->insertItem (i18n("<none>")); + current_subtypes.push_back(all_maintypes[idx-1].shortStr()); + first = false; + } + QString s = all_types[sub_idx].longStr(); + subtype_box->insertItem (s.stripWhiteSpace()); + current_subtypes.push_back(all_types[sub_idx].shortStr()); + } + } + } + } + type_dirty = true; + + subtype_box->setEnabled(!first); + subtype_label->setEnabled(!first); +} + + +void CommonEntryPage::phoneticSelected(wchar_t wc) +{ + setModified(true); + pronunce += QChar(wc); + pronunce_line->setText(pronunce); +} + + +void CommonEntryPage::invokePronDlg() +{ + //if (phoneticDlg == 0) { + PhoneticEntryPage * phoneticDlg = new PhoneticEntryPage (ipafont, this); + connect (phoneticDlg, SIGNAL(charSelected(wchar_t)), SLOT(phoneticSelected(wchar_t)) ); + phoneticDlg->show(); + //} + //else + //phoneticDlg->show(); +} + + +void CommonEntryPage::invokeUsageDlg() +{ + vector<int> usageIndex; + vector<QString> new_usageStr; + + int old_usages = (int) doc->getUsageDescr().size(); + + KDialogBase usageOpt(KDialogBase::Swallow, i18n("usage (area) of an expression", "Edit User-Defined Usage Labels"), + KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, dlgbook, "usage", true); + + UsageOptPage *usageOptPage = new UsageOptPage (doc->getUsageDescr(), doc, this, "name"); + usageOpt.setMainWidget(usageOptPage); + + if (usageOpt.exec() == QDialog::Accepted) + { + usageOptPage->getUsageLabels(new_usageStr, usageIndex); + UsageOptPage::cleanUnused(doc, usageIndex, old_usages); + UsageManager::setUsageNames (new_usageStr); + setUsageBox(usageCollection); + doc->setUsageDescr (new_usageStr); + doc->setModified(); + } +} + + +void CommonEntryPage::invokeLessDlg() +{ + vector<int> lessonIndex; + vector<QString> new_lessonStr; + + int old_lessons = (int) lesson_box->count(); + KDialogBase lessOpt(KDialogBase::Swallow, i18n("Edit Lesson Names"), + KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, dlgbook, "lesson", true); + + LessOptPage *lessOptPage = new LessOptPage (lesson_box, doc, this, "name"); + lessOpt.setMainWidget(lessOptPage); + + vector<int> lessoninquery = doc->getLessonsInQuery(); + if (lessOpt.exec() == QDialog::Accepted) + { + lessOptPage->getLesson(lesson_box, lessonIndex); + LessOptPage::cleanUnused(doc, lesson_box, lessonIndex, old_lessons, lessoninquery); + for (int i = 1; i < lesson_box->count(); i++) + new_lessonStr.push_back(lesson_box->text(i)); + doc->setLessonDescr (new_lessonStr); + doc->setLessonsInQuery(lessoninquery); + querymanager.setLessonItems(lessoninquery); + doc->setModified(); + } +} + + +void CommonEntryPage::invokeTypeDlg() +{ + vector<int> typeIndex; + vector<QString> new_typeStr; + + int old_types = (int) doc->getTypeDescr().size(); + KDialogBase typeOpt(KDialogBase::Swallow, i18n("Edit User Defined Types"), + KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, dlgbook, "types", true); + + TypeOptPage *typeOptPage = new TypeOptPage (doc->getTypeDescr(), doc, this, "name"); + typeOpt.setMainWidget(typeOptPage); + + if (typeOpt.exec() == QDialog::Accepted) + { + typeOptPage->getTypeNames(new_typeStr, typeIndex); + TypeOptPage::cleanUnused(doc, typeIndex, old_types); + QueryManager::setTypeNames (new_typeStr); + setTypeBox(type); + doc->setTypeDescr (new_typeStr); + doc->setModified(); + } +} + + +bool CommonEntryPage::isModified() +{ + return modified; +} + + +void CommonEntryPage::setEnabled(int enable) +{ + bool ena = enable == EntryDlg::EnableAll; + + usage_box->setEnabled(ena); + subtype_box->setEnabled(ena); + type_box->setEnabled(ena); + pronunce_line->setEnabled(ena); + expr_line->setEnabled(ena); + + lesson_box->setEnabled(ena || enable == EntryDlg::EnableOnlyCommon); + c_active->setEnabled(ena || enable == EntryDlg::EnableOnlyCommon); +} + + +void CommonEntryPage::setModified(bool mod) +{ + modified = mod; + if (mod) + emit sigModified(); +} + +#include "CommonEntryPage.moc" diff --git a/kvoctrain/kvoctrain/entry-dialogs/CommonEntryPage.h b/kvoctrain/kvoctrain/entry-dialogs/CommonEntryPage.h new file mode 100644 index 00000000..71bbd84a --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/CommonEntryPage.h @@ -0,0 +1,140 @@ +/*************************************************************************** + + edit common properties + + ----------------------------------------------------------------------- + + begin : Mon Jun 28 21:02:16 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef CommonEntryPage_included +#define CommonEntryPage_included + +#include "CommonEntryPageForm.h" + +#include <QueryManager.h> +#include <UsageManager.h> + +class PhoneticEntryPage; +class EntryDlg; + +class CommonEntryPage : public CommonEntryPageForm +{ + Q_OBJECT + +public: + CommonEntryPage + ( + EntryDlg *dlgbook, + kvoctrainDoc *doc, + bool multi_sel, + QString expr, + int less, + QComboBox *lessBox, + QString lang, + QString type, + QString pronunce, + QString usage, + QString label, + QueryManager &querymanager, + bool active, + const QFont& ipafont, + QWidget* parent = NULL, + const char* name = NULL + ); + + void setData( + bool multi_sel, + QString expr, + int less, + QComboBox *lessBox, + QString lang, + QString type, + QString pronunce, + QString usage, + QString label, + QueryManager &querymanager, + bool active); + + bool isDirty() const; + bool lessonDirty () const { return lesson_dirty; } + bool activeDirty () const { return active_dirty; } + bool typeDirty () const { return type_dirty; } + bool usageDirty () const { return usage_dirty; } + + int getLesson () const { return lesson; } + QString getType () const { return type; } + QString getExpr () const { return expression; } + QString getPronunce () const { return pronunce; } + QString getUsageLabel() const { return usageCollection; } + bool getActive () const { return entry_active; } + + bool isModified(); + void setModified(bool mod = true); + void setEnabled(int enable_type); + +signals: + void typeSelected(const QString &); + +protected: + void setTypeBox(const QString &act_type); + void setLessonBox(QComboBox *lessbox, int lesson); + void setUsageBox(const QString & act_type); + +protected slots: + void slotLessonSelected(int); + void slotExprSelected(const QString&); + void slotTypeSelected(int); + void slotSubTypeSelected(int); + void slotPronunceSelected (const QString&); + void slotUsageChanged(); + void slotActiveChanged(bool state); + void phoneticSelected(wchar_t); + void invokeLessDlg(); + void invokeTypeDlg(); + void invokePronDlg(); + void invokeUsageDlg(); + +signals: + void sigModified(); + +protected: + QString pronunce; + QString expression; + QString usageCollection; + int lesson; + QString type; + EntryDlg *dlgbook; + bool lesson_dirty; + bool type_dirty; + kvoctrainDoc *doc; + QueryManager &querymanager; + bool entry_active; + bool active_dirty; + bool usage_dirty; + + vector<TypeRelation> all_maintypes; + vector<TypeRelation> all_types; + vector<UsageRelation> usages; + vector<QString> current_subtypes; + + QFont ipafont; + bool modified; +}; +#endif // CommonEntryPage_included diff --git a/kvoctrain/kvoctrain/entry-dialogs/CommonEntryPageForm.ui b/kvoctrain/kvoctrain/entry-dialogs/CommonEntryPageForm.ui new file mode 100644 index 00000000..5e67f8a4 --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/CommonEntryPageForm.ui @@ -0,0 +1,479 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>CommonEntryPageForm</class> +<widget class="QWidget"> + <property name="name"> + <cstring>CommonEntryPageForm</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>516</width> + <height>364</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="caption"> + <string>-</string> + </property> + <property name="toolTip" stdset="0"> + <string>Invokes lesson input dialog</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>asdf</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Common Properties</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QFrame"> + <property name="name"> + <cstring>Frame4</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>expr_line</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>pronunce_line</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QComboBox" row="1" column="1"> + <property name="name"> + <cstring>lesson_box</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>expr_label</cstring> + </property> + <property name="text"> + <string>&Expression:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>expr_line</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>pronunce_label</cstring> + </property> + <property name="text"> + <string>&Pronunciation:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>pronunce_line</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>lesson_label</cstring> + </property> + <property name="text"> + <string>&Lesson:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>lesson_box</cstring> + </property> + </widget> + <widget class="QPushButton" row="1" column="2"> + <property name="name"> + <cstring>b_LessDlg</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + <property name="text"> + <string>-</string> + </property> + <property name="toolTip" stdset="0"> + <string>Invokes input dialog for lessons</string> + </property> + </widget> + <widget class="QPushButton" row="2" column="2"> + <property name="name"> + <cstring>b_pronDlg</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + <property name="text"> + <string>-</string> + </property> + <property name="toolTip" stdset="0"> + <string>Invokes dialog page with characters from phonetic alphabet</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>type_label</cstring> + </property> + <property name="title"> + <string>T&ype</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QComboBox"> + <property name="name"> + <cstring>type_box</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Minimum</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>subtype_label</cstring> + </property> + <property name="text"> + <string>&Subtype:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>subtype_box</cstring> + </property> + </widget> + <widget class="QComboBox"> + <property name="name"> + <cstring>subtype_box</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>b_TypeDlg</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + <property name="text"> + <string>-</string> + </property> + <property name="toolTip" stdset="0"> + <string>Invokes input dialog for word types</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>usage_label</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>-</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QPushButton" row="0" column="2"> + <property name="name"> + <cstring>b_usageDlg</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>30</width> + <height>24</height> + </size> + </property> + <property name="text"> + <string>-</string> + </property> + <property name="toolTip" stdset="0"> + <string>Invokes input dialog for usage labels</string> + </property> + </widget> + <spacer row="1" column="2"> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Preferred</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QListBox" row="0" column="0" rowspan="2" colspan="1"> + <property name="name"> + <cstring>usage_box</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>90</height> + </size> + </property> + <property name="selectionMode"> + <enum>Multi</enum> + </property> + </widget> + <widget class="QLabel" row="0" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>usage_line</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>80</height> + </size> + </property> + <property name="frameShape"> + <enum>WinPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="alignment"> + <set>WordBreak|AlignTop|AlignLeft</set> + </property> + <property name="vAlign" stdset="0"> + </property> + <property name="wordwrap" stdset="0"> + </property> + </widget> + </grid> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>c_active</cstring> + </property> + <property name="text"> + <string>Acti&ve</string> + </property> + </widget> + </vbox> + </widget> + </vbox> +</widget> +<tabstops> + <tabstop>expr_line</tabstop> + <tabstop>lesson_box</tabstop> + <tabstop>b_LessDlg</tabstop> + <tabstop>pronunce_line</tabstop> + <tabstop>b_pronDlg</tabstop> + <tabstop>type_box</tabstop> + <tabstop>subtype_box</tabstop> + <tabstop>b_TypeDlg</tabstop> + <tabstop>usage_box</tabstop> + <tabstop>b_usageDlg</tabstop> + <tabstop>c_active</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kvoctrain/kvoctrain/entry-dialogs/EntryDlg.cpp b/kvoctrain/kvoctrain/entry-dialogs/EntryDlg.cpp new file mode 100644 index 00000000..2d60ddb1 --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/EntryDlg.cpp @@ -0,0 +1,467 @@ +/*************************************************************************** + + entry dialog for table cell contents + + ----------------------------------------------------------------------- + + begin : Thu Mar 11 20:50:53 MET 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + *************************************************************************** + + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "EntryDlg.h" + +#include <qlayout.h> +#include <qlineedit.h> + +#include <kmainwindow.h> +#include <kapplication.h> +#include <kwinmodule.h> + +#include <langset.h> +#include <klocale.h> + +EntryDlg::EntryDlg( + KMainWindow *main, + kvoctrainDoc *doc, + bool multi_sel, + bool origin, + grade_t f_grd, + grade_t t_grd, + count_t f_qcount, + count_t t_qcount, + count_t f_bcount, + count_t t_bcount, + time_t f_qdate, + time_t t_qdate, + QString f_faux_ami, + QString t_faux_ami, + QString expr, + int lesson, + QComboBox *lessonbox, + QString lang, + LangSet &langset, + QString rem, + QString type, + QString pronunce, + QString synonym, + QString antonym, + QString example, + QString usagelabel, + QString paraphrase, + const Conjugation &con_prefix, + const Conjugation &conjugations, + const Article &/*article*/, + const Comparison &comp, + const MultipleChoice &mc, + QueryManager &querymanager, + const QString &title, + bool active, + const QFont& ipafont, + QWidget *parent, + const char *name, + bool modal) + : + KDialogBase(Tabbed, title, User1|User2|User3|Apply|Close, Apply, parent, name, modal, false, + KGuiItem(i18n("&Reset")), + KGuiItem(QString::null, "view_left_right"), + KGuiItem(QString::null, "view_top_bottom")) + +{ + mainwin = main; + docked = false; + edit_row = -1; + edit_col = -1; + from_page = 0; + to_page = 0; + + QString s; + if (langset.findLongId(lang).isEmpty() ) + s = lang; + else + s = langset.findLongId(lang); + + QFrame *page; + QVBoxLayout *topLayout; + + if (origin) + { + page = addPage( i18n("Co&mmon") ); + topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() ); + comm_page = new CommonEntryPage (this, doc, multi_sel, expr, lesson, lessonbox, + lang, type, pronunce, usagelabel, + i18n("Original &expression in %1:").arg(s), querymanager, active, + ipafont, page, name); + topLayout->addWidget(comm_page); + + page = addPage( i18n("A&dditional") ); + topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() ); + aux_page = new AuxInfoEntryPage (this, multi_sel, synonym, antonym, example, rem, paraphrase, page, name); + topLayout->addWidget(aux_page); + + page = addPage( i18n("&Multiple Choice") ); + topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() ); + mc_page = new MCEntryPage (this, multi_sel, mc, page, "MultipleChoice"); + topLayout->addWidget(mc_page); + + page = addPage( i18n("Con&jugation") ); + topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() ); + tense_page = new TenseEntryPage (this, multi_sel, con_prefix, conjugations, page, "Conjugation"); + topLayout->addWidget(tense_page); + + page = addPage( i18n("Compar&ison") ); + topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() ); + adj_page = new AdjEntryPage (this, multi_sel, comp, page, "Comparison"); + topLayout->addWidget(adj_page); + } + else + { + page = addPage( i18n("Co&mmon") ); + topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() ); + comm_page = new CommonEntryPage (this, doc, multi_sel, expr, lesson, lessonbox, + lang, type, pronunce, usagelabel, + i18n("Translated &expression in %1:").arg(s), querymanager, active, + ipafont, page, name); + topLayout->addWidget(comm_page); + + page = addPage( i18n("A&dditional") ); + topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() ); + aux_page = new AuxInfoEntryPage (this, multi_sel, synonym, antonym, example, rem, paraphrase, page, name); + topLayout->addWidget(aux_page); + + page = addPage( i18n("&Multiple Choice") ); + topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() ); + mc_page = new MCEntryPage (this, multi_sel, mc, page, "MultipleChoice"); + topLayout->addWidget(mc_page); + + page = addPage( i18n("Con&jugation") ); + topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() ); + tense_page = new TenseEntryPage (this, multi_sel, con_prefix, conjugations, page, "Conjugation"); + topLayout->addWidget(tense_page); + + page = addPage( i18n("Compar&ison") ); + topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() ); + adj_page = new AdjEntryPage (this, multi_sel, comp, page, "Comparison"); + topLayout->addWidget(adj_page); + } + + page = addPage( i18n("&From Original") ); + topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() ); + from_page = new FromToEntryPage (this, multi_sel, f_grd, f_qdate, f_qcount, f_bcount, + f_faux_ami, + i18n("Properties From Original"), page, name); + topLayout->addWidget(from_page); + + page = addPage( i18n("&To Original") ); + topLayout = new QVBoxLayout( page, 0, KDialog::spacingHint() ); + to_page = new FromToEntryPage (this, multi_sel, t_grd, t_qdate, t_qcount, t_bcount, + t_faux_ami, + i18n("Properties to Original"), page, name); + topLayout->addWidget(to_page); + + updatePages (type); + + connect(comm_page, SIGNAL(typeSelected(const QString&)), SLOT(updatePages(const QString&)) ); + + connect( this, SIGNAL(user1Clicked()), this, SLOT(slotUndo()) ); + connect( this, SIGNAL(applyClicked()), this, SLOT(slotApply()) ); + connect( this, SIGNAL(user2Clicked()), this, SLOT(slotDockVertical()) ); + connect( this, SIGNAL(user3Clicked()), this, SLOT(slotDockHorizontal()) ); + + connect (comm_page, SIGNAL(sigModified()), this, SLOT(slotDisplayModified() )); + connect (aux_page, SIGNAL(sigModified()), this, SLOT(slotDisplayModified() )); + connect (adj_page, SIGNAL(sigModified()), this, SLOT(slotDisplayModified() )); + connect (mc_page, SIGNAL(sigModified()), this, SLOT(slotDisplayModified() )); + connect (tense_page, SIGNAL(sigModified()), this, SLOT(slotDisplayModified() )); + + if (from_page != 0) + connect (from_page, SIGNAL(sigModified()), this, SLOT(slotDisplayModified() )); + if (to_page != 0) + connect (to_page, SIGNAL(sigModified()), this, SLOT(slotDisplayModified() )); + + enableButtonApply(false); + enableButton(User1, false); + comm_page->expr_line->setFocus(); +} + + +void EntryDlg::setData( + kvoctrainDoc */*doc*/, + bool multi_sel, + bool origin, + grade_t f_grd, + grade_t t_grd, + count_t f_qcount, + count_t t_qcount, + count_t f_bcount, + count_t t_bcount, + time_t f_qdate, + time_t t_qdate, + QString f_faux_ami, + QString t_faux_ami, + QString expr, + int lesson, + QComboBox *lessonbox, + QString lang, + LangSet &langset, + QString rem, + QString type, + QString pronunce, + QString synonym, + QString antonym, + QString example, + QString usagelabel, + QString paraphrase, + const Conjugation &/*con_prefix*/, + const Conjugation &conjugations, + const Article &/*article*/, + const Comparison &comp, + const MultipleChoice &mc, + QueryManager &querymanager, + const QString &title, + bool active) +{ + setCaption (kapp->makeStdCaption(title)); + + QString s; + if (langset.findLongId(lang).isEmpty() ) + s = lang; + else + s = langset.findLongId(lang); + + if (origin) + comm_page->setData(multi_sel, expr, lesson, lessonbox, lang, type, pronunce, usagelabel, + i18n("Original &expression in %1:").arg(s), querymanager, active); + else + comm_page->setData(multi_sel, expr, lesson, lessonbox, lang, type, pronunce, usagelabel, + i18n("Translated &expression in %1:").arg(s), querymanager, active); + + adj_page->setData(multi_sel, comp); + aux_page->setData(multi_sel, synonym, antonym, example, rem, paraphrase); + mc_page->setData(multi_sel, mc); + tense_page->setData(multi_sel, conjugations); + if (from_page != 0) + from_page->setData(multi_sel, f_grd, f_qdate, f_qcount, f_bcount, f_faux_ami, i18n("Properties From Original")); + if (to_page != 0) + to_page->setData(multi_sel, t_grd, t_qdate, t_qcount, t_bcount, t_faux_ami, i18n("Properties to Original")); + + setModified(false); + updatePages (type); +} + + +void EntryDlg::updatePages(const QString &type) +{ + QString main; + int pos; + if ((pos = type.find (QM_TYPE_DIV)) < 0) // only use main type + main = type; + else + main = type.left(pos); + + if (main == QM_VERB) { + tense_page->setEnabled(EntryDlg::EnableAll); + adj_page->setEnabled(EntryDlg::EnableNone); + } + else if (main == QM_ADJ) { + tense_page->setEnabled(EntryDlg::EnableNone); + adj_page->setEnabled(EntryDlg::EnableAll); + } + else { + tense_page->setEnabled(EntryDlg::EnableNone); + adj_page->setEnabled(EntryDlg::EnableNone); + } +} + + +void EntryDlg::setModified(bool mod) +{ + comm_page->setModified(mod); + aux_page->setModified(mod); + mc_page->setModified(mod); + tense_page->setModified(mod); + mc_page->setModified(mod); + adj_page->setModified(mod); + if (from_page != 0) + from_page->setModified(mod); + if (to_page != 0) + to_page->setModified(mod); + enableButtonApply(false); + enableButton(User1, false); +} + + +void EntryDlg::setEnabled(int enable) +{ + QString type = comm_page->getType(); + QString main; + int pos; + if ((pos = type.find (QM_TYPE_DIV)) < 0) // only use main type + main = type; + else + main = type.left(pos); + + if (enable == EnableOnlyOriginal) + { + comm_page->setEnabled(EnableAll); + aux_page->setEnabled(EnableAll); + mc_page->setEnabled(EnableAll); + tense_page->setEnabled(main == QM_VERB ? EnableAll : EnableNone); + mc_page->setEnabled(EnableAll); + adj_page->setEnabled(main == QM_ADJ ? EnableAll : EnableNone); + if (from_page != 0) + from_page->setEnabled(EnableNone); + if (to_page != 0) + to_page->setEnabled(EnableNone); + } + else + { + comm_page->setEnabled(enable); + aux_page->setEnabled(enable); + mc_page->setEnabled(enable); + tense_page->setEnabled(main == QM_VERB ? enable : EnableNone); + mc_page->setEnabled(enable); + adj_page->setEnabled(main == QM_ADJ ? enable : EnableNone); + if (from_page != 0) + from_page->setEnabled(enable); + if (to_page != 0) + to_page->setEnabled(enable); + } +} + + +void EntryDlg::slotApply() +{ + emit sigEditChoice(EditApply); +} + + +void EntryDlg::slotUndo() +{ + emit sigEditChoice(EditUndo); +} + + +bool EntryDlg::isModified() +{ + bool mod = comm_page->isModified() + || aux_page->isModified() + || tense_page->isModified() + || mc_page->isModified() + || adj_page->isModified(); + + if (from_page != 0) + mod |= from_page->isModified(); + + if (to_page != 0) + mod |= to_page->isModified(); + + return mod; +} + + +void EntryDlg::slotDisplayModified() +{ + enableButtonApply(true); + enableButton(User1, true); +} + + +void EntryDlg::setCell(int row, int col, const vector<QTableSelection>& sel) +{ + edit_row = row; + edit_col = col; + selections = sel; +} + + +void EntryDlg::getCell(int &row, int &col, vector<QTableSelection>& sel) const +{ + row = edit_row; + col = edit_col; + sel = selections; +} + + +void EntryDlg::slotDockVertical() +{ + if (!docked) { + oldMainPos = mainwin->pos(); + oldMainSize = mainwin->size(); + docked = true; + } + + KWinModule info; + QRect rect = info.workArea(); + + int diff_x = frameGeometry().width()-width(); + int diff_y = frameGeometry().height()-height(); + resize(minimumWidth(), rect.height()-diff_y); + mainwin->resize(rect.width()-frameGeometry().width()-diff_x, + rect.height()-diff_y); + move (0, 0); + mainwin->move(frameGeometry().width(), 0); +} + + +void EntryDlg::slotDockHorizontal() +{ + if (!docked) { + oldMainPos = mainwin->pos(); + oldMainSize = mainwin->size(); + docked = true; + } + + KWinModule info; + QRect rect = info.workArea(); + + int diff_x = frameGeometry().width()-width(); + int diff_y = frameGeometry().height()-height(); + + resize(rect.width()-diff_x, minimumHeight()); + mainwin->resize(rect.width()-diff_x, + rect.height()-frameGeometry().height()-diff_y); + move(0, 0); + mainwin->move (0, frameGeometry().height()); +} + + +EntryDlg::~EntryDlg() +{ + if (docked) { + docked = false; + mainwin->resize(oldMainSize); + mainwin->move(oldMainPos); + } +} + + +void EntryDlg::reject () +{ + emit sigEditChoice(EditCancel); +} + + +void EntryDlg::closeEvent (QCloseEvent * /*e*/) +{ + emit sigEditChoice(EditCancel); +} + + +#include "EntryDlg.moc" + diff --git a/kvoctrain/kvoctrain/entry-dialogs/EntryDlg.h b/kvoctrain/kvoctrain/entry-dialogs/EntryDlg.h new file mode 100644 index 00000000..f349ccfc --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/EntryDlg.h @@ -0,0 +1,222 @@ +/*************************************************************************** + + entry dialog for table cell contents + + ----------------------------------------------------------------------- + + begin : Thu Mar 11 20:50:53 MET 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + *************************************************************************** + + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef EntryDlg_included +#define EntryDlg_included + +#include <qtable.h> + +#include <kdialogbase.h> + +#include "FromToEntryPage.h" +#include "CommonEntryPage.h" +#include "AuxInfoEntryPage.h" +#include "TenseEntryPage.h" +#include "AdjEntryPage.h" +#include "MCEntryPage.h" + +class LangSet; +class QTabWidget; +class KMainWindow; +class kvoctrainDoc; + +class EntryDlg : public KDialogBase +{ + Q_OBJECT + +public: + + enum EditResult {EditCancel, EditApply, EditUndo, EditPageUp, EditPageDown, EditUp, EditDown, EditLeft, EditRight}; + + enum EnableType {EnableAll, EnableOnlyCommon, EnableNone, EnableOnlyOriginal }; + + EntryDlg + ( KMainWindow *main, + kvoctrainDoc *doc, + bool multi_sel, + bool origin, + grade_t f_grd, + grade_t t_grd, + count_t f_qcount, + count_t t_qcount, + count_t f_bcount, + count_t t_bcount, + time_t f_qdate, + time_t t_qdate, + QString f_faux_ami, + QString t_faux_ami, + QString _expr, + int _lesson, + QComboBox *_lessonBox, + QString lang, + LangSet &langset, + QString remark, + QString _type, + QString pronunce, + QString synonym, + QString antonym, + QString example, + QString usagelabel, + QString paraphrase, + const Conjugation &con_prefix, + const Conjugation &conjugations, + const Article &article, + const Comparison &comp, + const MultipleChoice &mc, + QueryManager &querymanager, + const QString &title, + bool active, + const QFont& ipafont, + QWidget *parent = 0, + const char *name = 0, + bool modal = false + ); + + ~EntryDlg (); + + void setData + (kvoctrainDoc *doc, + bool multi_sel, + bool origin, + grade_t f_grd, + grade_t t_grd, + count_t f_qcount, + count_t t_qcount, + count_t f_bcount, + count_t t_bcount, + time_t f_qdate, + time_t t_qdate, + QString f_faux_ami, + QString t_faux_ami, + QString _expr, + int _lesson, + QComboBox *_lessonBox, + QString lang, + LangSet &langset, + QString remark, + QString _type, + QString pronunce, + QString synonym, + QString antonym, + QString example, + QString usagelabel, + QString paraphrase, + const Conjugation &con_prefix, + const Conjugation &conjugations, + const Article &article, + const Comparison &comp, + const MultipleChoice &mc, + QueryManager &querymanager, + const QString &title, + bool active); + + bool fromDateDirty () const { return from_page ? from_page->dateDirty() : false; } + bool fromGradeDirty () const { return from_page ? from_page->gradeDirty() : false; } + bool fromBCountDirty () const { return from_page ? from_page->bCountDirty() : false; } + bool fromQCountDirty () const { return from_page ? from_page->qCountDirty() : false; } + QString getFromFauxAmi () const { return from_page ? from_page->getFauxAmi() : QString(""); } + + time_t getFromDate () const { return from_page ? from_page->getDate() : 0; } + grade_t getFromGrade () const { return from_page ? from_page->getGrade() : KV_NORM_GRADE; } + count_t getFromBCount () const { return from_page ? from_page->getBCount() : 0; } + count_t getFromQCount () const { return from_page ? from_page->getQCount() : 0; } + + bool toDateDirty () const { return to_page ? to_page->dateDirty() : false; } + bool toGradeDirty () const { return to_page ? to_page->gradeDirty() : false; } + bool toBCountDirty () const { return to_page ? to_page->bCountDirty() : false; } + bool toQCountDirty () const { return to_page ? to_page->qCountDirty() : false; } + QString getToFauxAmi () const { return to_page ? to_page->getFauxAmi() : QString(""); } + + time_t getToDate () const { return to_page ? to_page->getDate() : 0; } + grade_t getToGrade () const { return to_page ? to_page->getGrade() : KV_NORM_GRADE; } + count_t getToBCount () const { return to_page ? to_page->getBCount() : 0; } + count_t getToQCount () const { return to_page ? to_page->getQCount() : 0; } + + bool lessonDirty () const { return comm_page->lessonDirty(); } + bool usageDirty () const { return comm_page->usageDirty(); } + bool typeDirty () const { return comm_page->typeDirty (); } + bool activeDirty () const { return comm_page->activeDirty (); } + + int getLesson () const { return comm_page->getLesson(); } + QString getType () const { return comm_page->getType(); } + QString getExpr () const { return comm_page->getExpr(); } + QString getPronunce () const { return comm_page->getPronunce(); } + QString getUsageLabel() const { return comm_page->getUsageLabel(); } + bool getActive() const { return comm_page->getActive(); } + + QString getSynonym () const { return aux_page->getSynonym(); } + QString getAntonym () const { return aux_page->getAntonym(); } + QString getRemark () const { return aux_page->getRemark(); } + QString getExample () const { return aux_page->getExample(); } + QString getParaphrase () const { return aux_page->getParaphrase(); } + + Conjugation getConjugation() const { return tense_page->getConjugation(); } + + Comparison getComparison() const { return adj_page->getComparison(); } + + MultipleChoice getMultipleChoice() const { return mc_page->getMultipleChoice(); } + + bool isModified(); + void setModified(bool mod); + void setEnabled(int); + + void setCell(int row, int col, const vector<QTableSelection>& sel); + void getCell(int &row, int &col, vector<QTableSelection>& sel) const; + +signals: + void sigEditChoice(int); + +public slots: + void slotDisplayModified(); + void slotApply(); + void slotUndo(); + void slotDockHorizontal(); + void slotDockVertical(); + +protected slots: + void updatePages(const QString &type); + virtual void reject (); + +protected: + virtual void closeEvent (QCloseEvent*e); + + FromToEntryPage *from_page, + *to_page; + CommonEntryPage *comm_page; + AuxInfoEntryPage *aux_page; + TenseEntryPage *tense_page; + AdjEntryPage *adj_page; + MCEntryPage *mc_page; + int edit_row, edit_col; + QTabWidget *tabber; + + vector<QTableSelection> selections; + KMainWindow *mainwin; + QSize oldMainSize; + QPoint oldMainPos; + bool docked; +}; + +#endif // EntryDlg_included diff --git a/kvoctrain/kvoctrain/entry-dialogs/FromToEntryPage.cpp b/kvoctrain/kvoctrain/entry-dialogs/FromToEntryPage.cpp new file mode 100644 index 00000000..462cdbf0 --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/FromToEntryPage.cpp @@ -0,0 +1,395 @@ +/*************************************************************************** + + edit properties from/to original + + ----------------------------------------------------------------------- + + begin : Mon Jun 28 21:02:16 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "FromToEntryPage.h" +#include "EntryDlg.h" + +#include <qlineedit.h> +#include <qcombobox.h> +#include <qpushbutton.h> +#include <qgroupbox.h> + +#include <klocale.h> + +#include <QueryManager.h> +#include <langset.h> + +#include "blockall.h" +#include "MySpinBox.h" + +#include <stdlib.h> + +static QStringList monthnames; + +FromToEntryPage::FromToEntryPage +( + EntryDlg *_dlgbook, + bool multi_sel, + grade_t _grade, + time_t _time, + count_t _qcount, + count_t _bcount, + QString faux, + QString label, + QWidget *parent, + const char *name +) + : + FromToEntryPageForm( parent, name ), fauxami(faux), dlgbook(_dlgbook) +{ + monthnames.clear(); + monthnames.append (""); + monthnames.append (i18n("January")); + monthnames.append (i18n("February")); + monthnames.append (i18n("March")); + monthnames.append (i18n("April")); + monthnames.append (i18n("May")); + monthnames.append (i18n("June")); + monthnames.append (i18n("July")); + monthnames.append (i18n("August")); + monthnames.append (i18n("September")); + monthnames.append (i18n("October")); + monthnames.append (i18n("November")); + monthnames.append (i18n("December")); + + connect( bcount_line, SIGNAL(textChanged(const QString&)), SLOT(slotBCount(const QString&)) ); + connect( qcount_line, SIGNAL(textChanged(const QString&)), SLOT(slotQCount(const QString&)) ); + connect( fauxami_line, SIGNAL(textChanged(const QString&)), SLOT(slotFauxAmiSelected(const QString&)) ); + + connect( never, SIGNAL(clicked()), SLOT(slotNever()) ); + connect( today, SIGNAL(clicked()), SLOT(slotToday()) ); + connect( gradebox, SIGNAL(activated(int)), SLOT(slotGradeSelected(int)) ); + + connect( year_spin, SIGNAL(valueChanged(int)), SLOT(slotYearChanged(int)) ); + connect( month_spin, SIGNAL(valueChanged(int)), SLOT(slotMonthChanged(int)) ); + connect( day_spin, SIGNAL(valueChanged(int)), SLOT(slotDayChanged(int)) ); + + year_spin->setData ((QStringList *) 0, 1980, 2100); + month_spin->setData (&monthnames, 1, 12); + day_spin->setData ((QStringList *) 0, 1, 31); + + QString s; + for (int i = 0; i <= KV_MAX_GRADE; i++) { + s.setNum (i); + gradebox->insertItem( QueryManager::gradeStr(i) ); + } + gradebox->setValidator (new BlockAllValidator() ); + + setTabOrder(fauxami_line, year_spin); + setTabOrder(year_spin, month_spin); + setTabOrder(month_spin, day_spin); + setTabOrder(day_spin, today); + + setData(multi_sel, _grade, _time, _qcount, _bcount, faux, label); +} + + +void FromToEntryPage::setData( + bool multi_sel, + grade_t _grade, + time_t _time, + count_t _qcount, + count_t _bcount, + QString faux, + QString label) +{ + grade = _grade; + qcount = _qcount; + bcount = _bcount; + fauxami = faux; + fauxami_line->setText(fauxami); + + valid_date = false; + QDateTime dt; + QDate date; + if (_time != 0 && !multi_sel) { + dt.setTime_t (_time); + valid_date = true; + + date = dt.date(); + year = date.year(); + month = date.month(); + day = date.day(); + + day_spin->setValue(day); + month_spin->setValue(month); + year_spin->setValue(year); + year_spin->setSpecial(QString::null); + month_spin->setSpecial(QString::null); + day_spin->setSpecial(QString::null); + } + else { + dt.setTime_t (time(0L)); + date = dt.date(); + year = date.year(); + month = date.month(); + day = date.day(); + year_spin->setSpecial("----"); + month_spin->setSpecial("----"); + day_spin->setSpecial("--"); + } + + direc_label->setTitle (label); + + gradebox->setCurrentItem (grade); + + QString s; + s.setNum (qcount); + qcount_line->setText (s); + + s.setNum (bcount); + bcount_line->setText (s); + + if (multi_sel) { + fauxami_line->setEnabled(false); + valid_date = false; + bcount_line->setText (""); + qcount_line->setText (""); + month_spin->setSpecial(" "); + day_spin->setSpecial(" "); + // FIXME: possibly derive new combobox type + // which filters ALL charcters to prevent new input + // in edit field + gradebox->clearEdit(); + } + + bcount_dirty = false; + qcount_dirty = false; + date_dirty = false; + grade_dirty = false; + + setModified(false); +} + + +void FromToEntryPage::slotFauxAmiSelected(const QString& s) +{ + setModified(true); + fauxami = s; +} + + +void FromToEntryPage::slotGradeSelected (int g) +{ + setModified(true); + grade_dirty = true; + grade = g; +} + + +void FromToEntryPage::slotQCount(const QString& s) +{ + setModified(true); + qcount_dirty = true; + qcount = atoi (s.local8Bit()); +} + + +void FromToEntryPage::slotBCount(const QString& s) +{ + setModified(true); + bcount_dirty = true; + bcount = atoi (s.local8Bit()); +} + + +time_t FromToEntryPage::getDate () const +{ + // FIXME: warning dialog/don`t quit dialog when date invalid + if (valid_date) { + QDate act_date (year, month, day); + QDateTime time_null (QDate (1970, 1, 1), QTime (0,0,0)); + return -QDateTime(act_date).secsTo (time_null); + } + else + return 0; +} + + +void FromToEntryPage::validate() +{ + if (!valid_date) { + valid_date = true; + day_spin->setValue(day); + month_spin->setValue(month); + year_spin->setValue(year); + } +} + + +void FromToEntryPage::slotYearChanged(int new_year) +{ + setModified(true); + date_dirty = true; + if (!valid_date) { + slotToday(); + new_year = year; + } + + year_spin->setSpecial(QString::null); + + year = new_year; + validate(); +} + + +void FromToEntryPage::slotDecYear() +{ + setModified(true); +} + + +// FIXME: dec month when day decrease below 1 +void FromToEntryPage::slotIncYear() +{ + setModified(true); +} + + +void FromToEntryPage::slotMonthChanged(int new_month) +{ + setModified(true); + date_dirty = true; + if (!valid_date) { + slotToday(); + new_month = month; + } + + month_spin->setSpecial(QString::null); + + month = new_month; + validate(); +} + + +void FromToEntryPage::slotDecMonth() +{ + setModified(true); +} + + +void FromToEntryPage::slotIncMonth() +{ + setModified(true); +} + + +void FromToEntryPage::slotDayChanged(int new_day) +{ + setModified(true); + date_dirty = true; + if (!valid_date) { + slotToday(); + new_day = day; + } + + day_spin->setSpecial(QString::null); + + day = new_day; + validate(); +} + + +void FromToEntryPage::slotDecDay() +{ + setModified(true); +} + + +void FromToEntryPage::slotIncDay() +{ + setModified(true); +} + + +void FromToEntryPage::slotToday() +{ + setModified(true); + date_dirty = true; + QDateTime dt; + dt.setTime_t (time(0L)); + + year = dt.date().year(); + month = dt.date().month(); + day = dt.date().day(); + + day_spin->setValue(day); + month_spin->setValue(month); + year_spin->setValue(year); + year_spin->setSpecial(QString::null); + month_spin->setSpecial(QString::null); + day_spin->setSpecial(QString::null); + validate(); +} + + +void FromToEntryPage::slotNever() +{ + setModified(true); + date_dirty = true; + year = 0; + month = 0; + day = 0; + year_spin->setSpecial("----"); + month_spin->setSpecial("----"); + day_spin->setSpecial("--"); + valid_date = false; +} + + +bool FromToEntryPage::isModified() +{ + return modified; +} + + +void FromToEntryPage::setEnabled(int enable) +{ + bool ena = enable == EntryDlg::EnableAll; + + bcount_line->setEnabled(ena); + qcount_line->setEnabled(ena); + fauxami_line->setEnabled(ena); + + never->setEnabled(ena); + today->setEnabled(ena); + gradebox->setEnabled(ena); + + year_spin->setEnabled(ena); + month_spin->setEnabled(ena); + day_spin->setEnabled(ena); +} + + +void FromToEntryPage::setModified(bool mod) +{ + modified = mod; + if (mod) + emit sigModified(); +} + +#include "FromToEntryPage.moc" + diff --git a/kvoctrain/kvoctrain/entry-dialogs/FromToEntryPage.h b/kvoctrain/kvoctrain/entry-dialogs/FromToEntryPage.h new file mode 100644 index 00000000..ad322eff --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/FromToEntryPage.h @@ -0,0 +1,124 @@ +/*************************************************************************** + + edit properties from/to original + + ----------------------------------------------------------------------- + + begin : Mon Jun 28 21:02:16 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef FromToEntryPage_included +#define FromToEntryPage_included + +#include "FromToEntryPageForm.h" +#include <time.h> +#include <qdatetime.h> + +#include <kvoctraindoc.h> + +class EntryDlg; + +class FromToEntryPage : public FromToEntryPageForm +{ + Q_OBJECT + +public: + + FromToEntryPage + ( + EntryDlg *dlgbook, + bool multi_sel, + grade_t _grade, + time_t _date, + count_t _qcount, + count_t _bcount, + QString faux, + QString label, + QWidget *parent = NULL, + const char *name = NULL + ); + + void setData( + bool multi_sel, + grade_t _grade, + time_t _date, + count_t _qcount, + count_t _bcount, + QString faux, + QString label); + + time_t dateDirty () const { return date_dirty; } + grade_t gradeDirty () const { return grade_dirty; } + count_t qCountDirty () const { return qcount_dirty; } + count_t bCountDirty () const { return bcount_dirty; } + + time_t getDate () const; + grade_t getGrade () const { return grade; } + count_t getQCount () const { return qcount; } + count_t getBCount () const { return bcount; } + + QString getFauxAmi () const { return fauxami; } + + bool isModified(); + void setModified(bool mod = true); + void setEnabled(int enable_type); + +signals: + void sigModified(); + +protected slots: + void slotGradeSelected(int); + void slotQCount(const QString&); + void slotBCount(const QString&); + + void slotIncYear(); + void slotIncMonth(); + void slotIncDay(); + void slotDecYear(); + void slotDecMonth(); + void slotDecDay(); + void slotToday(); + void slotNever(); + void slotFauxAmiSelected(const QString&); + + void slotDayChanged(int); + void slotMonthChanged(int); + void slotYearChanged(int); + +protected: + void validate(); + + QString fauxami; + bool valid_date; + bool date_dirty, + qcount_dirty, + bcount_dirty, + grade_dirty; + grade_t grade; + count_t qcount; + count_t bcount; + int year, + month, + day; + EntryDlg *dlgbook; + bool modified; +}; + +#endif // FromToEntryPage_included diff --git a/kvoctrain/kvoctrain/entry-dialogs/FromToEntryPageForm.ui b/kvoctrain/kvoctrain/entry-dialogs/FromToEntryPageForm.ui new file mode 100644 index 00000000..9fea8f70 --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/FromToEntryPageForm.ui @@ -0,0 +1,320 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>FromToEntryPageForm</class> +<widget class="QWidget"> + <property name="name"> + <cstring>FromToEntryPageForm</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>552</width> + <height>292</height> + </rect> + </property> + <property name="caption"> + <string>-</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>direc_label</cstring> + </property> + <property name="title"> + <string>Properties From Original</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QFrame"> + <property name="name"> + <cstring>Frame3</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <spacer row="0" column="2"> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QComboBox" row="0" column="1"> + <property name="name"> + <cstring>gradebox</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>fauxami_line</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>fauxami_label</cstring> + </property> + <property name="text"> + <string>False fr&iend:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>fauxami_line</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>grade_label</cstring> + </property> + <property name="text"> + <string>&Grade:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>gradebox</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox2</cstring> + </property> + <property name="title"> + <string>Last Query &Date</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="MySpinBox"> + <property name="name"> + <cstring>year_spin</cstring> + </property> + <property name="minimumSize"> + <size> + <width>60</width> + <height>0</height> + </size> + </property> + </widget> + <widget class="MySpinBox"> + <property name="name"> + <cstring>month_spin</cstring> + </property> + <property name="minimumSize"> + <size> + <width>110</width> + <height>0</height> + </size> + </property> + </widget> + <widget class="MySpinBox"> + <property name="name"> + <cstring>day_spin</cstring> + </property> + <property name="minimumSize"> + <size> + <width>60</width> + <height>0</height> + </size> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>today</cstring> + </property> + <property name="text"> + <string>T&oday</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>never</cstring> + </property> + <property name="text"> + <string>&Never</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox3</cstring> + </property> + <property name="title"> + <string>Query Counters</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>bcount_label</cstring> + </property> + <property name="text"> + <string>&Wrong:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>bcount_line</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>qcount_label</cstring> + </property> + <property name="text"> + <string>&Altogether:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>qcount_line</cstring> + </property> + </widget> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>qcount_line</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>bcount_line</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </grid> + </widget> + </vbox> + </widget> + </hbox> +</widget> +<customwidgets> + <customwidget> + <class>MySpinBox</class> + <header location="local">MySpinBox.h</header> + <sizehint> + <width>60</width> + <height>30</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>0</hordata> + <verdata>0</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="PNG" length="256">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000c749444154789cad55db1184200c4c180bb81a28c73aad811228c356f42b3792db3cc0db2fc724bb7901dc7b270f27ed17fa5fa9b117b7cd90211f4ba0ac906a7f1453b4d30ca917bb590681552af23f69bfc4ffa71519d2c8f62546ea5ea03738b1c18c33a4d156f0d13f43b61952e4af6d6e8fb3a408f080448419a433d6486d85052fdba892a295f5d45785cd8c51a9d6de6a814a8d2131da51f98e7a3b64ec9da04a8db53d43be3c3c0b22cacf17e4cdb5a931649ceddf34b190cf0aa019f03f1fd3e7457f03b5a66c9e1f13d0b20000000049454e44ae426082</data> + </image> +</images> +<tabstops> + <tabstop>gradebox</tabstop> + <tabstop>fauxami_line</tabstop> + <tabstop>today</tabstop> + <tabstop>never</tabstop> + <tabstop>qcount_line</tabstop> + <tabstop>bcount_line</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kvoctrain/kvoctrain/entry-dialogs/MCEntryPage.cpp b/kvoctrain/kvoctrain/entry-dialogs/MCEntryPage.cpp new file mode 100644 index 00000000..a26e43ed --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/MCEntryPage.cpp @@ -0,0 +1,131 @@ +/*************************************************************************** + + dialog page for multiple choice suggestions + + ----------------------------------------------------------------------- + + begin : Mon Oct 29 18:09:29 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "MCEntryPage.h" +#include "EntryDlg.h" + +#include <langset.h> + +#include <qlineedit.h> + + +MCEntryPage::MCEntryPage(EntryDlg *_dlgbook, bool multi_sel, const MultipleChoice &mc, QWidget *parent, const char *name) + : MCEntryPageForm( parent, name ), dlgbook(_dlgbook) +{ + multiplechoice = mc; + + connect( mc1Field, SIGNAL(textChanged(const QString&)), SLOT(mc1Changed(const QString&)) ); + connect( mc2Field, SIGNAL(textChanged(const QString&)), SLOT(mc2Changed(const QString&)) ); + connect( mc3Field, SIGNAL(textChanged(const QString&)), SLOT(mc3Changed(const QString&)) ); + connect( mc4Field, SIGNAL(textChanged(const QString&)), SLOT(mc4Changed(const QString&)) ); + connect( mc5Field, SIGNAL(textChanged(const QString&)), SLOT(mc5Changed(const QString&)) ); + + setData(multi_sel, mc); +} + + +void MCEntryPage::setData(bool multi_sel, const MultipleChoice &mc) +{ + mc1Field->setText (mc.mc1()); + mc2Field->setText (mc.mc2()); + mc3Field->setText (mc.mc3()); + mc4Field->setText (mc.mc4()); + mc5Field->setText (mc.mc5()); + + if (multi_sel) + { + mc1Field->setEnabled(false); + mc2Field->setEnabled(false); + mc3Field->setEnabled(false); + mc4Field->setEnabled(false); + mc5Field->setEnabled(false); + } + + setModified(false); +} + + +void MCEntryPage::mc1Changed(const QString& s) +{ + setModified(true); + multiplechoice.setMC1 (s); +} + + +void MCEntryPage::mc2Changed(const QString& s) +{ + setModified(true); + multiplechoice.setMC2 (s); +} + + +void MCEntryPage::mc3Changed(const QString& s) +{ + setModified(true); + multiplechoice.setMC3 (s); +} + + +void MCEntryPage::mc4Changed(const QString& s) +{ + setModified(true); + multiplechoice.setMC4 (s); +} + + +void MCEntryPage::mc5Changed(const QString& s) +{ + setModified(true); + multiplechoice.setMC5 (s); +} + + +bool MCEntryPage::isModified() +{ + return modified; +} + + +void MCEntryPage::setModified(bool mod) +{ + modified = mod; + if (mod) + emit sigModified(); +} + + +void MCEntryPage::setEnabled(int enable) +{ + bool ena = enable == EntryDlg::EnableAll; + + mc1Field->setEnabled (ena); + mc2Field->setEnabled (ena); + mc3Field->setEnabled (ena); + mc4Field->setEnabled (ena); + mc5Field->setEnabled (ena); +} + +#include "MCEntryPage.moc" diff --git a/kvoctrain/kvoctrain/entry-dialogs/MCEntryPage.h b/kvoctrain/kvoctrain/entry-dialogs/MCEntryPage.h new file mode 100644 index 00000000..23fb441a --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/MCEntryPage.h @@ -0,0 +1,66 @@ +/*************************************************************************** + + dialog page for multiple choice suggestions + + ----------------------------------------------------------------------- + + begin : Mon Oct 29 18:09:29 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef MCEntryPage_included +#define MCEntryPage_included + +#include "MCEntryPageForm.h" + +#include <MultipleChoice.h> + +class EntryDlg; + +class MCEntryPage : public MCEntryPageForm +{ + Q_OBJECT + +public: + MCEntryPage(EntryDlg *dlgbook, bool multi_sel, const MultipleChoice &mc, QWidget *parent = NULL, const char *name = NULL); + + void setData(bool multi_sel, const MultipleChoice &mc); + + MultipleChoice getMultipleChoice() const { return multiplechoice; } + + bool isModified(); + void setModified(bool mod = true); + void setEnabled(int enable_type); + +signals: + void sigModified(); + +protected slots: + void mc1Changed(const QString&); + void mc2Changed(const QString&); + void mc3Changed(const QString&); + void mc4Changed(const QString&); + void mc5Changed(const QString&); + +protected: + MultipleChoice multiplechoice; + bool modified; + EntryDlg *dlgbook; +}; + +#endif // MCEntryPage_included diff --git a/kvoctrain/kvoctrain/entry-dialogs/MCEntryPageForm.ui b/kvoctrain/kvoctrain/entry-dialogs/MCEntryPageForm.ui new file mode 100644 index 00000000..b03b2de6 --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/MCEntryPageForm.ui @@ -0,0 +1,217 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>MCEntryPageForm</class> +<widget class="QWidget"> + <property name="name"> + <cstring>MCEntryPageForm</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>583</width> + <height>181</height> + </rect> + </property> + <property name="caption"> + <string>-</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox1</cstring> + </property> + <property name="title"> + <string>Suggestions for Multiple Choice</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>mc1Label</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&1:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mc1Field</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>mc2Label</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&2:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mc2Field</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>mc3Label</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&3:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mc3Field</cstring> + </property> + </widget> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>mc1Field</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>mc2Field</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>mc3Field</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLineEdit" row="4" column="1"> + <property name="name"> + <cstring>mc5Field</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLineEdit" row="3" column="1"> + <property name="name"> + <cstring>mc4Field</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>mc4Label</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&4:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mc4Field</cstring> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>mc5Label</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&5:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mc5Field</cstring> + </property> + </widget> + </grid> + </widget> + </vbox> +</widget> +<tabstops> + <tabstop>mc1Field</tabstop> + <tabstop>mc2Field</tabstop> + <tabstop>mc3Field</tabstop> + <tabstop>mc4Field</tabstop> + <tabstop>mc5Field</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kvoctrain/kvoctrain/entry-dialogs/Makefile.am b/kvoctrain/kvoctrain/entry-dialogs/Makefile.am new file mode 100644 index 00000000..520cbdb5 --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/Makefile.am @@ -0,0 +1,13 @@ +INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../kvt-core \ + -I../docprop-dialogs -I$(srcdir)/../docprop-dialogs -I$(top_builddir)/kvoctrain/kvoctrain/common-dialogs $(all_includes) + +noinst_LTLIBRARIES = libentrydlg.la + +libentrydlg_la_SOURCES = PhoneticEntryPage.cpp FromToEntryPage.cpp \ + CommonEntryPage.cpp AuxInfoEntryPage.cpp FromToEntryPageForm.ui CommonEntryPageForm.ui \ + AuxInfoEntryPageForm.ui TenseEntryPage.cpp AdjEntryPage.cpp MCEntryPage.cpp \ + TenseEntryPageForm.ui AdjEntryPageForm.ui MCEntryPageForm.ui EntryDlg.cpp MySpinBox.cpp \ + blockall.cpp + +METASOURCES = AUTO + diff --git a/kvoctrain/kvoctrain/entry-dialogs/MySpinBox.cpp b/kvoctrain/kvoctrain/entry-dialogs/MySpinBox.cpp new file mode 100644 index 00000000..f8d1e6f9 --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/MySpinBox.cpp @@ -0,0 +1,68 @@ +/*************************************************************************** + + display special spinbox (only meaningful for QT2x) + + ----------------------------------------------------------------------- + + begin : Sat Oct 21 18:02:16 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + + +#include "MySpinBox.h" + +MySpinBox::MySpinBox (QWidget* parent, const char* name ): QSpinBox(parent, name ), spin_names (0) +{ + setWrapping(true); +} + + +void MySpinBox::setData (QStringList *names, int minValue, int maxValue) +{ + spin_names = names; + setRange (minValue, maxValue); +} + + +QString MySpinBox::mapValueToText( int value ) +{ + if (special_str.length() != 0 ) + return special_str; + + if (spin_names != 0) + return (*spin_names)[value]; + else + return QString("%1").arg(value); +} + + +int MySpinBox::MySpinBox::mapTextToValue(bool *) +{ + return 0; +} + + +void MySpinBox::setSpecial(const QString &str) +{ + special_str = str; + setSuffix(""); // update display +} + + + diff --git a/kvoctrain/kvoctrain/entry-dialogs/MySpinBox.h b/kvoctrain/kvoctrain/entry-dialogs/MySpinBox.h new file mode 100644 index 00000000..284bb8ea --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/MySpinBox.h @@ -0,0 +1,48 @@ +/*************************************************************************** + + display special spinbox + + ----------------------------------------------------------------------- + + begin : Sat Oct 21 18:02:16 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef MySpinbox_included +#define MySpinbox_included + +#include <qspinbox.h> + +class QStringlist; + +class MySpinBox : public QSpinBox +{ +public: + MySpinBox (QWidget* parent = 0, const char* name = 0); + + void setSpecial(const QString &str); + void setData (QStringList *names, int minValue, int maxValue); + virtual QString mapValueToText( int value ); + virtual int mapTextToValue( bool* ok ); + +protected: + QStringList *spin_names; + QString special_str; +}; + +#endif // MySpinbox_included diff --git a/kvoctrain/kvoctrain/entry-dialogs/PhoneticEntryPage.cpp b/kvoctrain/kvoctrain/entry-dialogs/PhoneticEntryPage.cpp new file mode 100644 index 00000000..6d26be5a --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/PhoneticEntryPage.cpp @@ -0,0 +1,229 @@ + /*************************************************************************** + + dialog page for characters from the phonetic alphabet + + ----------------------------------------------------------------------- + + begin : Sun Dec 9 2001 + + copyright : (C) 2001-2002 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001-2002 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "PhoneticEntryPage.h" + +#include <qlayout.h> +#include <qframe.h> +#include <qgroupbox.h> +#include <qtooltip.h> + +#include <kdebug.h> +#include <klocale.h> + +#define KV_MAX_HORIZ 20 +#define KV_FONTSIZE 14 + +#define I18N_NOOP_maybe(x) x + +// provide Unicode chars U0250 - U02AF + +struct KV_Unicode_Ref { + wchar_t code; + const char *unicodename; + const char *audible; +}; + +KV_Unicode_Ref kv_unicode_ref[] = { + + {0x00E6, "LATIN SMALL LETTER AE", I18N_NOOP_maybe("")}, + {0x00E7, "LATIN SMALL LETTER C WITH CEDILLA", I18N_NOOP_maybe("")}, + {0x00F0, "LATIN SMALL LETTER ETH", I18N_NOOP_maybe("")}, + {0x00F8, "LATIN SMALL LETTER O WITH STROKE", I18N_NOOP_maybe("")}, + {0x0127, "LATIN SMALL LETTER H WITH STROKE", I18N_NOOP_maybe("")}, + {0x014B, "LATIN SMALL LETTER ENG", I18N_NOOP_maybe("")}, + {0x0153, "LATIN SMALL LIGATURE OE", I18N_NOOP_maybe("")}, + {0x01F0, "LATIN SMALL LETTER J WITH CARON", I18N_NOOP_maybe("")}, + + {0x03B2, "GREEK SMALL LETTER BETA", I18N_NOOP_maybe("")}, + {0x03B8, "GREEK SMALL LETTER THETA", I18N_NOOP_maybe("")}, + {0x03BB, "GREEK SMALL LETTER LAMDA", I18N_NOOP_maybe("")}, + {0x03C7, "GREEK SMALL LETTER CHI", I18N_NOOP_maybe("")}, + + {0x0250, "LATIN SMALL LETTER TURNED A", I18N_NOOP_maybe("low central unrounded vowel")}, + {0x0251, "LATIN SMALL LETTER ALPHA", I18N_NOOP_maybe("low back unrounded vowel")}, + {0x0252, "LATIN SMALL LETTER TURNED ALPHA", I18N_NOOP_maybe("low back rounded vowel")}, + {0x0253, "LATIN SMALL LETTER B WITH HOOK", I18N_NOOP_maybe("implosive bilabial stop")}, + {0x0254, "LATIN SMALL LETTER OPEN O", I18N_NOOP_maybe("lower-mid back rounded vowel")}, + {0x0255, "LATIN SMALL LETTER C WITH CURL", I18N_NOOP_maybe("voiceless alveolo-palatal laminal fricative")}, + {0x0256, "LATIN SMALL LETTER D WITH TAIL", I18N_NOOP_maybe("voiced retroflex stop")}, + {0x0257, "LATIN SMALL LETTER D WITH HOOK", I18N_NOOP_maybe("implosive dental or alveolar stop")}, + {0x0258, "LATIN SMALL LETTER REVERSED E", I18N_NOOP_maybe("upper-mid central unrounded vowel")}, + {0x0259, "LATIN SMALL LETTER SCHWA", I18N_NOOP_maybe("mid-central unrounded vowel")}, + {0x025A, "LATIN SMALL LETTER SCHWA WITH HOOK", I18N_NOOP_maybe("rhotacized schwa")}, + {0x025B, "LATIN SMALL LETTER OPEN E", I18N_NOOP_maybe("lower-mid front unrounded vowel")}, + {0x025C, "LATIN SMALL LETTER REVERSED OPEN E", I18N_NOOP_maybe("lower-mid central unrounded vowel")}, + {0x025D, "LATIN SMALL LETTER REVERSED OPEN E WITH HOOK", I18N_NOOP_maybe("rhotacized lower-mid central vowel")}, + {0x025E, "LATIN SMALL LETTER CLOSED REVERSED OPEN E", I18N_NOOP_maybe("lower-mid central rounded vowel")}, + {0x025F, "LATIN SMALL LETTER DOTLESS J WITH STROKE", I18N_NOOP_maybe("voiced palatal stop")}, + {0x0260, "LATIN SMALL LETTER G WITH HOOK", I18N_NOOP_maybe("implosive velar stop")}, + {0x0261, "LATIN SMALL LETTER SCRIPT G", I18N_NOOP_maybe("voiced velar stop")}, + {0x0262, "LATIN LETTER SMALL CAPITAL G", I18N_NOOP_maybe("voiced uvular stop")}, + {0x0263, "LATIN SMALL LETTER GAMMA", I18N_NOOP_maybe("voiced velar fricative")}, + {0x0264, "LATIN SMALL LETTER RAMS HORN", I18N_NOOP_maybe("")}, + {0x0265, "LATIN SMALL LETTER TURNED H", I18N_NOOP_maybe("voiced rounded palatal approximant")}, + {0x0266, "LATIN SMALL LETTER H WITH HOOK", I18N_NOOP_maybe("breathy-voiced glottal fricative")}, + {0x0267, "LATIN SMALL LETTER HENG WITH HOOK", I18N_NOOP_maybe("voiceless coarticulated velar and palatoalveolar fricative")}, + {0x0268, "LATIN SMALL LETTER I WITH STROKE", I18N_NOOP_maybe("high central unrounded vowel")}, + {0x0269, "LATIN SMALL LETTER IOTA", I18N_NOOP_maybe("semi-high front unrounded vowel")}, + {0x026A, "LATIN LETTER SMALL CAPITAL I", I18N_NOOP_maybe("semi-high front unrounded vowel")}, + {0x026B, "LATIN SMALL LETTER L WITH MIDDLE TILDE", I18N_NOOP_maybe("velarized voiced alveolar lateral approximant")}, + {0x026C, "LATIN SMALL LETTER L WITH BELT", I18N_NOOP_maybe("voiceless alveolar lateral fricative")}, + {0x026D, "LATIN SMALL LETTER L WITH RETROFLEX HOOK", I18N_NOOP_maybe("voiced retroflex lateral")}, + {0x026E, "LATIN SMALL LETTER LEZH", I18N_NOOP_maybe("voiced lateral fricative")}, + {0x026F, "LATIN SMALL LETTER TURNED M", I18N_NOOP_maybe("high back unrounded vowel")}, + {0x0270, "LATIN SMALL LETTER TURNED M WITH LONG LEG", I18N_NOOP_maybe("voiced velar approximant")}, + {0x0271, "LATIN SMALL LETTER M WITH HOOK", I18N_NOOP_maybe("voiced labiodental nasal")}, + {0x0272, "LATIN SMALL LETTER N WITH LEFT HOOK", I18N_NOOP_maybe("voiced palatal nasal")}, + {0x0273, "LATIN SMALL LETTER N WITH RETROFLEX HOOK", I18N_NOOP_maybe("voiced retroflex nasal")}, + {0x0274, "LATIN LETTER SMALL CAPITAL N", I18N_NOOP_maybe("voiced uvular nasal")}, + {0x0275, "LATIN SMALL LETTER BARRED O", I18N_NOOP_maybe("rounded mid-central vowel, i.e. rounded schwa")}, + {0x0276, "LATIN LETTER SMALL CAPITAL OE", I18N_NOOP_maybe("low front rounded vowel")}, + {0x0277, "LATIN SMALL LETTER CLOSED OMEGA", I18N_NOOP_maybe("semi-high back rounded vowel")}, + {0x0278, "LATIN SMALL LETTER PHI", I18N_NOOP_maybe("voiceless bilabial fricative")}, + {0x0279, "LATIN SMALL LETTER TURNED R", I18N_NOOP_maybe("voiced alveolar approximant")}, + {0x027A, "LATIN SMALL LETTER TURNED R WITH LONG LEG", I18N_NOOP_maybe("voiced lateral flap")}, + {0x027B, "LATIN SMALL LETTER TURNED R WITH HOOK", I18N_NOOP_maybe("voiced retroflex approximant")}, + {0x027C, "LATIN SMALL LETTER R WITH LONG LEG", I18N_NOOP_maybe("voiced strident apico-alveolar trill")}, + {0x027D, "LATIN SMALL LETTER R WITH TAIL", I18N_NOOP_maybe("voiced retroflex flap")}, + {0x027E, "LATIN SMALL LETTER R WITH FISHHOOK", I18N_NOOP_maybe("voiced alveolar flap or tap")}, + {0x027F, "LATIN SMALL LETTER REVERSED R WITH FISHHOOK", I18N_NOOP_maybe("apical dental vowel")}, + {0x0280, "LATIN LETTER SMALL CAPITAL R", I18N_NOOP_maybe("voiced uvular trill")}, + {0x0281, "LATIN LETTER SMALL CAPITAL INVERTED R", I18N_NOOP_maybe("voiced uvular fricative or approximant")}, + {0x0282, "LATIN SMALL LETTER S WITH HOOK", I18N_NOOP_maybe("voiceless retroflex fricative")}, + {0x0283, "LATIN SMALL LETTER ESH", I18N_NOOP_maybe("voiceless postalveolar fricative")}, + {0x0284, "LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK", I18N_NOOP_maybe("implosive palatal stop")}, + {0x0285, "LATIN SMALL LETTER SQUAT REVERSED ESH", I18N_NOOP_maybe("apical retroflex vowel")}, + {0x0286, "LATIN SMALL LETTER ESH WITH CURL", I18N_NOOP_maybe("palatalized voiceless postalveolar fricative")}, + {0x0287, "LATIN SMALL LETTER TURNED T", I18N_NOOP_maybe("dental click")}, + {0x0288, "LATIN SMALL LETTER T WITH RETROFLEX HOOK", I18N_NOOP_maybe("voiceless retroflex stop")}, + {0x0289, "LATIN SMALL LETTER U BAR", I18N_NOOP_maybe("high central rounded vowel")}, + {0x028A, "LATIN SMALL LETTER UPSILON", I18N_NOOP_maybe("semi-high back rounded vowel")}, + {0x028B, "LATIN SMALL LETTER V WITH HOOK", I18N_NOOP_maybe("voiced labiodental approximant")}, + {0x028C, "LATIN SMALL LETTER TURNED V", I18N_NOOP_maybe("lower-mid back unrounded vowel")}, + {0x028D, "LATIN SMALL LETTER TURNED W", I18N_NOOP_maybe("voiceless rounded labiovelar approximant")}, + {0x028E, "LATIN SMALL LETTER TURNED Y", I18N_NOOP_maybe("voiced lateral approximant")}, + {0x028F, "LATIN LETTER SMALL CAPITAL Y", I18N_NOOP_maybe("semi-high front rounded vowel")}, + {0x0290, "LATIN SMALL LETTER Z WITH RETROFLEX HOOK", I18N_NOOP_maybe("voiced retroflex fricative")}, + {0x0291, "LATIN SMALL LETTER Z WITH CURL", I18N_NOOP_maybe("voiced alveolo-palatal laminal fricative")}, + {0x0292, "LATIN SMALL LETTER EZH", I18N_NOOP_maybe("voiced postalveolar fricative")}, + {0x0293, "LATIN SMALL LETTER EZH WITH CURL", I18N_NOOP_maybe("palatalized voiced postalveolar fricative")}, + {0x0294, "LATIN LETTER GLOTTAL STOP", I18N_NOOP_maybe("")}, + {0x0295, "LATIN LETTER PHARYNGEAL VOICED FRICATIVE", I18N_NOOP_maybe("voiced pharyngeal fricative")}, + {0x0296, "LATIN LETTER INVERTED GLOTTAL STOP", I18N_NOOP_maybe("lateral click")}, + {0x0297, "LATIN LETTER STRETCHED C", I18N_NOOP_maybe("palatal (or alveolar) click")}, + {0x0298, "LATIN LETTER BILABIAL CLICK", I18N_NOOP_maybe("")}, + {0x0299, "LATIN LETTER SMALL CAPITAL B", I18N_NOOP_maybe("bilabial trill")}, + {0x029A, "LATIN SMALL LETTER CLOSED OPEN E", I18N_NOOP_maybe("lower-mid front rounded vowel")}, + {0x029B, "LATIN LETTER SMALL CAPITAL G WITH HOOK", I18N_NOOP_maybe("voiced uvular implosive")}, + {0x029C, "LATIN LETTER SMALL CAPITAL H", I18N_NOOP_maybe("voiceless epiglottal fricative")}, + {0x029D, "LATIN SMALL LETTER J WITH CROSSED-TAIL", I18N_NOOP_maybe("voiced palatal fricative")}, + {0x029E, "LATIN SMALL LETTER TURNED K", I18N_NOOP_maybe("proposed for velar click")}, + {0x029F, "LATIN LETTER SMALL CAPITAL L", I18N_NOOP_maybe("velar lateral approximant")}, + {0x02A0, "LATIN SMALL LETTER Q WITH HOOK", I18N_NOOP_maybe("voiceless uvular implosive")}, + {0x02A1, "LATIN LETTER GLOTTAL STOP WITH STROKE", I18N_NOOP_maybe("voiced epiglottal stop")}, + {0x02A2, "LATIN LETTER REVERSED GLOTTAL STOP WITH STROKE", I18N_NOOP_maybe("voiced epiglottal fricative")}, + {0x02A3, "LATIN SMALL LETTER DZ DIGRAPH", I18N_NOOP_maybe("voiced dental affricate")}, + {0x02A4, "LATIN SMALL LETTER DEZH DIGRAPH", I18N_NOOP_maybe("voiced postalveolar affricate")}, + {0x02A5, "LATIN SMALL LETTER DZ DIGRAPH WITH CURL", I18N_NOOP_maybe("voiced alveolo-palatal affricate")}, + {0x02A6, "LATIN SMALL LETTER TS DIGRAPH", I18N_NOOP_maybe("voiceless dental affricate")}, + {0x02A7, "LATIN SMALL LETTER TESH DIGRAPH", I18N_NOOP_maybe("voiceless postalveolar affricate")}, + {0x02A8, "LATIN SMALL LETTER TC DIGRAPH WITH CURL", I18N_NOOP_maybe("voiceless alveolo-palatal affricate")}, + {0x02A9, "LATIN SMALL LETTER FENG DIGRAPH", I18N_NOOP_maybe("velopharyngeal fricative")}, + {0x02AA, "LATIN SMALL LETTER LS DIGRAPH", I18N_NOOP_maybe("lateral alveolar fricative (lisp)")}, + {0x02AB, "LATIN SMALL LETTER LZ DIGRAPH", I18N_NOOP_maybe("voiced lateral alveolar fricative")}, + {0x02AC, "LATIN LETTER BILABIAL PERCUSSIVE", I18N_NOOP_maybe("audible lip smack")}, + {0x02AD, "LATIN LETTER BIDENTAL PERCUSSIVE", I18N_NOOP_maybe("audible teeth gnashing")}, + + {0x02CA, "MODIFIER LETTER ACUTE ACCENT (Mandarin Chinese second tone)", I18N_NOOP_maybe("high-rising tone")}, + {0x02CB, "MODIFIER LETTER GRAVE ACCENT (Mandarin Chinese fourth tone)", I18N_NOOP_maybe("high-falling tone")}, + + {0x2191, "UPWARDS ARROW", I18N_NOOP_maybe("egressive airflow")}, + {0x2193, "DOWNWARDS ARROW", I18N_NOOP_maybe("ingressive airflow")}, + + {0, 0, 0} +}; + + +void PhoneticButton::slotClicked() +{ + if (text().length() != 0) + emit page->charSelected(text()[0].unicode()); +} + + +PhoneticEntryPage::PhoneticEntryPage(const QFont &ipafont, QWidget *parent, const char *name, bool modal) + : KDialogBase(Plain, i18n("Select Characters From Phonetic Alphabet"), Close, Close, parent, name, modal) +{ + int num = sizeof(kv_unicode_ref) / sizeof(kv_unicode_ref[0]); + QFrame * phoneticbox = plainPage(); + QGridLayout *gbox = new QGridLayout(phoneticbox, KV_MAX_HORIZ, (num+KV_MAX_HORIZ-1)/KV_MAX_HORIZ, 1); + + KV_Unicode_Ref *uni_ref = kv_unicode_ref; + int vert = 0; + int horiz = 0; + while (uni_ref->code != 0) { + QChar qc = uni_ref->code; + QString text = qc; + PhoneticButton *butt = new PhoneticButton(text, phoneticbox, this); + connect (butt, SIGNAL(clicked()), butt, SLOT(slotClicked()) ); + QString tip = i18n("Unicode name: "); + tip += QString::fromLatin1(uni_ref->unicodename); + tip += "\n"; + tip += i18n("Describing the sound of the character", "Sound: "); + tip += i18n(uni_ref->audible); + butt->setFont(ipafont); + butt->setSizePolicy(QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed)); + int sz = QMAX(14, int(1.7*ipafont.pointSize())); + butt->setMaximumSize(QSize (sz, sz)); + gbox->addWidget( butt, vert, horiz, AlignCenter ); + QToolTip::add (butt, tip); + + if (++horiz >= KV_MAX_HORIZ) { + ++vert; + horiz = 0; + } + ++uni_ref; + } + resize(sizeHint()); +} + + +void PhoneticEntryPage::keyPressEvent( QKeyEvent *e ) +{ + if ((e->state() & (ControlButton | AltButton)) == 0) { + QString s = e->text(); + for (unsigned i = 0; i < s.length(); ++i) { + emit charSelected(s[i].unicode()); + } + e->accept(); + } + else + e->ignore(); +} + + +#include "PhoneticEntryPage.moc" diff --git a/kvoctrain/kvoctrain/entry-dialogs/PhoneticEntryPage.h b/kvoctrain/kvoctrain/entry-dialogs/PhoneticEntryPage.h new file mode 100644 index 00000000..cf12ef48 --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/PhoneticEntryPage.h @@ -0,0 +1,67 @@ + /*************************************************************************** + + dialog page for characters from the phonetic alphabet + + ----------------------------------------------------------------------- + + begin : Sun Dec 9 2001 + + copyright : (C) 2001-2002 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001-2002 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef PHONETICENTRYPAGE_H +#define PHONETICENTRYPAGE_H + +#include <qpushbutton.h> + +#include <kdialogbase.h> + +class PhoneticEntryPage : public KDialogBase +{ + Q_OBJECT + +public: + PhoneticEntryPage(const QFont &ipafont, QWidget *parent = 0, const char *name = 0, bool modal = false); + +signals: + void charSelected(wchar_t); + +protected: + void keyPressEvent( QKeyEvent *e ); + + friend class PhoneticButton; +}; + + +class PhoneticButton : public QPushButton +{ + Q_OBJECT + +public: + PhoneticButton (const QString & text, QWidget * parent, PhoneticEntryPage *_page, const char * name = 0) + : QPushButton (text, parent, name), page(_page) {} + +protected slots: + void slotClicked(); + +protected: + PhoneticEntryPage *page; +}; + + +#endif diff --git a/kvoctrain/kvoctrain/entry-dialogs/TenseEntryPage.cpp b/kvoctrain/kvoctrain/entry-dialogs/TenseEntryPage.cpp new file mode 100644 index 00000000..30fa4fdd --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/TenseEntryPage.cpp @@ -0,0 +1,317 @@ +/*************************************************************************** + + tenses of irreg. verbs dialog page + + ----------------------------------------------------------------------- + + begin : Sat Nov 27 20:20:34 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <qcombobox.h> +#include <qcheckbox.h> +#include <qpushbutton.h> +#include <qlineedit.h> + +#include <langset.h> + +#include "TenseEntryPage.h" +#include "EntryDlg.h" + +TenseEntryPage::TenseEntryPage +( + EntryDlg *_dlgbook, + bool multi_sel, + const Conjugation &con_prefix, + const Conjugation &conjug, + QWidget *parent, + const char *name +) + : TenseEntryPageForm( parent, name ), multi_mode(multi_sel), dlgbook(_dlgbook) +{ + + connect( third_p_common, SIGNAL(toggled(bool)), SLOT(slotThirdPCommonToggled(bool)) ); + connect( third_s_common, SIGNAL(toggled(bool)), SLOT(slotThirdSCommonToggled(bool)) ); + connect( b_next, SIGNAL(clicked()), SLOT(slotNextConj()) ); + connect( tensebox, SIGNAL(activated(int)), SLOT(slotTenseSelected(int)) ); + + connect( thirdN_plural, SIGNAL(textChanged(const QString&)), SLOT(thirdNPluralChanged(const QString&)) ); + connect( thirdN_singular, SIGNAL(textChanged(const QString&)), SLOT(thirdNSingularChanged(const QString&)) ); + connect( thirdM_plural, SIGNAL(textChanged(const QString&)), SLOT(thirdMPluralChanged(const QString&)) ); + connect( thirdM_singular, SIGNAL(textChanged(const QString&)), SLOT(thirdMSingularChanged(const QString&)) ); + connect( thirdF_plural, SIGNAL(textChanged(const QString&)), SLOT(thirdFPluralChanged(const QString&)) ); + connect( thirdF_singular, SIGNAL(textChanged(const QString&)), SLOT(thirdFSingularChanged(const QString&)) ); + connect( second_plural, SIGNAL(textChanged(const QString&)), SLOT(secondPluralChanged(const QString&)) ); + connect( second_singular, SIGNAL(textChanged(const QString&)), SLOT(secondSingularChanged(const QString&)) ); + connect( first_plural, SIGNAL(textChanged(const QString&)), SLOT(firstPluralChanged(const QString&)) ); + connect( first_singular, SIGNAL(textChanged(const QString&)), SLOT(firstSingularChanged(const QString&)) ); + + prefix = con_prefix; + selection = ""; +/* + // FIXME: fill labels with prefixes ? + + label_first_plural->setText (con_prefix.pers1Plural (CONJ_PREFIX)); + label_first_singular->setText (con_prefix.pers1Singular (CONJ_PREFIX)); + label_second_singular->setText (con_prefix.pers2Singular (CONJ_PREFIX)); + label_second_plural->setText (con_prefix.pers2Plural (CONJ_PREFIX)); + label_thirdF_plural->setText (con_prefix.pers3FemalePlural (CONJ_PREFIX)); + label_thirdF_singular->setText (con_prefix.pers3FemaleSingular (CONJ_PREFIX)); + label_thirdM_singular->setText (con_prefix.pers3MaleSingular (CONJ_PREFIX)); + label_thirdN_singular->setText (con_prefix.pers3NaturalSingular (CONJ_PREFIX)); + label_thirdN_plural->setText (con_prefix.pers3NaturalPlural (CONJ_PREFIX)); + label_thirdM_plural->setText (con_prefix.pers3MalePlural (CONJ_PREFIX)); +*/ + + setData(multi_sel, conjug); +} + + +void TenseEntryPage::setData(bool /*multi_sel*/, const Conjugation &conjug) +{ + if (multi_mode) + tensebox->setEnabled(false); + + for (int i = 0; i < Conjugation::numTenses(); i++) + tensebox->insertItem (Conjugation::getName(i) ); + + conjugations = conjug; + slotTenseSelected(0); + updateFields(); + + setModified(false); +} + + +void TenseEntryPage::firstPluralChanged(const QString& s) +{ + conjugations.setPers1Plural (selection, s); + updateFields(); + setModified(true); +} + + +void TenseEntryPage::firstSingularChanged(const QString& s) +{ + conjugations.setPers1Singular (selection, s); + updateFields(); + setModified(true); +} + + +void TenseEntryPage::secondSingularChanged(const QString& s) +{ + conjugations.setPers2Singular (selection, s); + updateFields(); + setModified(true); +} + + +void TenseEntryPage::secondPluralChanged(const QString& s) +{ + conjugations.setPers2Plural (selection, s); + updateFields(); + setModified(true); +} + + +void TenseEntryPage::thirdFPluralChanged(const QString& s) +{ + conjugations.setPers3FemalePlural (selection, s); + updateFields(); + setModified(true); +} + + +void TenseEntryPage::thirdFSingularChanged(const QString& s) +{ + conjugations.setPers3FemaleSingular (selection, s); + updateFields(); + setModified(true); +} + + +void TenseEntryPage::thirdMSingularChanged(const QString& s) +{ + conjugations.setPers3MaleSingular (selection, s); + updateFields(); + setModified(true); +} + + +void TenseEntryPage::thirdNSingularChanged(const QString& s) +{ + conjugations.setPers3NaturalSingular(selection, s); + updateFields(); + setModified(true); +} + + +void TenseEntryPage::thirdNPluralChanged(const QString& s) +{ + conjugations.setPers3NaturalPlural (selection, s); + updateFields(); + setModified(true); +} + + +void TenseEntryPage::thirdMPluralChanged(const QString& s) +{ + conjugations.setPers3MalePlural (selection, s); + updateFields(); + setModified(true); +} + + +void TenseEntryPage::slotTenseSelected(int sel) +{ + if (multi_mode) + { + b_next->setEnabled(false); + third_s_common->setEnabled(false); + third_p_common->setEnabled(false); + first_plural->setEnabled(false); + first_singular->setEnabled(false); + second_singular->setEnabled(false); + second_plural->setEnabled(false); + thirdF_plural->setEnabled(false); + thirdF_singular->setEnabled(false); + thirdM_singular->setEnabled(false); + thirdN_singular->setEnabled(false); + thirdN_plural->setEnabled(false); + thirdM_plural->setEnabled(false); + } + else + { + selection = Conjugation::getAbbrev(sel); + first_plural->setText (conjugations.pers1Plural (selection )); + first_singular->setText (conjugations.pers1Singular (selection )); + second_plural->setText (conjugations.pers2Plural (selection )); + second_singular->setText (conjugations.pers2Singular (selection )); + thirdF_plural->setText (conjugations.pers3FemalePlural (selection )); + thirdF_singular->setText (conjugations.pers3FemaleSingular (selection )); + thirdM_plural->setText (conjugations.pers3MalePlural (selection)); + thirdM_singular->setText (conjugations.pers3MaleSingular (selection )); + thirdN_plural->setText (conjugations.pers3NaturalPlural (selection)); + thirdN_singular->setText (conjugations.pers3NaturalSingular (selection )); + + bool common = conjugations.pers3SingularCommon(selection); + third_s_common->setChecked(common); + thirdM_singular->setEnabled(!common); + thirdN_singular->setEnabled(!common); + + common = conjugations.pers3PluralCommon(selection); + third_p_common->setChecked(common); + thirdN_plural->setEnabled(!common); + thirdM_plural->setEnabled(!common); + } +} + + +void TenseEntryPage::slotThirdSCommonToggled(bool common) +{ + conjugations.setPers3SingularCommon(selection, common); + thirdM_singular->setEnabled(!common); + thirdN_singular->setEnabled(!common); + setModified(true); +} + + +void TenseEntryPage::slotThirdPCommonToggled(bool common) +{ + conjugations.setPers3PluralCommon(selection, common); + thirdN_plural->setEnabled(!common); + thirdM_plural->setEnabled(!common); + setModified(true); +} + + +void TenseEntryPage::slotNextConj() +{ + int j; + for (int i = tensebox->currentItem()+1; i < tensebox->count(); i++) { + + for (j = 0; j < conjugations.numEntries(); j++ ) { + if (Conjugation::getAbbrev(i) == conjugations.getType(j)) { + tensebox->setCurrentItem (i); + slotTenseSelected(i); + return; + } + } + } + + for (int i = 0; i < tensebox->currentItem()-1; i++) { + for (j = 0; j < conjugations.numEntries(); j++ ) { + if (Conjugation::getAbbrev(i) == conjugations.getType(j)) { + tensebox->setCurrentItem (i); + slotTenseSelected(i); + return; + } + } + } +} + + +Conjugation TenseEntryPage::getConjugation() +{ + conjugations.cleanUp(); + return conjugations; +} + + +void TenseEntryPage::updateFields() +{ + b_next->setEnabled(conjugations.numEntries() > 1); // next button +} + + +bool TenseEntryPage::isModified() +{ + return modified; +} + + +void TenseEntryPage::setEnabled(int enable) +{ + bool ena = enable == EntryDlg::EnableAll; + + b_next->setEnabled(ena); + tensebox->setEnabled(ena); + third_s_common->setEnabled(ena); + third_p_common->setEnabled(ena); + first_plural->setEnabled(ena); + first_singular->setEnabled(ena); + second_singular->setEnabled(ena); + second_plural->setEnabled(ena); + thirdF_plural->setEnabled(ena); + thirdF_singular->setEnabled(ena); + thirdM_singular->setEnabled(ena); + thirdN_singular->setEnabled(ena); + thirdN_plural->setEnabled(ena); + thirdM_plural->setEnabled(ena); +} + + +void TenseEntryPage::setModified(bool mod) +{ + modified = mod; + if (mod) + emit sigModified(); +} + +#include "TenseEntryPage.moc" diff --git a/kvoctrain/kvoctrain/entry-dialogs/TenseEntryPage.h b/kvoctrain/kvoctrain/entry-dialogs/TenseEntryPage.h new file mode 100644 index 00000000..5c118e8d --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/TenseEntryPage.h @@ -0,0 +1,89 @@ +/*************************************************************************** + + tenses of irreg. verbs dialog page + + ----------------------------------------------------------------------- + + begin : Sat Nov 27 20:20:34 1999 + + copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> + (C) 2001 The KDE-EDU team + (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net> + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef TenseEntryPage_included +#define TenseEntryPage_included + +#include "TenseEntryPageForm.h" + +#include <grammarmanager.h> + +class EntryDlg; + +class TenseEntryPage : public TenseEntryPageForm +{ + Q_OBJECT + +public: + TenseEntryPage + ( + EntryDlg *dlgbook, + bool multi_sel, + const Conjugation &con_prefix, + const Conjugation &conjugations, + QWidget *parent = NULL, + const char *name = NULL + ); + + void setData(bool multi_sel, const Conjugation &conjugations); + + Conjugation getConjugation(); + + bool isModified(); + void setModified(bool mod = true); + void setEnabled(int enable_type); + +signals: + void sigModified(); + +protected: + void updateFields(); + +protected slots: + void secondPluralChanged(const QString&); + void secondSingularChanged(const QString&); + void thirdNSingularChanged(const QString&); + void thirdFPluralChanged(const QString&); + void thirdMSingularChanged(const QString&); + void thirdFSingularChanged(const QString&); + void slotTenseSelected(int); + void thirdMPluralChanged(const QString&); + void thirdNPluralChanged(const QString&); + void firstSingularChanged(const QString&); + void firstPluralChanged(const QString&); + void slotThirdSCommonToggled(bool); + void slotThirdPCommonToggled(bool); + void slotNextConj(); + +protected: + Conjugation prefix, + conjugations; + QString selection; + bool multi_mode; + bool modified; + EntryDlg *dlgbook; +}; + +#endif // TenseEntryPage_included diff --git a/kvoctrain/kvoctrain/entry-dialogs/TenseEntryPageForm.ui b/kvoctrain/kvoctrain/entry-dialogs/TenseEntryPageForm.ui new file mode 100644 index 00000000..1c3c4ee5 --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/TenseEntryPageForm.ui @@ -0,0 +1,387 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>TenseEntryPageForm</class> +<widget class="QWidget"> + <property name="name"> + <cstring>TenseEntryPageForm</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>546</width> + <height>270</height> + </rect> + </property> + <property name="caption"> + <string>-</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>GroupBox8</cstring> + </property> + <property name="title"> + <string>Conjugation of Verbs</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit" row="6" column="2"> + <property name="name"> + <cstring>thirdN_plural</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QCheckBox" row="3" column="2"> + <property name="name"> + <cstring>third_p_common</cstring> + </property> + <property name="text"> + <string>C&ommon</string> + </property> + </widget> + <widget class="QLineEdit" row="2" column="2"> + <property name="name"> + <cstring>second_plural</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLineEdit" row="5" column="2"> + <property name="name"> + <cstring>thirdM_plural</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QCheckBox" row="3" column="1"> + <property name="name"> + <cstring>third_s_common</cstring> + </property> + <property name="text"> + <string>&Common</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>pers1_label</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&1. Person:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>first_singular</cstring> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>female_label</cstring> + </property> + <property name="text"> + <string>&Female:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>thirdF_singular</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="1"> + <property name="name"> + <cstring>TextLabel4_2_2</cstring> + </property> + <property name="text"> + <string>Singular</string> + </property> + </widget> + <widget class="QLineEdit" row="4" column="2"> + <property name="name"> + <cstring>thirdF_plural</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLineEdit" row="4" column="1"> + <property name="name"> + <cstring>thirdF_singular</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>pers3_label</cstring> + </property> + <property name="text"> + <string>&3. Person:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>third_s_common</cstring> + </property> + </widget> + <widget class="QLineEdit" row="1" column="2"> + <property name="name"> + <cstring>first_plural</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLineEdit" row="5" column="1"> + <property name="name"> + <cstring>thirdM_singular</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLineEdit" row="1" column="1"> + <property name="name"> + <cstring>first_singular</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <spacer row="0" column="0"> + <property name="name"> + <cstring>Spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>80</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLineEdit" row="6" column="1"> + <property name="name"> + <cstring>thirdN_singular</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLabel" row="6" column="0"> + <property name="name"> + <cstring>natural_label</cstring> + </property> + <property name="text"> + <string>&Neutral:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>thirdN_singular</cstring> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>male_label</cstring> + </property> + <property name="text"> + <string>&Male:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>thirdM_singular</cstring> + </property> + </widget> + <widget class="QLineEdit" row="2" column="1"> + <property name="name"> + <cstring>second_singular</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>pers2_label</cstring> + </property> + <property name="text"> + <string>&2. Person:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>second_singular</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="2"> + <property name="name"> + <cstring>TextLabel4_2</cstring> + </property> + <property name="text"> + <string>Plural</string> + </property> + </widget> + </grid> + </widget> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout5</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>tenselabel</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Tense:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>tensebox</cstring> + </property> + </widget> + <widget class="QPushButton" row="0" column="2"> + <property name="name"> + <cstring>b_next</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Ne&xt</string> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <property name="name"> + <cstring>tensebox</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + </grid> +</widget> +<tabstops> + <tabstop>tensebox</tabstop> + <tabstop>b_next</tabstop> + <tabstop>first_singular</tabstop> + <tabstop>second_singular</tabstop> + <tabstop>first_plural</tabstop> + <tabstop>second_plural</tabstop> + <tabstop>third_s_common</tabstop> + <tabstop>thirdF_singular</tabstop> + <tabstop>thirdM_singular</tabstop> + <tabstop>thirdN_singular</tabstop> + <tabstop>third_p_common</tabstop> + <tabstop>thirdF_plural</tabstop> + <tabstop>thirdM_plural</tabstop> + <tabstop>thirdN_plural</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kvoctrain/kvoctrain/entry-dialogs/blockall.cpp b/kvoctrain/kvoctrain/entry-dialogs/blockall.cpp new file mode 100644 index 00000000..879acd8d --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/blockall.cpp @@ -0,0 +1,38 @@ +/*************************************************************************** + + dummy validator which blocks all + + ----------------------------------------------------------------------- + + begin : Sat Mar 25 15:02:16 1999 + + copyright : (C) 1999-2001 Ewald Arnold + (C) 2001 The KDE-EDU team + email : kvoctrain@ewald-arnold.de + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "blockall.h" + +BlockAllValidator::BlockAllValidator() : QValidator (0, 0) +{ +} + + +BlockAllValidator::State BlockAllValidator::validate (QString&, int& ) const +{ + return Invalid; +} + + diff --git a/kvoctrain/kvoctrain/entry-dialogs/blockall.h b/kvoctrain/kvoctrain/entry-dialogs/blockall.h new file mode 100644 index 00000000..96b115be --- /dev/null +++ b/kvoctrain/kvoctrain/entry-dialogs/blockall.h @@ -0,0 +1,38 @@ +/*************************************************************************** + + dummy validator which blocks all + + ----------------------------------------------------------------------- + + begin : Sat Mar 25 15:02:16 1999 + + copyright : (C) 1999-2001 Ewald Arnold + (C) 2001 The KDE-EDU team + email : kvoctrain@ewald-arnold.de + + ----------------------------------------------------------------------- + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef BlockAll_included +#define BlockAll_included + +#include <qvalidator.h> + +class BlockAllValidator : public QValidator +{ +public: + BlockAllValidator (); + State validate (QString&, int& ) const; +}; + +#endif // BlockAll_included |