author | unc0rr |
Tue, 01 Apr 2008 15:57:51 +0000 | |
changeset 829 | 1209eb768acf |
parent 668 | 0d7683a66d61 |
child 883 | 07a568ba44e0 |
permissions | -rw-r--r-- |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
1 |
/* |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
2 |
* Hedgewars, a worms-like game |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
3 |
* Copyright (c) 2007 Andrey Korotaev <unC0Rr@gmail.com> |
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 |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
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) : |
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, |
|
36 |
Qt::Orientation orientation, int role) const |
|
37 |
{ |
|
38 |
if (role != Qt::DisplayRole) |
|
39 |
return QVariant(); |
|
40 |
||
41 |
if (orientation == Qt::Horizontal) |
|
42 |
{ |
|
43 |
switch (section) |
|
44 |
{ |
|
45 |
case 0: return tr("Title"); |
|
46 |
case 1: return tr("IP"); |
|
47 |
case 2: return tr("Port"); |
|
48 |
default: return QVariant(); |
|
49 |
} |
|
50 |
} else |
|
51 |
return QString("%1").arg(section + 1); |
|
52 |
} |
|
53 |
||
54 |
int HWNetServersModel::rowCount(const QModelIndex &parent) const |
|
55 |
{ |
|
56 |
if (parent.isValid()) |
|
57 |
return 0; |
|
58 |
else |
|
59 |
return games.size(); |
|
60 |
} |
|
61 |
||
62 |
int HWNetServersModel::columnCount(const QModelIndex & parent) const |
|
63 |
{ |
|
64 |
if (parent.isValid()) |
|
65 |
return 0; |
|
66 |
else |
|
67 |
return 3; |
|
68 |
} |