[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/ktouch/src
From: Anne-Marie Mahfouf <annma () kde ! org>
Date: 2010-01-07 16:20:01
Message-ID: 1262881201.366397.3327.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1071147 by annma:
indent consistently
M +103 -103 ktouchcoloreditordialog.cpp
--- trunk/KDE/kdeedu/ktouch/src/ktouchcoloreditordialog.cpp #1071146:1071147
@@ -25,11 +25,11 @@
KTouchColorEditorDialog::KTouchColorEditorDialog(QWidget* parent)
: QDialog(parent)
{
- setupUi(this);
- connect(addBtn,SIGNAL(clicked()),SLOT(addBtnClicked()));
- connect(removeBtn,SIGNAL(clicked()),SLOT(removeBtnClicked()));
- connect(schemeListWidget,SIGNAL(itemClicked(QListWidgetItem*)),SLOT(colorSchemeChanged(QListWidgetItem*)));
- connect(updateBtn,SIGNAL(clicked()),SLOT(updateClicked()));
+ setupUi(this);
+ connect(addBtn,SIGNAL(clicked()),SLOT(addBtnClicked()));
+ connect(removeBtn,SIGNAL(clicked()),SLOT(removeBtnClicked()));
+ connect(schemeListWidget,SIGNAL(itemClicked(QListWidgetItem*)),SLOT(colorSchemeChanged(QListWidgetItem*)));
+ connect(updateBtn,SIGNAL(clicked()),SLOT(updateClicked()));
}
// ----------------------------------------------------------------------------
@@ -39,58 +39,58 @@
// ----------------------------------------------------------------------------
void KTouchColorEditorDialog::startEditor(QList<KTouchColorScheme>& schemes, int \
active, int & selected) {
- m_schemes = schemes;
- m_currentItem = qMax(0, active);
- updateListWidget();
+ m_schemes = schemes;
+ m_currentItem = qMax(0, active);
+ updateListWidget();
- if (active >= 0) m_currentItem = active;
- else m_currentItem = -1;
+ if (active >= 0) m_currentItem = active;
+ else m_currentItem = -1;
- exec();
+ exec();
- if (m_saveChanges) {
- selected = m_currentItem;
- schemes = m_schemes;
- }
- else {
- selected = active;
- }
+ if (m_saveChanges) {
+ selected = m_currentItem;
+ schemes = m_schemes;
+ }
+ else {
+ selected = active;
+ }
}
// ----------------------------------------------------------------------------
void KTouchColorEditorDialog::colorSchemeChanged(QListWidgetItem *) {
-// kdDebug() << "[KTouchColorEditor::colorSchemeChanged]" << endl;
+ //kdDebug() << "[KTouchColorEditor::colorSchemeChanged]" << endl;
int num = schemeListWidget->currentRow();
- if (num < 0 || num >= static_cast<int>(m_schemes.count())) {
- updateControls(NULL);
- return;
- }
- QList<KTouchColorScheme>::const_iterator it = m_schemes.constBegin();
- while (--num >= 0) ++it;
- updateControls(&(*it));
+ if (num < 0 || num >= static_cast<int>(m_schemes.count())) {
+ updateControls(NULL);
+ return;
+ }
+ QList<KTouchColorScheme>::const_iterator it = m_schemes.constBegin();
+ while (--num >= 0) ++it;
+ updateControls(&(*it));
}
// ----------------------------------------------------------------------------
void KTouchColorEditorDialog::updateClicked() {
- // first check that we have a valid color scheme selected
+ // first check that we have a valid color scheme selected
int num = schemeListWidget->currentRow();
- int old_num = num;
- if (num < 0 || num >= static_cast<int>(m_schemes.count())) {
- updateListWidget();
- return;
- }
- QList<KTouchColorScheme>::iterator it = m_schemes.begin();
- while (--num >= 0) ++it;
- (*it).m_name = nameEdit->text();
- if ((*it).m_name.isEmpty())
- (*it).m_name = i18n("New color scheme");
- // slide line colors
- (*it).m_teacherTextColor = teacherTextBtn->color();
- (*it).m_teacherBackground = teacherBackBtn->color();
- (*it).m_studentTextColor = studentTextBtn->color();
- (*it).m_studentBackground = studentBackBtn->color();
- (*it).m_errorTextColor = studentErrorTextBtn->color();
- (*it).m_errorBackground = studentErrorBackBtn->color();
+ int old_num = num;
+ if (num < 0 || num >= static_cast<int>(m_schemes.count())) {
+ updateListWidget();
+ return;
+ }
+ QList<KTouchColorScheme>::iterator it = m_schemes.begin();
+ while (--num >= 0) ++it;
+ (*it).m_name = nameEdit->text();
+ if ((*it).m_name.isEmpty())
+ (*it).m_name = i18n("New color scheme");
+ // slide line colors
+ (*it).m_teacherTextColor = teacherTextBtn->color();
+ (*it).m_teacherBackground = teacherBackBtn->color();
+ (*it).m_studentTextColor = studentTextBtn->color();
+ (*it).m_studentBackground = studentBackBtn->color();
+ (*it).m_errorTextColor = studentErrorTextBtn->color();
+ (*it).m_errorBackground = studentErrorBackBtn->color();
// keyboard colors
(*it).m_frame = keyFrameBtn->color();
(*it).m_text = keyTextBtn->color();
@@ -110,88 +110,88 @@
(*it).m_background[6] = back7Btn->color();
(*it).m_background[7] = back8Btn->color();
- updateListWidget();
- schemeListWidget->setCurrentRow( qMin(old_num, \
static_cast<int>(m_schemes.count())-1) );
- colorSchemeChanged(NULL);
+ updateListWidget();
+ schemeListWidget->setCurrentRow( qMin(old_num, \
static_cast<int>(m_schemes.count())-1) ); + colorSchemeChanged(NULL);
}
// ----------------------------------------------------------------------------
void KTouchColorEditorDialog::removeBtnClicked() {
int num = schemeListWidget->currentRow();
- int old_num = num;
- if (num >=0 && num < static_cast<int>(m_schemes.count())) {
- QList<KTouchColorScheme>::iterator it = m_schemes.begin();
- while (--num >= 0) ++it;
- m_schemes.erase(it);
- }
- updateListWidget();
- schemeListWidget->setCurrentRow( qMin(old_num, \
static_cast<int>(m_schemes.count())-1) );
- colorSchemeChanged(NULL);
+ int old_num = num;
+ if (num >=0 && num < static_cast<int>(m_schemes.count())) {
+ QList<KTouchColorScheme>::iterator it = m_schemes.begin();
+ while (--num >= 0) ++it;
+ m_schemes.erase(it);
+ }
+ updateListWidget();
+ schemeListWidget->setCurrentRow( qMin(old_num, \
static_cast<int>(m_schemes.count())-1) ); + colorSchemeChanged(NULL);
}
// ----------------------------------------------------------------------------
void KTouchColorEditorDialog::addBtnClicked() {
- KTouchColorScheme s;
- s.m_name = i18n("New color scheme");
- m_schemes.append(s);
- updateListWidget();
- schemeListWidget->setCurrentRow( m_schemes.count() - 1 );
- colorSchemeChanged(NULL);
+ KTouchColorScheme s;
+ s.m_name = i18n("New color scheme");
+ m_schemes.append(s);
+ updateListWidget();
+ schemeListWidget->setCurrentRow( m_schemes.count() - 1 );
+ colorSchemeChanged(NULL);
}
// ----------------------------------------------------------------------------
void KTouchColorEditorDialog::closeEvent( QCloseEvent* ce ) {
- int result = KMessageBox::questionYesNoCancel(this,
- i18n("Save modified color schemes?"));
- switch (result) {
- case KMessageBox::Cancel : m_saveChanges = false; ce->ignore(); return;
- case KMessageBox::Yes :
- m_currentItem = schemeListWidget->currentRow();
- updateClicked();
- m_saveChanges = true; break;
- default : m_saveChanges = false; break;
- }
- ce->accept();
+ int result = KMessageBox::questionYesNoCancel(this,
+ i18n("Save modified color schemes?"));
+ switch (result) {
+ case KMessageBox::Cancel : m_saveChanges = false; ce->ignore(); return;
+ case KMessageBox::Yes :
+ m_currentItem = schemeListWidget->currentRow();
+ updateClicked();
+ m_saveChanges = true; break;
+ default : m_saveChanges = false; break;
+ }
+ ce->accept();
}
// ----------------------------------------------------------------------------
void KTouchColorEditorDialog::updateListWidget() {
// kdDebug() << "[KTouchColorEditor::updateListBox]" << endl;
- schemeListWidget->clear();
- for (QList<KTouchColorScheme>::const_iterator it = m_schemes.constBegin();
- it != m_schemes.constEnd(); ++it)
- {
- schemeListWidget->addItem( (*it).m_name );
- }
- if (m_schemes.isEmpty()) {
- editGroupBox->setEnabled(false);
- removeBtn->setEnabled(false);
- }
- else {
- editGroupBox->setEnabled(true);
- removeBtn->setEnabled(true);
- // select the first one by default
- }
+ schemeListWidget->clear();
+ for (QList<KTouchColorScheme>::const_iterator it = m_schemes.constBegin();
+ it != m_schemes.constEnd(); ++it)
+ {
+ schemeListWidget->addItem( (*it).m_name );
+ }
+ if (m_schemes.isEmpty()) {
+ editGroupBox->setEnabled(false);
+ removeBtn->setEnabled(false);
+ }
+ else {
+ editGroupBox->setEnabled(true);
+ removeBtn->setEnabled(true);
+ // select the first one by default
+ }
}
// ----------------------------------------------------------------------------
void KTouchColorEditorDialog::updateControls(const KTouchColorScheme * cs) {
// kdDebug() << "[KTouchColorEditor::updateControls]" << endl;
- if (cs==NULL) {
- // TODO : also set all colors back to defaults
- editGroupBox->setEnabled(false);
- return;
- }
- editGroupBox->setEnabled(true);
- nameEdit->setText(cs->m_name);
- // slide line colors
- teacherTextBtn->setColor(cs->m_teacherTextColor);
- teacherBackBtn->setColor(cs->m_teacherBackground);
- studentTextBtn->setColor(cs->m_studentTextColor);
- studentBackBtn->setColor(cs->m_studentBackground);
- studentErrorTextBtn->setColor(cs->m_errorTextColor);
- studentErrorBackBtn->setColor(cs->m_errorBackground);
- // keyboard colors
+ if (cs==NULL) {
+ // TODO : also set all colors back to defaults
+ editGroupBox->setEnabled(false);
+ return;
+ }
+ editGroupBox->setEnabled(true);
+ nameEdit->setText(cs->m_name);
+ // slide line colors
+ teacherTextBtn->setColor(cs->m_teacherTextColor);
+ teacherBackBtn->setColor(cs->m_teacherBackground);
+ studentTextBtn->setColor(cs->m_studentTextColor);
+ studentBackBtn->setColor(cs->m_studentBackground);
+ studentErrorTextBtn->setColor(cs->m_errorTextColor);
+ studentErrorBackBtn->setColor(cs->m_errorBackground);
+ // keyboard colors
keyFrameBtn->setColor(cs->m_frame);
keyTextBtn->setColor(cs->m_text);
keyTextHighBtn->setColor(cs->m_textH);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic