Skip to content

Commit dd13ef8

Browse files
committed
more code cleanup, improved readability
1 parent 4bb473d commit dd13ef8

18 files changed

+93
-100
lines changed

src/huggle_ui/aboutform.cpp

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ AboutForm::AboutForm(QWidget *parent) : HW("aboutform", this, parent), ui(new Ui
3535
#if QT_VERSION >= 0x050400
3636
version_info += "\nSSL: " + QSslSocket::sslLibraryBuildVersionString();
3737
#endif
38-
this->ui->label_7->setText(version_info);
38+
this->ui->lblVersionInfo->setText(version_info);
3939
this->RestoreWindow();
4040
}
4141

@@ -49,47 +49,47 @@ void AboutForm::on_pushButton_clicked()
4949
this->close();
5050
}
5151

52-
void AboutForm::on_label_8_linkActivated(const QString &link)
52+
void AboutForm::on_lblAuthorsDave_linkActivated(const QString &link)
5353
{
5454
QDesktopServices::openUrl(link);
5555
}
5656

57-
void AboutForm::on_label_5_linkActivated(const QString &link)
57+
void AboutForm::on_lblAuthorsPetrb_linkActivated(const QString &link)
5858
{
5959
QDesktopServices::openUrl(link);
6060
}
6161

62-
void AboutForm::on_label_3_linkActivated(const QString &link)
62+
void AboutForm::on_lblAuthorsAddshore_linkActivated(const QString &link)
6363
{
6464
QDesktopServices::openUrl(link);
6565
}
6666

67-
void Huggle::AboutForm::on_label_4_linkActivated(const QString &link)
67+
void AboutForm::on_lblAuthorsOriginalGurch_linkActivated(const QString &link)
6868
{
6969
QDesktopServices::openUrl(link);
7070
}
7171

72-
void Huggle::AboutForm::on_label_10_linkActivated(const QString &link)
72+
void AboutForm::on_lblAuthorsMGalloway_linkActivated(const QString &link)
7373
{
7474
QDesktopServices::openUrl(link);
7575
}
7676

77-
void Huggle::AboutForm::on_label_9_linkActivated(const QString &link)
77+
void AboutForm::on_lblAuthorsSe4598_linkActivated(const QString &link)
7878
{
7979
QDesktopServices::openUrl(link);
8080
}
8181

82-
void Huggle::AboutForm::on_label_11_linkActivated(const QString &link)
82+
void AboutForm::on_lblAuthorsJosve05a_linkActivated(const QString &link)
8383
{
8484
QDesktopServices::openUrl(link);
8585
}
8686

87-
void Huggle::AboutForm::on_label_12_linkActivated(const QString &link)
87+
void AboutForm::on_lblAuthorsRichSmith_linkActivated(const QString &link)
8888
{
8989
QDesktopServices::openUrl(link);
9090
}
9191

92-
void Huggle::AboutForm::on_label_13_linkActivated(const QString &link)
92+
void AboutForm::on_lblAuthorsKrenair_linkActivated(const QString &link)
9393
{
9494
QDesktopServices::openUrl(link);
9595
}
@@ -107,27 +107,20 @@ static void check_dev()
107107
}
108108
}
109109

110-
void Huggle::AboutForm::on_label_3_linkHovered(const QString &link)
110+
void AboutForm::on_lblAuthorsPetrb_linkHovered(const QString &link)
111111
{
112-
// ignore
113112
Q_UNUSED(link);
114113
if (last_dev == 2)
115114
developer++;
116115
last_dev = 1;
117116
check_dev();
118117
}
119118

120-
void Huggle::AboutForm::on_label_4_linkHovered(const QString &link)
119+
void AboutForm::on_lblAuthorsAddshore_linkHovered(const QString &link)
121120
{
122-
// ignore
123121
Q_UNUSED(link);
124122
if (last_dev == 1)
125123
developer++;
126124
last_dev = 2;
127125
check_dev();
128126
}
129-
130-
void Huggle::AboutForm::on_label_14_linkActivated(const QString &link)
131-
{
132-
QDesktopServices::openUrl(link);
133-
}

src/huggle_ui/aboutform.hpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,21 @@ namespace Huggle
3030
public:
3131
explicit AboutForm(QWidget *parent = nullptr);
3232
~AboutForm() override;
33+
3334
private slots:
3435
void on_pushButton_clicked();
35-
void on_label_8_linkActivated(const QString &link);
36-
void on_label_5_linkActivated(const QString &link);
37-
void on_label_3_linkActivated(const QString &link);
38-
void on_label_4_linkActivated(const QString &link);
39-
void on_label_10_linkActivated(const QString &link);
40-
void on_label_9_linkActivated(const QString &link);
41-
void on_label_11_linkActivated(const QString &link);
42-
void on_label_12_linkActivated(const QString &link);
43-
void on_label_13_linkActivated(const QString &link);
44-
void on_label_3_linkHovered(const QString &link);
45-
void on_label_4_linkHovered(const QString &link);
46-
void on_label_14_linkActivated(const QString &link);
36+
void on_lblAuthorsDave_linkActivated(const QString &link);
37+
void on_lblAuthorsPetrb_linkActivated(const QString &link);
38+
void on_lblAuthorsAddshore_linkActivated(const QString &link);
39+
void on_lblAuthorsOriginalGurch_linkActivated(const QString &link);
40+
void on_lblAuthorsMGalloway_linkActivated(const QString &link);
41+
void on_lblAuthorsSe4598_linkActivated(const QString &link);
42+
void on_lblAuthorsJosve05a_linkActivated(const QString &link);
43+
void on_lblAuthorsRichSmith_linkActivated(const QString &link);
44+
void on_lblAuthorsKrenair_linkActivated(const QString &link);
45+
void on_lblAuthorsPetrb_linkHovered(const QString &link);
46+
void on_lblAuthorsAddshore_linkHovered(const QString &link);
47+
4748
private:
4849
Ui::AboutForm *ui;
4950
};

src/huggle_ui/aboutform.ui

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
</widget>
7777
</item>
7878
<item>
79-
<widget class="QLabel" name="label_7">
79+
<widget class="QLabel" name="lblVersionInfo">
8080
<property name="text">
8181
<string notr="true">Hey you, this isn't whitespace! :P</string>
8282
</property>
@@ -96,63 +96,63 @@
9696
</widget>
9797
</item>
9898
<item>
99-
<widget class="QLabel" name="label_3">
99+
<widget class="QLabel" name="lblAuthorsPetrb">
100100
<property name="text">
101101
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Petr Bena&lt;/span&gt; [[&lt;a href=&quot;https://en.wikipedia.org/wiki/User:Petrb&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;User:Petrb&lt;/span&gt;&lt;/a&gt;]]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
102102
</property>
103103
</widget>
104104
</item>
105105
<item>
106-
<widget class="QLabel" name="label_4">
106+
<widget class="QLabel" name="lblAuthorsAddshore">
107107
<property name="text">
108108
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Adam Shorland&lt;/span&gt; [[&lt;a href=&quot;https://en.wikipedia.org/wiki/User:Addshore&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;User:Addshore&lt;/span&gt;&lt;/a&gt;]]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
109109
</property>
110110
</widget>
111111
</item>
112112
<item>
113-
<widget class="QLabel" name="label_9">
113+
<widget class="QLabel" name="lblAuthorsMGalloway">
114114
<property name="text">
115115
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;May&lt;/span&gt; [[&lt;a href=&quot;https://meta.wikimedia.org/wiki/User:MGalloway_(WMF)&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;User:MGalloway_(WMF)&lt;/span&gt;&lt;/a&gt;]]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
116116
</property>
117117
</widget>
118118
</item>
119119
<item>
120-
<widget class="QLabel" name="label_8">
120+
<widget class="QLabel" name="lblAuthorsDave">
121121
<property name="text">
122122
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Aidan Fell&lt;/span&gt; [[&lt;a href=&quot;https://en.wikipedia.org/wiki/User:My_name_is_not_dave&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;User:My name is not dave&lt;/span&gt;&lt;/a&gt;]]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
123123
</property>
124124
</widget>
125125
</item>
126126
<item>
127-
<widget class="QLabel" name="label_11">
127+
<widget class="QLabel" name="lblAuthorsSe4598">
128128
<property name="text">
129129
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;se4598&lt;/span&gt; [[&lt;a href=&quot;https://de.wikipedia.org/wiki/User:se4598&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;User:se4598&lt;/span&gt;&lt;/a&gt;]]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
130130
</property>
131131
</widget>
132132
</item>
133133
<item>
134-
<widget class="QLabel" name="label_13">
134+
<widget class="QLabel" name="lblAuthorsJosve05a">
135135
<property name="text">
136136
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Jonatan Svensson Glad&lt;/span&gt; [[&lt;a href=&quot;https://en.wikipedia.org/wiki/User:Josve05a&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;User:Josve05a&lt;/span&gt;&lt;/a&gt;]]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
137137
</property>
138138
</widget>
139139
</item>
140140
<item>
141-
<widget class="QLabel" name="label_12">
141+
<widget class="QLabel" name="lblAuthorsRichSmith">
142142
<property name="text">
143143
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Rich Smith&lt;/span&gt; [[&lt;a href=&quot;https://en.wikipedia.org/wiki/User:Rich_Smith&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;User:Rich Smith&lt;/span&gt;&lt;/a&gt;]]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
144144
</property>
145145
</widget>
146146
</item>
147147
<item>
148-
<widget class="QLabel" name="label_14">
148+
<widget class="QLabel" name="lblAuthorsKrenair">
149149
<property name="text">
150150
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Alex Monk&lt;/span&gt; [[&lt;a href=&quot;https://en.wikipedia.org/wiki/User:Krenair&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;User:Krenair&lt;/span&gt;&lt;/a&gt;]]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
151151
</property>
152152
</widget>
153153
</item>
154154
<item>
155-
<widget class="QLabel" name="label_10">
155+
<widget class="QLabel" name="lblAuthorsOriginalGurch">
156156
<property name="text">
157157
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Based on original by &lt;span style=&quot; font-weight:600;&quot;&gt;Gurch&lt;/span&gt; [[&lt;a href=&quot;https://en.wikipedia.org/wiki/User:Gurch&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;User:Gurch&lt;/span&gt;&lt;/a&gt;]]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
158158
</property>

src/huggle_ui/blockuserform.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void BlockUserForm::SetWikiUser(WikiUser *User)
7777
this->ui->comboBox->addItem(User->GetSite()->ProjectConfig->BlockReason);
7878
}
7979

80-
void BlockUserForm::on_pushButton_2_clicked()
80+
void BlockUserForm::on_btnCancel_clicked()
8181
{
8282
this->hide();
8383
}
@@ -114,15 +114,15 @@ void BlockUserForm::Block()
114114
reason = error->GetAttribute("info");
115115
}
116116
UiGeneric::pMessageBox(this, _l("error"), _l("block-fail", reason), MessageBoxStyleError, true);
117-
this->ui->pushButton->setText(_l("block-title", this->user->Username));
117+
this->ui->btnBlock->setText(_l("block-title", this->user->Username));
118118
this->qUser->Result->SetError(HUGGLE_EUNKNOWN, "Unable to block: " + reason);
119119
this->qUser = nullptr;
120-
this->ui->pushButton->setEnabled(true);
120+
this->ui->btnBlock->setEnabled(true);
121121
this->timer->stop();
122122
return;
123123
}
124124
// let's assume the user was blocked
125-
this->ui->pushButton->setText(_l("block-done", this->user->Username));
125+
this->ui->btnBlock->setText(_l("block-done", this->user->Username));
126126
HUGGLE_DEBUG("block result: " + this->qUser->Result->Data, 2);
127127
HistoryItem *history = new HistoryItem(this->user->GetSite());
128128
history->Result = _l("successful");
@@ -149,15 +149,15 @@ void BlockUserForm::Failed(QString reason)
149149
UiGeneric::pMessageBox(this, "Unable to block user", _l("block-fail", reason),
150150
MessageBoxStyleError, true);
151151
this->timer->stop();
152-
this->ui->pushButton->setEnabled(true);
152+
this->ui->btnBlock->setEnabled(true);
153153
// remove the pointers
154154
this->qUser.Delete();
155155
}
156156

157-
void BlockUserForm::on_pushButton_clicked()
157+
void BlockUserForm::on_btnBlock_clicked()
158158
{
159159
// disable the button so that user can't click it multiple times
160-
this->ui->pushButton->setEnabled(false);
160+
this->ui->btnBlock->setEnabled(false);
161161
this->qUser = new ApiQuery(ActionQuery, this->user->GetSite());
162162
this->QueryPhase = 1;
163163
QString nocreate = "";
@@ -204,12 +204,12 @@ void BlockUserForm::sendBlockNotice(ApiQuery *dependency)
204204
WikiUtil::MessageUser(user, blocknotice, blocksum, blocksum, true, dependency, false, false);
205205
}
206206

207-
void Huggle::BlockUserForm::on_pushButton_3_clicked()
207+
void BlockUserForm::on_btnCheck_clicked()
208208
{
209209
if (this->qUser != nullptr)
210210
return;
211-
this->ui->pushButton_3->setEnabled(false);
212-
this->ui->pushButton->setEnabled(false);
211+
this->ui->btnCheck->setEnabled(false);
212+
this->ui->btnBlock->setEnabled(false);
213213
this->qUser = new ApiQuery(ActionQuery, this->user->GetSite());
214214
this->qUser->Target = "user";
215215
this->qUser->Parameters = "list=blocks&";
@@ -245,12 +245,12 @@ void BlockUserForm::recheck()
245245
UiGeneric::MessageBox(_l("result"), text, MessageBoxStyleNormal, true);
246246
this->qUser = nullptr;
247247
this->timer->stop();
248-
this->ui->pushButton_3->setEnabled(true);
249-
this->ui->pushButton->setEnabled(true);
248+
this->ui->btnCheck->setEnabled(true);
249+
this->ui->btnBlock->setEnabled(true);
250250
}
251251
}
252252

253-
void Huggle::BlockUserForm::on_pushButton_4_clicked()
253+
void BlockUserForm::on_btnContribs_clicked()
254254
{
255255
UiGeneric::DisplayContributionBrowser(this->user, this);
256256
}

src/huggle_ui/blockuserform.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ namespace Huggle
5656
*/
5757
void sendBlockNotice(ApiQuery *dependency);
5858
private slots:
59-
void on_pushButton_clicked();
60-
void on_pushButton_2_clicked();
59+
void on_btnBlock_clicked();
60+
void on_btnCancel_clicked();
6161
void onTick();
62-
void on_pushButton_3_clicked();
63-
void on_pushButton_4_clicked();
62+
void on_btnCheck_clicked();
63+
void on_btnContribs_clicked();
6464

6565
private:
6666
void recheck();

src/huggle_ui/blockuserform.ui

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,28 +103,28 @@
103103
<item>
104104
<layout class="QHBoxLayout" name="horizontalLayout">
105105
<item>
106-
<widget class="QPushButton" name="pushButton_2">
106+
<widget class="QPushButton" name="btnCancel">
107107
<property name="text">
108108
<string>Cancel</string>
109109
</property>
110110
</widget>
111111
</item>
112112
<item>
113-
<widget class="QPushButton" name="pushButton_4">
113+
<widget class="QPushButton" name="btnContribs">
114114
<property name="text">
115115
<string>View contributions</string>
116116
</property>
117117
</widget>
118118
</item>
119119
<item>
120-
<widget class="QPushButton" name="pushButton_3">
120+
<widget class="QPushButton" name="btnCheck">
121121
<property name="text">
122122
<string>Retrieve if user blocked</string>
123123
</property>
124124
</widget>
125125
</item>
126126
<item>
127-
<widget class="QPushButton" name="pushButton">
127+
<widget class="QPushButton" name="btnBlock">
128128
<property name="text">
129129
<string>Block user</string>
130130
</property>

src/huggle_ui/protectpage.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ void ProtectPage::onTick()
5353
this->Protect();
5454
}
5555

56-
void ProtectPage::on_pushButton_clicked()
56+
void ProtectPage::on_btnCancel_clicked()
5757
{
5858
this->hide();
5959
}
6060

61-
void ProtectPage::on_pushButton_2_clicked()
61+
void ProtectPage::on_btnProtect_clicked()
6262
{
63-
this->ui->pushButton_2->setEnabled(false);
63+
this->ui->btnProtect->setEnabled(false);
6464
this->qProtection = new ApiQuery(ActionProtect, this->PageToProtect->GetSite());
6565
this->qProtection->UsingPOST = true;
6666
QString protection = "edit=sysop|move=sysop";
@@ -95,7 +95,7 @@ void ProtectPage::Failed(QString reason)
9595
delete this->tt;
9696
this->qProtection.Delete();
9797
this->tt = nullptr;
98-
this->ui->pushButton->setEnabled(true);
98+
this->ui->btnProtect->setEnabled(true);
9999
}
100100

101101
void ProtectPage::Protect()

src/huggle_ui/protectpage.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ namespace Huggle
4646
*/
4747
void setPageToProtect(WikiPage *Page);
4848
private slots:
49-
void on_pushButton_clicked();
50-
void on_pushButton_2_clicked();
49+
void on_btnCancel_clicked();
50+
void on_btnProtect_clicked();
5151
void onTick();
5252
private:
5353
void Failed(QString reason);
5454
void Protect();
55-
//! Pointer for protection
55+
//! Pointer for protection
5656
Collectable_SmartPtr<ApiQuery> qProtection;
5757
Ui::ProtectPage *ui;
5858
//! Page that is about to be protected in this form

0 commit comments

Comments
 (0)