Doomseeker
Wadseeker
Download
Tracker
Git
Docs
Main Page
Plugin API
Related Pages
Modules
Classes
Files
File List
File Members
src
core
gui
configuration
cfgcustomservers.h
1
//------------------------------------------------------------------------------
2
// cfgcustomservers.cpp
3
//------------------------------------------------------------------------------
4
//
5
// This library is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation; either
8
// version 2.1 of the License, or (at your option) any later version.
9
//
10
// This library is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// Lesser General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with this library; if not, write to the Free Software
17
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18
// 02110-1301 USA
19
//
20
//------------------------------------------------------------------------------
21
// Copyright (C) 2009 "Zalewa" <zalewapl@gmail.com>
22
//------------------------------------------------------------------------------
23
#ifndef __CFGCUSTOMSERVERS_H_
24
#define __CFGCUSTOMSERVERS_H_
25
26
#include "gui/configuration/configpage.h"
27
#include "dptr.h"
28
#include <QIcon>
29
30
class
CustomServerInfo
;
31
class
EnginePlugin
;
32
class
QModelIndex;
33
class
QStandardItem;
34
class
QStandardItemModel;
35
36
class
CFGCustomServers
:
public
ConfigPage
37
{
38
Q_OBJECT
39
40
public
:
41
CFGCustomServers
(QWidget *parent=NULL);
42
~
CFGCustomServers
();
43
44
QIcon
icon
()
const
{
return
QIcon(
":/flags/localhost-small"
); }
45
QString
name
()
const
{
return
tr(
"Pinned Servers"
); }
46
47
protected
:
48
void
readSettings
();
49
void
saveSettings
();
50
51
private
:
52
enum
CheckAndFixPorts
53
{
54
AllOk,
55
AtLeastOneFixed
56
};
57
58
enum
ColumnIndices
59
{
60
EngineColumnIndex = 0,
61
AddressColumnIndex = 1,
62
PortColumnIndex = 2,
63
EnabledIndex = 3
64
};
65
66
DPtr<CFGCustomServers>
d;
67
75
CheckAndFixPorts checkAndFixPorts(
int
firstRow,
int
lastRow);
76
const
EnginePlugin
* getPluginInfoForRow(
int
rowIndex);
77
bool
isPortColumnWithinRange(
int
leftmostColumnIndex,
int
rightmostColumnIndex);
78
bool
isPortCorrect(
int
rowIndex);
79
80
void
prepareEnginesComboBox();
81
void
prepareTable();
82
void
setEnabledOnSelected(
bool
enabled);
83
void
setEngineOnItem(QStandardItem*,
const
QString& engineName);
84
void
setPortToDefault(
int
rowIndex);
85
86
QVector<CustomServerInfo> tableGetServers();
87
88
private
slots:
89
void
add();
90
void
add(
const
QString& engineName,
const
QString& host,
91
unsigned
short
port,
bool
enabled);
92
void
dataChanged(
const
QModelIndex& topLeft,
const
QModelIndex& bottomRight);
93
void
disableSelected();
94
void
enableSelected();
95
void
remove
();
96
void
setEngine();
97
};
98
99
#endif
CustomServerInfo
Definition:
customservers.h:35
CFGCustomServers::readSettings
void readSettings()
Reimplement this to read settings from config into widgets.
Definition:
cfgcustomservers.cpp:234
CFGCustomServers
Definition:
cfgcustomservers.h:36
CFGCustomServers::saveSettings
void saveSettings()
Reimplement this to write settings to config from widgets.
Definition:
cfgcustomservers.cpp:265
CFGCustomServers::name
QString name() const
Reimplement this to return a list-displayable name for this ConfigPage.
Definition:
cfgcustomservers.h:45
CFGCustomServers::icon
QIcon icon() const
Reimplement this to return a displayable icon for the ConfigPage.
Definition:
cfgcustomservers.h:44
DPtr< CFGCustomServers >
EnginePlugin
Definition:
engineplugin.h:76
ConfigPage
Base class for configuration pages.
Definition:
configpage.h:44
Doomseeker © 2009-2024 The Doomseeker Team