[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/parley/src/practice
From: Frederik Gladhorn <frederik.gladhorn () gmx ! de>
Date: 2007-09-30 20:42:07
Message-ID: 1191184927.578564.9031.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 719295 by gladhorn:
only show hints when they are available. readabilty++. rename remark to comment.
M +39 -28 writtenpracticedialog.cpp
M +3 -3 writtenpracticedialog.h
M +104 -87 writtenpracticedialog.ui
--- trunk/KDE/kdeedu/parley/src/practice/writtenpracticedialog.cpp #719294:719295
@@ -59,9 +59,9 @@
connect(mw->stopPracticeButton, SIGNAL(clicked()), SLOT(close()));
connect(mw->editEntryButton, SIGNAL(clicked()), SLOT(editEntry()));
- connect(mw->c_type, SIGNAL(clicked()), SLOT(slotTypeClicked()));
- connect(mw->c_remark, SIGNAL(clicked()), SLOT(slotRemClicked()));
- connect(mw->c_falsefriend, SIGNAL(clicked()), SLOT(slotFFClicked()));
+ connect(mw->typeCheckBox, SIGNAL(toggled(bool)), SLOT(slotTypeClicked(bool)));
+ connect(mw->commentCheckBox, SIGNAL(toggled(bool)), SLOT(slotRemClicked(bool)));
+ connect(mw->falsefriendCheckBox, SIGNAL(toggled(bool)), \
SLOT(slotFFClicked(bool))); connect(mw->dont_know, SIGNAL(clicked()), \
SLOT(skipUnknown())); connect(mw->know_it, SIGNAL(clicked()), SLOT(skipKnown()));
connect(mw->verify, SIGNAL(clicked()), SLOT(verifyClicked()));
@@ -210,13 +210,13 @@
mw->progCount->setText( QString::number(entry->statisticCount()) );
- mw->remark->hide();
- mw->falseFriend->hide();
- mw->type->hide();
+ mw->commentLabel->hide();
+ mw->falseFriendLabel->hide();
+ mw->typeLabel->hide();
- mw->c_remark->setChecked(false);
- mw->c_falsefriend->setChecked(false);
- mw->c_type->setChecked(false);
+ mw->commentCheckBox->setChecked(false);
+ mw->falsefriendCheckBox->setChecked(false);
+ mw->typeCheckBox->setChecked(false);
setHintFields();
mw->status->clear();
@@ -483,38 +483,49 @@
void WrittenPracticeDialog::setHintFields()
{
- QString s;
- KEduVocExpression* exp = m_entry->exp;
+ bool hasComment =
+ !m_entry->exp->translation(Prefs::fromIdentifier()).comment().isEmpty();
+ mw->commentLabel->setVisible(hasComment);
+ mw->commentCheckBox->setVisible(hasComment);
- s = exp->translation(Prefs::fromIdentifier()).comment();
- mw->remark->setText(s);
- mw->c_remark->setEnabled(!s.isEmpty());
+ bool hasFalseFriend = \
!m_entry->exp->translation(Prefs::fromIdentifier()).falseFriend(Prefs::toIdentifier()).isEmpty();
+ mw->falseFriendLabel->setVisible(hasFalseFriend);
+ mw->falsefriendCheckBox->setVisible(hasFalseFriend);
- s = exp->translation(Prefs::fromIdentifier()).falseFriend(Prefs::toIdentifier());
- mw->falseFriend->setText(s);
- mw->c_falsefriend->setEnabled(!s.isEmpty());
+ bool hasType = !m_entry->exp->translation(Prefs::fromIdentifier()).type().isEmpty();
+ mw->typeLabel->setVisible(hasType);
+ mw->typeCheckBox->setVisible(hasType);
- s = exp->translation(Prefs::fromIdentifier()).type();
- mw->type->setText(s);
- mw->c_type->setEnabled(!s.isEmpty());
+ // hide an empty hint box
+ mw->hintGroupBox->setVisible((hasComment||hasFalseFriend||hasType));
}
-void WrittenPracticeDialog::slotFFClicked()
+void WrittenPracticeDialog::slotFFClicked(bool show)
{
- mw->falseFriend->setVisible(mw->c_falsefriend->isChecked());
+ if ( show ) {
+ mw->falseFriendLabel->setText(m_entry->exp->translation(Prefs::fromIdentifier()).falseFriend(Prefs::toIdentifier()));
+ } else {
+ mw->falseFriendLabel->setText(QString());
+ }
}
-
-void WrittenPracticeDialog::slotRemClicked()
+void WrittenPracticeDialog::slotRemClicked(bool show)
{
- mw->remark->setVisible(mw->c_remark->isChecked());
+ if ( show ) {
+ mw->commentLabel->setText(m_entry->exp->translation(Prefs::fromIdentifier()).comment());
+ } else {
+ mw->commentLabel->setText(QString());
+ }
}
-
-void WrittenPracticeDialog::slotTypeClicked()
+void WrittenPracticeDialog::slotTypeClicked(bool show)
{
- mw->type->setVisible(mw->c_type->isChecked());
+ if ( show ) {
+ mw->typeLabel->setText(m_entry->exp->translation(Prefs::fromIdentifier()).type());
+ } else {
+ mw->typeLabel->setText(QString());
+ }
}
--- trunk/KDE/kdeedu/parley/src/practice/writtenpracticedialog.h #719294:719295
@@ -57,9 +57,9 @@
void dontKnowClicked();
void slotTransChanged(const QString&);
void slotTransLostFocus();
- void slotFFClicked();
- void slotTypeClicked();
- void slotRemClicked();
+ void slotFFClicked(bool show);
+ void slotTypeClicked(bool show);
+ void slotRemClicked(bool show);
private:
void setStatusText(const QString &statusText) { mw->status->setText(statusText); \
}
--- trunk/KDE/kdeedu/parley/src/practice/writtenpracticedialog.ui #719294:719295
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>697</width>
- <height>422</height>
+ <height>435</height>
</rect>
</property>
<property name="sizePolicy" >
@@ -255,92 +255,109 @@
<item>
<layout class="QHBoxLayout" >
<item>
- <widget class="QGroupBox" name="hintGroupBox" >
- <property name="minimumSize" >
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="title" >
- <string>Hints</string>
- </property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QCheckBox" name="c_falsefriend" >
- <property name="text" >
- <string>&False friend:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QLabel" name="falseFriend" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>-</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QCheckBox" name="c_remark" >
- <property name="text" >
- <string>&Comment:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QLabel" name="remark" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>-</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QCheckBox" name="c_type" >
- <property name="text" >
- <string>T&ype:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1" >
- <widget class="QLabel" name="type" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>-</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>40</width>
- <height>0</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QGroupBox" name="hintGroupBox" >
+ <property name="minimumSize" >
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="title" >
+ <string>Hints</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QCheckBox" name="falsefriendCheckBox" >
+ <property name="text" >
+ <string>&False friend:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLabel" name="falseFriendLabel" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QCheckBox" name="commentCheckBox" >
+ <property name="text" >
+ <string>&Comment:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLabel" name="commentLabel" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QCheckBox" name="typeCheckBox" >
+ <property name="text" >
+ <string>T&ype:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QLabel" name="typeLabel" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
</item>
<item>
<widget class="QGroupBox" name="progressgroup" >
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic