From c6d14c31fda695f011cd668d2e1509995eadf980 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 15 Nov 2014 01:33:04 +0100 Subject: [PATCH] refs #288, login mode buttons as GUI element --- src/blackgui/loginmodebuttons.cpp | 42 ++++++++++++++++++ src/blackgui/loginmodebuttons.h | 45 +++++++++++++++++++ src/blackgui/loginmodebuttons.ui | 73 +++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+) create mode 100644 src/blackgui/loginmodebuttons.cpp create mode 100644 src/blackgui/loginmodebuttons.h create mode 100644 src/blackgui/loginmodebuttons.ui diff --git a/src/blackgui/loginmodebuttons.cpp b/src/blackgui/loginmodebuttons.cpp new file mode 100644 index 000000000..f3849a2df --- /dev/null +++ b/src/blackgui/loginmodebuttons.cpp @@ -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; + } +} diff --git a/src/blackgui/loginmodebuttons.h b/src/blackgui/loginmodebuttons.h new file mode 100644 index 000000000..31d8701b0 --- /dev/null +++ b/src/blackgui/loginmodebuttons.h @@ -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 +#include + + +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; + }; + +} + +#endif // guard diff --git a/src/blackgui/loginmodebuttons.ui b/src/blackgui/loginmodebuttons.ui new file mode 100644 index 000000000..e5b41cf6f --- /dev/null +++ b/src/blackgui/loginmodebuttons.ui @@ -0,0 +1,73 @@ + + + CLoginModeButtons + + + + 0 + 0 + 271 + 23 + + + + Login mode + + + + + + false + + + + 10 + + + 3 + + + 3 + + + 3 + + + 3 + + + + + Login mode + + + + + + + Normal + + + true + + + + + + + Stealth + + + + + + + Observer + + + + + + + +