1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
diff --git a/src/cdownload.cpp b/src/cdownload.cpp
index c723449..c882f96 100644
--- a/src/cdownload.cpp
+++ b/src/cdownload.cpp
@@ -65,34 +65,34 @@ void CDownload::updateSpeed() {
QString sizeString, readString, timeString;
if(size > 1024) {
if(size > 1024*1024*1024) {
- sizeString = sizeString.sprintf("%.2f GB", size/1024/1024/1024);
- readString = readString.sprintf("%.2f GB", read/1024/1024/1024);
+ sizeString = QString("%1 GB").arg(size/1024/1024/1024, 0, 'f', 2);
+ readString = QString("%1 GB").arg(read/1024/1024/1024, 0, 'f', 2);
} else {
if(size > 1024*1024) {
- sizeString = sizeString.sprintf("%.2f MB", size/1024/1024);
- readString = readString.sprintf("%.2f MB", read/1024/1024);
+ sizeString = QString("%1 MB").arg(size/1024/1024, 0, 'f', 2);
+ readString = QString("%1 MB").arg(read/1024/1024, 0, 'f', 2);
} else {
- sizeString = sizeString.sprintf("%.2f KB", size/1024);
- readString = readString.sprintf("%.2f KB", read/1024);
+ sizeString = QString("%1 KB").arg(size/1024, 0, 'f', 2);
+ readString = QString("%1 KB").arg(read/1024, 0, 'f', 2);
}
}
} else {
- sizeString = sizeString.sprintf("%.0f bytes", size);
- readString = readString.sprintf("%.0f bytes", read);
+ sizeString = QString("%1 bytes").arg(size, 0, 'f', 0);
+ readString = QString("%1 bytes").arg(read, 0, 'f', 0);
}
if(speed > 1024) {
if(speed > 1024*1024*1024) {
- speedString = speedString.sprintf("%.2f GB/s", speed/1024/1024/1024); // Would love to live to see this :P
+ speedString = QString("%1 GB/s").arg(speed/1024/1024/1024, 0, 'f', 2);
} else {
if(speed > 1024*1024) {
- speedString = speedString.sprintf("%.2f MB/s", speed/1024/1024);
+ speedString = QString("%1 MB/s").arg(speed/1024/1024, 0, 'f', 2);
} else {
- speedString = speedString.sprintf("%.2f KB/s", speed/1024);
+ speedString = QString("%1 KB/s").arg(speed/1024, 0, 'f', 2);
}
}
} else {
- speedString = speedString.sprintf("%.0f bytes/s", speed);
+ speedString = QString("%1 bytes/s").arg(speed, 0, 'f', 0);
}
timeElapsed++;
diff --git a/src/cupload.cpp b/src/cupload.cpp
index 17fbcb5..908d905 100644
--- a/src/cupload.cpp
+++ b/src/cupload.cpp
@@ -54,34 +54,34 @@ void CUpload::updateSpeed() {
QString sizeString, readString;
if(size > 1024) {
if(size > 1024*1024*1024) {
- sizeString = sizeString.sprintf("%.2f GB", size/1024/1024/1024);
- readString = readString.sprintf("%.2f GB", read/1024/1024/1024);
+ sizeString = QString("%1 GB").arg(size/1024/1024/1024, 0, 'f', 2);
+ readString = QString("%1 GB").arg(read/1024/1024/1024, 0, 'f', 2);
} else {
if(size > 1024*1024) {
- sizeString = sizeString.sprintf("%.2f MB", size/1024/1024);
- readString = readString.sprintf("%.2f MB", read/1024/1024);
+ sizeString = QString("%1 MB").arg(size/1024/1024, 0, 'f', 2);
+ readString = QString("%1 MB").arg(read/1024/1024, 0, 'f', 2);
} else {
- sizeString = sizeString.sprintf("%.2f KB", size/1024);
- readString = readString.sprintf("%.2f KB", read/1024);
+ sizeString = QString("%1 KB").arg(size/1024, 0, 'f', 2);
+ readString = QString("%1 KB").arg(read/1024, 0, 'f', 2);
}
}
} else {
- sizeString = sizeString.sprintf("%.0f bytes", size);
- readString = readString.sprintf("%.0f bytes", read);
+ sizeString = QString("%1 bytes").arg(size, 0, 'f', 0);
+ readString = QString("%1 bytes").arg(read, 0, 'f', 0);
}
if(speed > 1024) {
if(speed > 1024*1024*1024) {
- speedString = speedString.sprintf("%.2f GB/s", speed/1024/1024/1024); // Would love to live to see this :P
+ speedString = QString("%1 GB/s").arg(speed/1024/1024/1024, 0, 'f', 2);
} else {
if(speed > 1024*1024) {
- speedString = speedString.sprintf("%.2f MB/s", speed/1024/1024);
+ speedString = QString("%1 MB/s").arg(speed/1024/1024, 0, 'f', 2);
} else {
- speedString = speedString.sprintf("%.2f KB/s", speed/1024);
+ speedString = QString("%1 KB/s").arg(speed/1024, 0, 'f', 2);
}
}
} else {
- speedString = speedString.sprintf("%.0f bytes/s", speed);
+ speedString = QString("%1 bytes/s").arg(speed, 0, 'f', 0);
}
widget->infoLabel()->setText(readString+" of "+sizeString+" ("+speedString+")");
diff --git a/src/dialogfilebrowser.cpp b/src/dialogfilebrowser.cpp
index 30bff53..2bc8f8c 100644
--- a/src/dialogfilebrowser.cpp
+++ b/src/dialogfilebrowser.cpp
@@ -90,7 +90,7 @@ void DialogFileBrowser::load() {
CTransaction * fileListTransaction = connection->createTransaction(200);
if(path.length() > 1) {
- QStringList levels = path.split("/", QString::SkipEmptyParts);
+ QStringList levels = path.split("/", Qt::SkipEmptyParts);
quint16 directorylevels = levels.count();
quint16 pathlen = 2 + directorylevels * 3;
for(qint32 i=0; i<levels.count(); i++) {
@@ -332,7 +332,7 @@ void DialogFileBrowser::goDirectoryUp() {
path = "/";
return;
}
- QStringList levels = path.split("/", QString::SkipEmptyParts);
+ QStringList levels = path.split("/", Qt::SkipEmptyParts);
levels.pop_back();
path = levels.join("/");
load();
@@ -365,7 +365,7 @@ void DialogFileBrowser::requestFileDelete()
CTransaction * transaction = connection->createTransaction(204);
transaction->addParameter(201, TextHelper::EncodeText(ui->treeWidget->currentItem()->data(0, 0).toString()).size(), TextHelper::EncodeText(ui->treeWidget->currentItem()->data(0, 0).toString()).data());
- QStringList levels = path.split("/", QString::SkipEmptyParts);
+ QStringList levels = path.split("/", Qt::SkipEmptyParts);
quint16 directorylevels = levels.count();
quint16 pathlen = 2 + directorylevels * 3;
for(qint32 i=0; i<levels.count(); i++) {
@@ -423,7 +423,7 @@ void DialogFileBrowser::requestUpload() {
path.append("/");
}
- QStringList levels = path.split("/", QString::SkipEmptyParts);
+ QStringList levels = path.split("/", Qt::SkipEmptyParts);
quint16 directorylevels = levels.count();
quint16 pathlen = 2 + directorylevels * 3;
for(qint32 i=0; i<levels.count(); i++) {
diff --git a/src/dialogtrackers.cpp b/src/dialogtrackers.cpp
index 7415f78..ba8d985 100644
--- a/src/dialogtrackers.cpp
+++ b/src/dialogtrackers.cpp
@@ -24,9 +24,9 @@ DialogTrackers::DialogTrackers(ConnectionController * c, QWidget *parent) :
addTrackerDialog = new DialogAddTracker(this);
- ui->treeWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents);
- ui->treeWidget->header()->setResizeMode(1, QHeaderView::ResizeToContents);
- ui->treeWidget->header()->setResizeMode(2, QHeaderView::Stretch);
+ ui->treeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
+ ui->treeWidget->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
+ ui->treeWidget->header()->setSectionResizeMode(2, QHeaderView::Stretch);
connect(ui->comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateServerList(QString)));
connect(ui->pushButton, SIGNAL(clicked()), addTrackerDialog, SLOT(show()));
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index 37c91ef..717572b 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -105,7 +105,7 @@ void DownloadManager::sendDownloadRequestToServer(CDownload * download) {
path.append("/");
}
- QStringList levels = path.split("/", QString::SkipEmptyParts);
+ QStringList levels = path.split("/", Qt::SkipEmptyParts);
quint16 directorylevels = levels.count();
quint16 pathlen = 2 + directorylevels * 3;
for(qint32 i=0; i<levels.count(); i++) {
@@ -240,6 +240,5 @@ void DownloadManager::addDownload(quint32 ref, quint32 size, quint32 queuepos) {
QString DownloadManager::GetDownloadsDirectoryPath()
{
- // Qt4 does not offer a standard "Downloads" location. We could define one in the preferences dialog.
- return QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
+ return QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
}
diff --git a/src/main.cpp b/src/main.cpp
index a252cac..1620f89 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -9,10 +9,11 @@
#include "connectioncontroller.h"
void kill_threads( void );
-void * __gxx_personality_v0=0;
+/*void * __gxx_personality_v0=0; */
qint32 main(qint32 argc, char *argv[])
{
+ QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv);
MainWindow w(0, true);
diff --git a/src/widgetnews.cpp b/src/widgetnews.cpp
index afa44f6..ceb036c 100644
--- a/src/widgetnews.cpp
+++ b/src/widgetnews.cpp
@@ -65,7 +65,7 @@ void WidgetNews::getNews() {
}
if(path.length() > 1) {
- QStringList levels = path.split(":", QString::SkipEmptyParts);
+ QStringList levels = path.split(":", Qt::SkipEmptyParts);
quint16 directorylevels = levels.count();
quint16 pathlen = 2 + directorylevels * 3;
for(qint32 i=0; i<levels.count(); i++) {
@@ -212,9 +212,9 @@ void WidgetNews::onNewsCategory(unsigned char _type, QString _name) {
}
void WidgetNews::onItemSelectionChanged() {
- const QTreeWidgetItem * item = ui->treeWidget->currentItem();
+ /*const QTreeWidgetItem * item = ui->treeWidget->currentItem();
- /*if (item) {
+ if (item) {
ui->pushButtonDelete->setEnabled(true);
ui->pushButtonReply->setEnabled(true);
} else {
|