2011-05-21 14:33:11 +02:00
|
|
|
/******************************************************************************\
|
2020-01-01 15:41:43 +01:00
|
|
|
* Copyright (c) 2004-2020
|
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.,
|
2020-06-08 22:58:11 +02:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
2011-05-21 14:33:11 +02:00
|
|
|
*
|
|
|
|
\******************************************************************************/
|
|
|
|
|
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 );
|
2020-06-14 08:49:58 +02:00
|
|
|
virtual void closeEvent ( QCloseEvent* Event );
|
2011-05-21 14:33:11 +02:00
|
|
|
|
|
|
|
void UpdateGUIDependencies();
|
|
|
|
void UpdateSystemTrayIcon ( const bool bIsActive );
|
|
|
|
void ShowWindowInForeground() { showNormal(); raise(); }
|
|
|
|
void ModifyAutoStartEntry ( const bool bDoAutoStart );
|
2020-05-15 23:04:55 +02:00
|
|
|
void UpdateRecorderStatus( QString sessionDir );
|
2011-05-21 14:33:11 +02:00
|
|
|
|
2020-06-14 08:49:58 +02:00
|
|
|
QTimer Timer;
|
|
|
|
CServer* pServer;
|
|
|
|
CSettings* pSettings;
|
2011-05-21 14:33:11 +02:00
|
|
|
|
2020-06-14 08:49:58 +02:00
|
|
|
CVector<QTreeWidgetItem*> vecpListViewItems;
|
|
|
|
QMutex ListViewMutex;
|
2011-05-21 14:33:11 +02:00
|
|
|
|
2020-06-14 08:49:58 +02:00
|
|
|
QMenuBar* pMenu;
|
2011-05-21 14:33:11 +02:00
|
|
|
|
2020-06-14 08:49:58 +02:00
|
|
|
bool bSystemTrayIconAvaialbe;
|
|
|
|
QSystemTrayIcon SystemTrayIcon;
|
|
|
|
QPixmap BitmapSystemTrayInactive;
|
|
|
|
QPixmap BitmapSystemTrayActive;
|
|
|
|
QMenu* pSystemTrayIconMenu;
|
2011-05-21 14:33:11 +02:00
|
|
|
|
|
|
|
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 OnStartOnOSStartStateChanged ( int value );
|
2020-04-08 15:30:32 +02:00
|
|
|
void OnUseCCLicenceStateChanged ( int value );
|
2020-05-30 17:24:52 +02:00
|
|
|
void OnEnableRecorderStateChanged ( int value )
|
|
|
|
{ pServer->SetEnableRecording ( Qt::CheckState::Checked == value ); }
|
|
|
|
|
2011-05-21 14:33:11 +02:00
|
|
|
void OnCentralServerAddressEditingFinished();
|
|
|
|
void OnServerNameTextChanged ( const QString& strNewName );
|
|
|
|
void OnLocationCityTextChanged ( const QString& strNewCity );
|
|
|
|
void OnLocationCountryActivated ( int iCntryListItem );
|
2020-04-11 14:27:50 +02:00
|
|
|
void OnCentServAddrTypeActivated ( int iTypeIdx );
|
2011-05-21 14:33:11 +02:00
|
|
|
void OnTimer();
|
2020-05-30 17:24:52 +02:00
|
|
|
void OnServerStarted();
|
2020-05-25 22:55:45 +02:00
|
|
|
void OnServerStopped();
|
2020-04-14 22:00:08 +02:00
|
|
|
void OnSvrRegStatusChanged() { UpdateGUIDependencies(); }
|
2020-05-30 17:24:52 +02:00
|
|
|
void OnStopRecorder();
|
2011-05-21 14:33:11 +02:00
|
|
|
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 ); }
|
2020-05-15 23:04:55 +02:00
|
|
|
|
2020-05-30 17:24:52 +02:00
|
|
|
void OnNewRecordingClicked() { pServer->RequestNewRecording(); }
|
2020-05-15 23:04:55 +02:00
|
|
|
void OnRecordingSessionStarted ( QString sessionDir )
|
2020-05-25 22:55:45 +02:00
|
|
|
{ UpdateRecorderStatus ( sessionDir ); }
|
2011-05-21 14:33:11 +02:00
|
|
|
};
|