2011-05-21 14:33:11 +02:00
|
|
|
/******************************************************************************\
|
2019-03-24 09:30:30 +01:00
|
|
|
* Copyright (c) 2004-2019
|
2011-05-21 14:33:11 +02:00
|
|
|
*
|
|
|
|
* Author(s):
|
|
|
|
* Volker Fischer
|
|
|
|
*
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License as published by the Free Software
|
|
|
|
* Foundation; either version 2 of the License, or (at your option) any later
|
|
|
|
* version.
|
|
|
|
*
|
|
|
|
* This program 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, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
\******************************************************************************/
|
|
|
|
|
2013-01-02 21:41:04 +01:00
|
|
|
#include <QCloseEvent>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QListView>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QThread>
|
|
|
|
#include <QSlider>
|
|
|
|
#include <QMenuBar>
|
|
|
|
#include <QLayout>
|
|
|
|
#include <QSystemTrayIcon>
|
|
|
|
#include <QSettings>
|
2011-05-21 14:33:11 +02:00
|
|
|
#include "global.h"
|
|
|
|
#include "server.h"
|
2011-05-21 19:06:30 +02:00
|
|
|
#include "settings.h"
|
2013-03-24 11:49:25 +01:00
|
|
|
#include "ui_serverdlgbase.h"
|
2011-05-21 14:33:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* Definitions ****************************************************************/
|
|
|
|
// update time for GUI controls
|
|
|
|
#define GUI_CONTRL_UPDATE_TIME 1000 // ms
|
|
|
|
|
|
|
|
|
|
|
|
/* Classes ********************************************************************/
|
2013-03-24 16:42:23 +01:00
|
|
|
class CServerDlg : public QDialog, private Ui_CServerDlgBase
|
2011-05-21 14:33:11 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2013-03-24 16:42:23 +01:00
|
|
|
CServerDlg ( CServer* pNServP,
|
|
|
|
CSettings* pNSetP,
|
|
|
|
const bool bStartMinimized,
|
2019-05-17 22:55:46 +02:00
|
|
|
QWidget* parent = nullptr,
|
|
|
|
Qt::WindowFlags f = nullptr );
|
2011-05-21 14:33:11 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void changeEvent ( QEvent* pEvent );
|
|
|
|
virtual void closeEvent ( QCloseEvent* Event );
|
|
|
|
|
|
|
|
void UpdateGUIDependencies();
|
|
|
|
void UpdateSystemTrayIcon ( const bool bIsActive );
|
|
|
|
void ShowWindowInForeground() { showNormal(); raise(); }
|
|
|
|
void ModifyAutoStartEntry ( const bool bDoAutoStart );
|
|
|
|
|
|
|
|
QTimer Timer;
|
|
|
|
CServer* pServer;
|
2011-05-21 19:06:30 +02:00
|
|
|
CSettings* pSettings;
|
2011-05-21 14:33:11 +02:00
|
|
|
|
2014-01-03 09:54:49 +01:00
|
|
|
CVector<QTreeWidgetItem*> vecpListViewItems;
|
2011-05-21 14:33:11 +02:00
|
|
|
QMutex ListViewMutex;
|
|
|
|
|
|
|
|
QMenuBar* pMenu;
|
|
|
|
|
|
|
|
bool bSystemTrayIconAvaialbe;
|
|
|
|
QSystemTrayIcon SystemTrayIcon;
|
|
|
|
QPixmap BitmapSystemTrayInactive;
|
|
|
|
QPixmap BitmapSystemTrayActive;
|
|
|
|
QMenu* pSystemTrayIconMenu;
|
|
|
|
|
|
|
|
public slots:
|
2011-05-21 19:06:30 +02:00
|
|
|
void OnAboutToQuit() { pSettings->Save(); }
|
|
|
|
|
2011-05-21 14:33:11 +02:00
|
|
|
void OnRegisterServerStateChanged ( int value );
|
|
|
|
void OnDefaultCentralServerStateChanged ( int value );
|
|
|
|
void OnStartOnOSStartStateChanged ( int value );
|
|
|
|
void OnCentralServerAddressEditingFinished();
|
|
|
|
void OnServerNameTextChanged ( const QString& strNewName );
|
|
|
|
void OnLocationCityTextChanged ( const QString& strNewCity );
|
|
|
|
void OnLocationCountryActivated ( int iCntryListItem );
|
|
|
|
void OnTimer();
|
|
|
|
void OnServerStarted() { UpdateSystemTrayIcon ( true ); }
|
|
|
|
void OnServerStopped() { UpdateSystemTrayIcon ( false ); }
|
|
|
|
void OnSysTrayMenuOpen() { ShowWindowInForeground(); }
|
|
|
|
void OnSysTrayMenuHide() { hide(); }
|
|
|
|
void OnSysTrayMenuExit() { close(); }
|
|
|
|
void OnSysTrayActivated ( QSystemTrayIcon::ActivationReason ActReason );
|
2019-04-03 19:12:45 +02:00
|
|
|
|
2019-04-12 18:42:05 +02:00
|
|
|
void keyPressEvent ( QKeyEvent *e ) // block escape key
|
|
|
|
{ if ( e->key() != Qt::Key_Escape ) QDialog::keyPressEvent ( e ); }
|
2011-05-21 14:33:11 +02:00
|
|
|
};
|