refs #288, login mode buttons as GUI element

This commit is contained in:
Klaus Basan
2014-11-15 01:33:04 +01:00
committed by Roland Winklmeier
parent dae22f5a3f
commit c6d14c31fd
3 changed files with 160 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
/* Copyright (C) 2014
* swift project Community / Contributors
*
* This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "loginmodebuttons.h"
#include "ui_loginmodebuttons.h"
using namespace BlackCore;
namespace BlackGui
{
CLoginModeButtons::CLoginModeButtons(QWidget *parent) :
QGroupBox(parent),
ui(new Ui::CLoginModeButtons)
{
ui->setupUi(this);
}
CLoginModeButtons::~CLoginModeButtons()
{ }
BlackCore::INetwork::LoginMode BlackGui::CLoginModeButtons::getLoginMode() const
{
INetwork::LoginMode mode = INetwork::LoginNormal;
if (this->ui->rb_LoginStealth->isChecked())
{
mode = INetwork::LoginStealth;
}
else if (this->ui->rb_LoginObserver->isChecked())
{
mode = INetwork::LoginAsObserver;
}
return mode;
}
}

View File

@@ -0,0 +1,45 @@
/* Copyright (C) 2014
* swift project Community / Contributors
*
* This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISC_LOGINMODEBUTTONS_H
#define BLACKMISC_LOGINMODEBUTTONS_H
#include "blackcore/network.h"
#include <QGroupBox>
#include <QScopedPointer>
namespace Ui { class CLoginModeButtons; }
namespace BlackGui
{
class CLoginModeButtons : public QGroupBox
{
Q_OBJECT
public:
//! Constructor
explicit CLoginModeButtons(QWidget *parent = nullptr);
//! Destructor
~CLoginModeButtons();
//! Get login mode, \sa BlackCore::INetwork::LoginMode
BlackCore::INetwork::LoginMode getLoginMode() const;
private:
QScopedPointer<Ui::CLoginModeButtons> ui;
};
}
#endif // guard

View File

@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CLoginModeButtons</class>
<widget class="QGroupBox" name="CLoginModeButtons">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>271</width>
<height>23</height>
</rect>
</property>
<property name="windowTitle">
<string>Login mode </string>
</property>
<property name="title">
<string/>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="hl_LoginMode">
<property name="spacing">
<number>10</number>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QLabel" name="lbl_LognMode">
<property name="text">
<string>Login mode</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rb_LoginNormal">
<property name="text">
<string>Normal</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rb_LoginStealth">
<property name="text">
<string>Stealth</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rb_LoginObserver">
<property name="text">
<string>Observer</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>