gui: Extract barrier type to separate enum
This commit is contained in:
parent
229abab99f
commit
165100a0d2
|
@ -442,7 +442,7 @@ void MainWindow::checkFingerprint(const QString& line)
|
|||
barrier::string::from_hex(fingerprintRegex.cap(2).toStdString())
|
||||
};
|
||||
|
||||
bool is_client = barrierType() == barrierClient;
|
||||
bool is_client = barrier_type() == BarrierType::Client;
|
||||
|
||||
auto db_path = is_client
|
||||
? barrier::DataDirectories::trusted_servers_ssl_fingerprints_path()
|
||||
|
@ -600,8 +600,8 @@ void MainWindow::startBarrier()
|
|||
args << "--profile-dir" << QString::fromStdString("\"" + barrier::DataDirectories::profile().u8string() + "\"");
|
||||
#endif
|
||||
|
||||
if ((barrierType() == barrierClient && !clientArgs(args, app))
|
||||
|| (barrierType() == barrierServer && !serverArgs(args, app)))
|
||||
if ((barrier_type() == BarrierType::Client && !clientArgs(args, app))
|
||||
|| (barrier_type() == BarrierType::Server && !serverArgs(args, app)))
|
||||
{
|
||||
stopBarrier();
|
||||
return;
|
||||
|
@ -616,7 +616,7 @@ void MainWindow::startBarrier()
|
|||
|
||||
m_pLogWindow->startNewInstance();
|
||||
|
||||
appendLogInfo("starting " + QString(barrierType() == barrierServer ? "server" : "client"));
|
||||
appendLogInfo("starting " + QString(barrier_type() == BarrierType::Server ? "server" : "client"));
|
||||
|
||||
qDebug() << args;
|
||||
|
||||
|
@ -726,6 +726,11 @@ QString MainWindow::configFilename()
|
|||
return filename;
|
||||
}
|
||||
|
||||
BarrierType MainWindow::barrier_type() const
|
||||
{
|
||||
return m_pGroupClient->isChecked() ? BarrierType::Client : BarrierType::Server;
|
||||
}
|
||||
|
||||
QString MainWindow::address()
|
||||
{
|
||||
QString address = appConfig().networkInterface();
|
||||
|
@ -1020,7 +1025,7 @@ void MainWindow::updateZeroconfService()
|
|||
m_pZeroconfService = NULL;
|
||||
}
|
||||
|
||||
if (m_AppConfig->autoConfig() || barrierType() == barrierServer) {
|
||||
if (m_AppConfig->autoConfig() || barrier_type() == BarrierType::Server) {
|
||||
m_pZeroconfService = new ZeroconfService(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#define MAINWINDOW__H
|
||||
|
||||
#include "barrier/BarrierType.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QSettings>
|
||||
|
@ -76,12 +78,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
|||
barrierTransfering
|
||||
};
|
||||
|
||||
enum qBarrierType
|
||||
{
|
||||
barrierClient,
|
||||
barrierServer
|
||||
};
|
||||
|
||||
enum qLevel {
|
||||
Error,
|
||||
Info
|
||||
|
@ -98,7 +94,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
|||
|
||||
public:
|
||||
void setVisible(bool visible);
|
||||
int barrierType() const { return m_pGroupClient->isChecked() ? barrierClient : barrierServer; }
|
||||
BarrierType barrier_type() const;
|
||||
int barrierState() const { return m_BarrierState; }
|
||||
QString hostname() const { return m_pLineEditHostname->text(); }
|
||||
QString configFilename();
|
||||
|
|
|
@ -66,7 +66,7 @@ ZeroconfService::ZeroconfService(MainWindow* mainWindow) :
|
|||
m_ServiceRegistered(false)
|
||||
{
|
||||
silence_avahi_warning();
|
||||
if (m_pMainWindow->barrierType() == MainWindow::barrierServer) {
|
||||
if (m_pMainWindow->barrier_type() == BarrierType::Server) {
|
||||
if (registerService(true)) {
|
||||
m_pZeroconfBrowser = new ZeroconfBrowser(this);
|
||||
connect(m_pZeroconfBrowser, SIGNAL(
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
barrier -- mouse and keyboard sharing utility
|
||||
Copyright (C) Barrier contributors
|
||||
|
||||
This package is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
found in the file LICENSE that should have accompanied this file.
|
||||
|
||||
This package is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef BARRIER_LIB_BARRIER_BARRIER_TYPE_H
|
||||
#define BARRIER_LIB_BARRIER_BARRIER_TYPE_H
|
||||
|
||||
enum class BarrierType {
|
||||
Server,
|
||||
Client
|
||||
};
|
||||
|
||||
#endif // BARRIER_LIB_BARRIER_BARRIER_TYPE_H
|
Loading…
Reference in New Issue