From 85e9b281149209adc9c28e19128432e0f59302f2 Mon Sep 17 00:00:00 2001 From: Willem Liu Date: Tue, 28 Sep 2010 18:52:26 +0200 Subject: [PATCH] Alphabetical sorting now ignores case. Checked items now have grey text instead of white and are striked through. --- debian/changelog | 7 +++---- easylist.pro.user | 22 +++++++++++----------- src/mycheckbox.cpp | 24 ++++++++++++++++++++++++ src/mycheckbox.h | 4 ++++ src/mycheckboxcontainer.cpp | 22 +++++++++++++++++++--- 5 files changed, 61 insertions(+), 18 deletions(-) diff --git a/debian/changelog b/debian/changelog index d132f6b..feac10f 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,6 @@ -easylist (0.3.9) unstable; urgency=low +easylist (0.3.10) unstable; urgency=low - * Alphabetical sorting now possible. - * Label "Checked bottom" changed to "Checked to bottom". - * Automatic display orientation detection now possible. + * Alphabetical sorting now ignores case. + * Checked items now have grey text instead of white and are striked through. -- Willem Liu Tue, 07 Sep 2010 13:56:12 +0200 diff --git a/easylist.pro.user b/easylist.pro.user index 7ad3617..a5f26a6 100755 --- a/easylist.pro.user +++ b/easylist.pro.user @@ -46,10 +46,10 @@ Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - C:/dev/cpp/easylist-0.3.9-build-desktop + C:/dev/cpp/easylist-0.3.10-build-desktop 20 2 - false + true @@ -80,7 +80,7 @@ Release Qt4ProjectManager.Qt4BuildConfiguration 0 - C:/dev/cpp/easylist-0.3.9-build-desktop + C:/dev/cpp/easylist-0.3.10-build-desktop 20 2 true @@ -148,7 +148,7 @@ Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - C:/dev/cpp/easylist-0.3.9 + C:/dev/cpp/easylist-0.3.10 27 9 false @@ -171,11 +171,11 @@ Qt4ProjectManager.MaemoPackageCreationStep - C:/dev/cpp/easylist-0.3.9/src/easylist.desktop - C:/dev/cpp/easylist-0.3.9/src/data/26x26/easylist.png - C:/dev/cpp/easylist-0.3.9/src/data/40x40/easylist.png - C:/dev/cpp/easylist-0.3.9/src/data/48x48/easylist.png - C:/dev/cpp/easylist-0.3.9/src/data/64x64/easylist.png + C:/dev/cpp/easylist-0.3.10/src/easylist.desktop + C:/dev/cpp/easylist-0.3.10/src/data/26x26/easylist.png + C:/dev/cpp/easylist-0.3.10/src/data/40x40/easylist.png + C:/dev/cpp/easylist-0.3.10/src/data/48x48/easylist.png + C:/dev/cpp/easylist-0.3.10/src/data/64x64/easylist.png false /opt/easylist/bin/easylist @@ -186,7 +186,7 @@ /usr/share/icons/hicolor/48x48/apps/easylist.png /usr/share/icons/hicolor/64x64/apps/easylist.png - 0.3.9 + 0.3.10 3 @@ -204,7 +204,7 @@ Release Qt4ProjectManager.Qt4BuildConfiguration 0 - C:/dev/cpp/easylist-0.3.9 + C:/dev/cpp/easylist-0.3.10 27 9 false diff --git a/src/mycheckbox.cpp b/src/mycheckbox.cpp index a71b303..303f73c 100755 --- a/src/mycheckbox.cpp +++ b/src/mycheckbox.cpp @@ -7,8 +7,12 @@ MyCheckBox::MyCheckBox(QWidget *parent) : { ++instances; qDebug() << "MyCheckBox instances:" << instances; + uncheckedColor = palette(); + checkedColor.setColor(QPalette::WindowText, Qt::gray); + setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenuActivated(QPoint))); + connect(this, SIGNAL(toggled(bool)), this, SLOT(slotTriggered(bool))); } MyCheckBox::MyCheckBox(const QString & text, QWidget *parent) : @@ -16,8 +20,13 @@ MyCheckBox::MyCheckBox(const QString & text, QWidget *parent) : { ++instances; qDebug() << "MyCheckBox instances:" << instances; + + uncheckedColor = palette(); + checkedColor.setColor(QPalette::WindowText, Qt::gray); + setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenuActivated(QPoint))); + connect(this, SIGNAL(toggled(bool)), this, SLOT(slotTriggered(bool))); } MyCheckBox::~MyCheckBox() @@ -39,3 +48,18 @@ void MyCheckBox::slotContextMenuActivated(QPoint point) menu.addAction(tr("Delete"), this, SLOT(slotDeleteClicked())); menu.exec(this->mapToGlobal(point)); } + +void MyCheckBox::slotTriggered(bool checked) +{ + if(checked) + { + setPalette(checkedColor); + } + else + { + setPalette(uncheckedColor); + } + QFont f(font()); + f.setStrikeOut(checked); + setFont(f); +} diff --git a/src/mycheckbox.h b/src/mycheckbox.h index cfdea07..6eac640 100755 --- a/src/mycheckbox.h +++ b/src/mycheckbox.h @@ -15,11 +15,15 @@ public: virtual ~MyCheckBox(); private: static int instances; + + QPalette checkedColor; + QPalette uncheckedColor; signals: void signalDeleteClicked(MyCheckBox * myCheckBox); public slots: void slotContextMenuActivated(QPoint point); void slotDeleteClicked(); + void slotTriggered(bool checked); }; #endif // MYCHECKBOX_H diff --git a/src/mycheckboxcontainer.cpp b/src/mycheckboxcontainer.cpp index edcab32..aaa719d 100755 --- a/src/mycheckboxcontainer.cpp +++ b/src/mycheckboxcontainer.cpp @@ -30,9 +30,25 @@ MyCheckBoxContainer * MyCheckBoxContainer::getInstance() void MyCheckBoxContainer::add(QString item) { QStringList list = item.split("\n"); + QStringList list2; if(sortAlphabetically) { - list.sort(); + int listSize = list.size(); + int pos = 0; + for(int i = 0; i < listSize; ++i) + { + int list2Size = list2.size(); + for(int j = 0; j < list2Size; ++j) + { + pos = j; + if(list[i].toUpper() > list2[j].toUpper()) + { + break; + } + } + list2.append(list[i]); + } + list = list2; } foreach(QString item, list) { @@ -89,7 +105,7 @@ void MyCheckBoxContainer::sortCheckedToBottom() int pos = 0; for(pos = 0; pos < size; ++pos) { - if(tempListChecked[pos]->text() > item->text()) + if(tempListChecked[pos]->text().toUpper() > item->text().toUpper()) { break; } @@ -109,7 +125,7 @@ void MyCheckBoxContainer::sortCheckedToBottom() int pos = 0; for(pos = 0; pos < size; ++pos) { - if(tempList[pos]->text() > item->text()) + if(tempList[pos]->text().toUpper() > item->text().toUpper()) { break; } -- 1.7.9.5