implements: Change the behaviour of the "Display idle players" sorting

menu #112
This commit is contained in:
doitux
2012-02-04 00:11:19 +00:00
parent 59be0ff560
commit b3239ee0cc
7 changed files with 81 additions and 54 deletions
+5 -1
View File
@@ -708,7 +708,11 @@
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTextBrowser" name="textBrowser_ChatDisplay"/>
<widget class="QTextBrowser" name="textBrowser_ChatDisplay">
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="lineEdit_ChatInput"/>
@@ -32,7 +32,7 @@ using namespace std;
gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
: QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), currentGameName(""), myPlayerId(0), isGameAdministrator(false), inGame(false), guestMode(false), blinkingButtonAnimationState(true), myChat(NULL), keyUpCounter(0), infoMsgToShowId(0), currentInvitationGameId(0), inviteDialogIsCurrentlyShown(false), autoStartTimerCounter(0)
: QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), currentGameName(""), myPlayerId(0), isGameAdministrator(false), inGame(false), guestMode(false), blinkingButtonAnimationState(true), myChat(NULL), keyUpCounter(0), infoMsgToShowId(0), currentInvitationGameId(0), inviteDialogIsCurrentlyShown(false), autoStartTimerCounter(0), lastNickListFilterState(0)
{
#ifdef __APPLE__
@@ -1495,12 +1495,22 @@ void gameLobbyDialogImpl::changeGameListFilter(int index)
void gameLobbyDialogImpl::changeNickListFilter(int state)
{
if(lastNickListFilterState == 0) {
myNickListSortFilterProxyModel->setLastFilterStateCountry(false);
myNickListSortFilterProxyModel->setLastFilterStateAlpha(true);
}
else if(lastNickListFilterState == 1) {
myNickListSortFilterProxyModel->setLastFilterStateCountry(true);
myNickListSortFilterProxyModel->setLastFilterStateAlpha(false);
}
myNickListSortFilterProxyModel->setFilterState(state);
myNickListModel->sort(0, Qt::DescendingOrder);
myNickListSortFilterProxyModel->setFilterRegExp(QString());
myNickListSortFilterProxyModel->setFilterKeyColumn(0);
lastNickListFilterState = state;
writeDialogSettings(2);
}
@@ -198,6 +198,7 @@ private:
QLabel *autoStartTimerOverlay;
int autoStartTimerCounter;
int lastNickListFilterState;
protected:
bool eventFilter(QObject *obj, QEvent *event);
@@ -63,8 +63,15 @@ bool MyNickListSortFilterProxyModel::lessThan(const QModelIndex &left, const QMo
}
break;
case 2: {
if(lastFilterStateCountry) {
QString leftCountryAndName(sourceModel()->data(left, 33).toString().toUpper()+sourceModel()->data(left, Qt::DisplayRole).toString().toLower());
QString rightCountryAndName(sourceModel()->data(right, 33).toString().toUpper()+sourceModel()->data(right, Qt::DisplayRole).toString().toLower());
return leftCountryAndName < rightCountryAndName;
}
else if(lastFilterStateAlpha) {
return QSortFilterProxyModel::lessThan(left, right);
}
}
break;
}
@@ -28,6 +28,8 @@ public:
MyNickListSortFilterProxyModel(QObject *parent = 0);
void setFilterState(int state);
void setLastFilterStateCountry( bool country ) { lastFilterStateCountry = country;}
void setLastFilterStateAlpha( bool alpha ) { lastFilterStateAlpha = alpha;}
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
@@ -36,7 +38,8 @@ protected:
private:
int filterState;
bool lastFilterStateCountry;
bool lastFilterStateAlpha;
};
+3
View File
@@ -3635,6 +3635,9 @@ p, li { white-space: pre-wrap; }
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
-1
View File
@@ -42,7 +42,6 @@ MyAvatarLabel::MyAvatarLabel(QGroupBox* parent)
action_ReportBadAvatar = new QAction(QIcon(":/gfx/emblem-important.png"), tr("Report inappropriate avatar"), myContextMenu);
myContextMenu->addAction(action_ReportBadAvatar);
connect( action_VoteForKick, SIGNAL ( triggered() ), this, SLOT ( sendTriggerVoteOnKickSignal() ) );
connect( action_IgnorePlayer, SIGNAL ( triggered() ), this, SLOT ( putPlayerOnIgnoreList() ) );
connect( action_ReportBadAvatar, SIGNAL ( triggered() ), this, SLOT ( reportBadAvatar() ) );