Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKissaki <kissaki@gmx.de>2013-06-30 14:32:46 +0400
committerKissaki <kissaki@gmx.de>2013-06-30 17:14:52 +0400
commitac65b31a2c03f8897e3127753ba32189d891cb45 (patch)
tree73329e37f96e32142abcb6e444cd6fe36d28cede /src
parentbf5927ee8d9cab50e0fec8e7f3747626fb71de4b (diff)
Banlist: PR commit adjustments
* Use localeAwareCompare for string username comparison * Code improvements * Textual changes
Diffstat (limited to 'src')
-rw-r--r--src/Net.cpp6
-rw-r--r--src/Net.h2
-rw-r--r--src/mumble/BanEditor.cpp14
-rw-r--r--src/mumble/BanEditor.h5
-rw-r--r--src/mumble/BanEditor.ui10
5 files changed, 21 insertions, 16 deletions
diff --git a/src/Net.cpp b/src/Net.cpp
index f5c48aa9c..c2ad25d82 100644
--- a/src/Net.cpp
+++ b/src/Net.cpp
@@ -166,10 +166,12 @@ bool Ban::isExpired() const {
}
bool Ban::operator <(const Ban &other) const {
- if (qsUsername == other.qsUsername)
+ // Compare username primarily and address secondarily
+ const int unameDifference = qsUsername.localeAwareCompare(other.qsUsername);
+ if (unameDifference == 0)
return haAddress < other.haAddress;
else
- return qsUsername.localeAwareCompare(other.qsUsername) < 0;
+ return unameDifference < 0;
}
bool Ban::operator ==(const Ban &other) const {
diff --git a/src/Net.h b/src/Net.h
index ecf11ccb5..636674da5 100644
--- a/src/Net.h
+++ b/src/Net.h
@@ -60,7 +60,7 @@ struct HostAddress {
bool operator < (const HostAddress &) const;
bool operator == (const HostAddress &) const;
- bool match(const HostAddress &, int) const;
+ bool match(const HostAddress &, int bits) const;
QString toString() const;
diff --git a/src/mumble/BanEditor.cpp b/src/mumble/BanEditor.cpp
index ec024781b..de8090614 100644
--- a/src/mumble/BanEditor.cpp
+++ b/src/mumble/BanEditor.cpp
@@ -37,7 +37,8 @@
#include "Net.h"
#include "ServerHandler.h"
-BanEditor::BanEditor(const MumbleProto::BanList &msg, QWidget *p) : QDialog(p) {
+BanEditor::BanEditor(const MumbleProto::BanList &msg, QWidget *p) : QDialog(p)
+ , maskDefaultValue(32) {
setupUi(this);
qlwBans->setFocus();
@@ -173,7 +174,7 @@ void BanEditor::on_qpbRemove_clicked() {
qleUser->clear();
qleIP->clear();
qleReason->clear();
- qsbMask->setValue(32);
+ qsbMask->setValue(maskDefaultValue);
qleHash->clear();
qdteStart->setDateTime(QDateTime::currentDateTime());
@@ -197,10 +198,10 @@ void BanEditor::refreshBanList() {
}
int n = qlBans.count();
- setWindowTitle(tr("Ban List - %n - Banned Users", "", n));
+ setWindowTitle(tr("Ban List - %n Ban(s)", "", n));
}
-void BanEditor::on_qleSearch_textChanged(QString )
+void BanEditor::on_qleSearch_textChanged(const QString & match)
{
qlwBans->clearSelection();
@@ -211,13 +212,12 @@ void BanEditor::on_qleSearch_textChanged(QString )
qleUser->clear();
qleIP->clear();
qleReason->clear();
- qsbMask->setValue(32);
+ qsbMask->setValue(maskDefaultValue);
qleHash->clear();
qdteStart->setDateTime(QDateTime::currentDateTime());
qdteEnd->setDateTime(QDateTime::currentDateTime());
- const QString &match = qleSearch->text();
foreach(QListWidgetItem *item, qlwBans->findItems(QString(), Qt::MatchContains)) {
if (!item->text().contains(match))
item->setHidden(true);
@@ -263,7 +263,7 @@ void BanEditor::on_qpbClear_clicked()
qleUser->clear();
qleIP->clear();
qleReason->clear();
- qsbMask->setValue(32);
+ qsbMask->setValue(maskDefaultValue);
qleHash->clear();
qdteStart->setDateTime(QDateTime::currentDateTime());
diff --git a/src/mumble/BanEditor.h b/src/mumble/BanEditor.h
index 5fcd98495..ae4d3a05e 100644
--- a/src/mumble/BanEditor.h
+++ b/src/mumble/BanEditor.h
@@ -45,6 +45,9 @@ class BanEditor : public QDialog, public Ui::BanEditor {
Q_DISABLE_COPY(BanEditor)
protected:
QList<Ban> qlBans;
+
+ int maskDefaultValue;
+
Ban toBan(bool &);
public:
BanEditor(const MumbleProto::BanList &msbl, QWidget *p = NULL);
@@ -59,7 +62,7 @@ class BanEditor : public QDialog, public Ui::BanEditor {
void on_qpbClear_clicked();
private slots:
void on_qleHash_textChanged(QString );
- void on_qleSearch_textChanged(QString );
+ void on_qleSearch_textChanged(const QString & match);
void on_qleReason_textChanged(QString );
void on_qleIP_textChanged(QString );
void on_qleUser_textChanged(QString );
diff --git a/src/mumble/BanEditor.ui b/src/mumble/BanEditor.ui
index 6c6913ea2..6bafb20de 100644
--- a/src/mumble/BanEditor.ui
+++ b/src/mumble/BanEditor.ui
@@ -41,7 +41,7 @@
<string>Search field</string>
</property>
<property name="whatsThis">
- <string>This is search field, use it to find users by simply typing user nickname.</string>
+ <string>This is the search field. Use it to find bans that have this username set in the username field.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@@ -198,7 +198,7 @@
<string>Ban end date</string>
</property>
<property name="whatsThis">
- <string>Ban end date. If you set the same date for start and end, ban will be permanent.</string>
+ <string>Ban end date. If you set the same date for start and end, the ban will be permanent (it will not expire).</string>
</property>
<property name="calendarPopup">
<bool>true</bool>
@@ -231,7 +231,7 @@
<string>Banned users</string>
</property>
<property name="whatsThis">
- <string>This is list with banned users.</string>
+ <string>This is a list with banned users.</string>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
@@ -279,7 +279,7 @@
<bool>false</bool>
</property>
<property name="whatsThis">
- <string>Use this button if you want to remove user from ban list.</string>
+ <string>Use this button if you want to remove user from the ban list.</string>
</property>
<property name="text">
<string>&amp;Remove</string>
@@ -292,7 +292,7 @@
<string>Clear all fields</string>
</property>
<property name="whatsThis">
- <string>This button clears all fields, use it if you want to add new ban.</string>
+ <string>This button clears all fields. Use it if you want to add a new ban.</string>
</property>
<property name="text">
<string>Clear</string>