author | Wuzzy <Wuzzy2@mail.ru> |
Mon, 28 Oct 2019 20:40:07 +0100 | |
changeset 15495 | 0039baa9895e |
parent 13681 | 05fde8e30041 |
permissions | -rw-r--r-- |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
11046 | 3 |
* Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
4 |
* |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
8 |
* |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
13 |
* |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
9998
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
17 |
*/ |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
18 |
|
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
19 |
#include <QUdpSocket> |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
20 |
#include <QListWidget> |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
21 |
|
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
22 |
#include "netserverslist.h" |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
23 |
|
665 | 24 |
HWNetServersModel::HWNetServersModel(QObject* parent) : |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6061
diff
changeset
|
25 |
QAbstractTableModel(parent) |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
26 |
{ |
664 | 27 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
28 |
} |
665 | 29 |
|
30 |
void HWNetServersModel::updateList() |
|
31 |
{ |
|
32 |
||
33 |
} |
|
668 | 34 |
|
35 |
QVariant HWNetServersModel::headerData(int section, |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6061
diff
changeset
|
36 |
Qt::Orientation orientation, int role) const |
668 | 37 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
38 |
if (role != Qt::DisplayRole) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
39 |
return QVariant(); |
668 | 40 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
41 |
if (orientation == Qt::Horizontal) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
42 |
{ |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
43 |
switch (section) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
44 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6061
diff
changeset
|
45 |
case 0: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6061
diff
changeset
|
46 |
return tr("Title"); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6061
diff
changeset
|
47 |
case 1: |
13681
05fde8e30041
Add a few translator comments for frontend strings
Wuzzy <Wuzzy2@mail.ru>
parents:
11046
diff
changeset
|
48 |
//: short for "IP address" (Internet Protocol), part of server address |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6061
diff
changeset
|
49 |
return tr("IP"); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6061
diff
changeset
|
50 |
case 2: |
13681
05fde8e30041
Add a few translator comments for frontend strings
Wuzzy <Wuzzy2@mail.ru>
parents:
11046
diff
changeset
|
51 |
//: short for "port number", part of server address |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6061
diff
changeset
|
52 |
return tr("Port"); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6061
diff
changeset
|
53 |
default: |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6061
diff
changeset
|
54 |
return QVariant(); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
55 |
} |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6061
diff
changeset
|
56 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6061
diff
changeset
|
57 |
else |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
58 |
return QString("%1").arg(section + 1); |
668 | 59 |
} |
60 |
||
61 |
int HWNetServersModel::rowCount(const QModelIndex &parent) const |
|
62 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
63 |
if (parent.isValid()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
64 |
return 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
65 |
else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
66 |
return games.size(); |
668 | 67 |
} |
68 |
||
69 |
int HWNetServersModel::columnCount(const QModelIndex & parent) const |
|
70 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
71 |
if (parent.isValid()) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
72 |
return 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
73 |
else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
74 |
return 3; |
668 | 75 |
} |