File: serverPreferences.C

package info (click to toggle)
ball 1.5.0%2Bgit20180813.37fc53c-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 239,848 kB
  • sloc: cpp: 326,149; ansic: 4,208; python: 2,303; yacc: 1,778; lex: 1,099; xml: 958; sh: 322; makefile: 93
file content (79 lines) | stat: -rw-r--r-- 2,013 bytes parent folder | download | duplicates (4)
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
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//

#include <BALL/VIEW/DIALOGS/serverPreferences.h>
#include <BALL/VIEW/KERNEL/common.h>
#include <BALL/COMMON/rtti.h>

#include <QtWidgets/QLabel>
#include <QtWidgets/QPushButton>

namespace BALL
{
	namespace VIEW
	{

		ServerPreferences::ServerPreferences(QWidget* parent, const char* name)
			: QWidget(parent),
				PreferencesEntry()
		{
			setObjectName(name);
			QLabel* port_label = new QLabel(this);
			port_label->setGeometry(30, 20, 100, 27);
			port_label->setFocusPolicy(Qt::NoFocus);
			port_label->setFrameStyle(0);
			port_label->setLineWidth(1);
			port_label->setMidLineWidth(0);
			port_label->setText(tr("server port"));
			port_label->setMargin(0);
			
			port_ = new QLineEdit(this);
			port_->setObjectName("port");
			port_->setGeometry(180, 20, 90, 30);
			port_->setFocusPolicy(Qt::StrongFocus);
			port_->setMaxLength(5);
			port_->setFrame(QLineEdit::Normal);
			port_->setFrame(true);
			port_->setAlignment(Qt::AlignRight);
			
			server_status_ = new QCheckBox(this);
			server_status_->setObjectName("server_status");
			server_status_->setGeometry(40, 80, 180, 21);
			server_status_->setFocusPolicy(Qt::TabFocus);
			server_status_->setText(tr("accept clients"));
			server_status_->setAutoRepeat(false);
			
			resize(380,210);
			setMinimumSize(0, 0);
			setMaximumSize(32767, 32767);

			port_->setText(String(VIEW_DEFAULT_PORT).c_str());
			server_status_->setChecked(false);
			
			setINIFileSectionName("NETWORK");
			setWidgetStackName((String)tr("Client/Server"));
			registerWidgets_();
		}

		ServerPreferences::~ServerPreferences()
		{
			#ifdef BALL_VIEW_DEBUG
				Log.info() << "Destructing object " << (void *)this 
				 					 << " of class ServerPreferences" << std::endl;
			#endif 
		}
		

		int ServerPreferences::getPort()
		{
			return ascii(port_->text()).toInt();
		}
		
		bool ServerPreferences::getServerStatus()
		{
			return server_status_->isChecked();
		}

	} // namespace VIEW
} // namespace BALL