store window positions and visability state
This commit is contained in:
parent
584db6def8
commit
8ae66fd1a5
4 changed files with 130 additions and 1 deletions
|
@ -31,6 +31,13 @@ CClient::CClient ( const quint16 iPortNumber ) :
|
|||
ChannelInfo (),
|
||||
vecStoredFaderTags ( MAX_NUM_STORED_FADER_LEVELS, "" ),
|
||||
vecStoredFaderLevels ( MAX_NUM_STORED_FADER_LEVELS, AUD_MIX_FADER_MAX ),
|
||||
vecWindowPosMain (), // empty array
|
||||
vecWindowPosSettings (), // empty array
|
||||
vecWindowPosChat (), // empty array
|
||||
vecWindowPosConnect (), // empty array
|
||||
bWindowWasShownSettings ( false ),
|
||||
bWindowWasShownChat ( false ),
|
||||
bWindowWasShownConnect ( false ),
|
||||
Channel ( false ), /* we need a client channel -> "false" */
|
||||
eAudioCompressionType ( CT_OPUS ),
|
||||
iCeltNumCodedBytes ( CELT_NUM_BYTES_MONO_LOW_QUALITY ),
|
||||
|
|
|
@ -266,6 +266,15 @@ public:
|
|||
CVector<QString> vecStoredFaderTags;
|
||||
CVector<int> vecStoredFaderLevels;
|
||||
|
||||
// window position/state settings
|
||||
QByteArray vecWindowPosMain;
|
||||
QByteArray vecWindowPosSettings;
|
||||
QByteArray vecWindowPosChat;
|
||||
QByteArray vecWindowPosConnect;
|
||||
bool bWindowWasShownSettings;
|
||||
bool bWindowWasShownChat;
|
||||
bool bWindowWasShownConnect;
|
||||
|
||||
#ifdef LLCON_VST_PLUGIN
|
||||
// VST version must have direct access to sound object
|
||||
CSound* GetSound() { return &Sound; }
|
||||
|
|
|
@ -375,6 +375,47 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
|||
}
|
||||
|
||||
|
||||
// Window positions --------------------------------------------------------
|
||||
// main window
|
||||
if ( !pClient->vecWindowPosMain.isEmpty() && !pClient->vecWindowPosMain.isNull() )
|
||||
{
|
||||
restoreGeometry ( pClient->vecWindowPosMain );
|
||||
}
|
||||
|
||||
// settings window
|
||||
if ( !pClient->vecWindowPosSettings.isEmpty() && !pClient->vecWindowPosSettings.isNull() )
|
||||
{
|
||||
ClientSettingsDlg.restoreGeometry ( pClient->vecWindowPosSettings );
|
||||
}
|
||||
|
||||
if ( pClient->bWindowWasShownSettings )
|
||||
{
|
||||
ShowGeneralSettings();
|
||||
}
|
||||
|
||||
// chat window
|
||||
if ( !pClient->vecWindowPosChat.isEmpty() && !pClient->vecWindowPosChat.isNull() )
|
||||
{
|
||||
ChatDlg.restoreGeometry ( pClient->vecWindowPosChat );
|
||||
}
|
||||
|
||||
if ( pClient->bWindowWasShownChat )
|
||||
{
|
||||
ShowChatWindow();
|
||||
}
|
||||
|
||||
// connection setup window
|
||||
if ( !pClient->vecWindowPosConnect.isEmpty() && !pClient->vecWindowPosConnect.isNull() )
|
||||
{
|
||||
ConnectDlg.restoreGeometry ( pClient->vecWindowPosConnect );
|
||||
}
|
||||
|
||||
if ( pClient->bWindowWasShownConnect )
|
||||
{
|
||||
ShowConnectionSetupDialog();
|
||||
}
|
||||
|
||||
|
||||
// Connections -------------------------------------------------------------
|
||||
// push buttons
|
||||
QObject::connect ( butConnect, SIGNAL ( clicked() ),
|
||||
|
@ -489,10 +530,20 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
|||
|
||||
void CClientDlg::closeEvent ( QCloseEvent* Event )
|
||||
{
|
||||
// store window positions
|
||||
pClient->vecWindowPosMain = saveGeometry();
|
||||
pClient->vecWindowPosSettings = ClientSettingsDlg.saveGeometry();
|
||||
pClient->vecWindowPosChat = ChatDlg.saveGeometry();
|
||||
pClient->vecWindowPosConnect = ConnectDlg.saveGeometry();
|
||||
|
||||
pClient->bWindowWasShownSettings = ClientSettingsDlg.isVisible();
|
||||
pClient->bWindowWasShownChat = ChatDlg.isVisible();
|
||||
pClient->bWindowWasShownConnect = ConnectDlg.isVisible();
|
||||
|
||||
// if settings/connect dialog or chat dialog is open, close it
|
||||
ClientSettingsDlg.close();
|
||||
ConnectDlg.close();
|
||||
ChatDlg.close();
|
||||
ConnectDlg.close();
|
||||
AnalyzerConsole.close();
|
||||
|
||||
// if connected, terminate connection
|
||||
|
|
|
@ -234,6 +234,40 @@ void CSettings::Load()
|
|||
{
|
||||
pClient->SetUseDefaultCentralServerAddress ( bValue );
|
||||
}
|
||||
|
||||
// window position of the main window
|
||||
pClient->vecWindowPosMain = QByteArray().fromBase64 (
|
||||
GetIniSetting ( IniXMLDocument, "client", "winposmain" ).toLatin1() );
|
||||
|
||||
// window position of the settings window
|
||||
pClient->vecWindowPosSettings = QByteArray().fromBase64 (
|
||||
GetIniSetting ( IniXMLDocument, "client", "winposset" ).toLatin1() );
|
||||
|
||||
// window position of the chat window
|
||||
pClient->vecWindowPosChat = QByteArray().fromBase64 (
|
||||
GetIniSetting ( IniXMLDocument, "client", "winposchat" ).toLatin1() );
|
||||
|
||||
// window position of the connect window
|
||||
pClient->vecWindowPosConnect = QByteArray().fromBase64 (
|
||||
GetIniSetting ( IniXMLDocument, "client", "winposcon" ).toLatin1() );
|
||||
|
||||
// visibility state of the settings window
|
||||
if ( GetFlagIniSet ( IniXMLDocument, "client", "winvisset", bValue ) )
|
||||
{
|
||||
pClient->bWindowWasShownSettings = bValue;
|
||||
}
|
||||
|
||||
// visibility state of the chat window
|
||||
if ( GetFlagIniSet ( IniXMLDocument, "client", "winvischat", bValue ) )
|
||||
{
|
||||
pClient->bWindowWasShownChat = bValue;
|
||||
}
|
||||
|
||||
// visibility state of the connect window
|
||||
if ( GetFlagIniSet ( IniXMLDocument, "client", "winviscon", bValue ) )
|
||||
{
|
||||
pClient->bWindowWasShownConnect = bValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -392,6 +426,34 @@ void CSettings::Save()
|
|||
// use default central server address flag
|
||||
SetFlagIniSet ( IniXMLDocument, "client", "defcentservaddr",
|
||||
pClient->GetUseDefaultCentralServerAddress() );
|
||||
|
||||
// window position of the main window
|
||||
PutIniSetting ( IniXMLDocument, "client", "winposmain",
|
||||
QString().fromLatin1 ( pClient->vecWindowPosMain.toBase64() ) );
|
||||
|
||||
// window position of the settings window
|
||||
PutIniSetting ( IniXMLDocument, "client", "winposset",
|
||||
QString().fromLatin1 ( pClient->vecWindowPosSettings.toBase64() ) );
|
||||
|
||||
// window position of the chat window
|
||||
PutIniSetting ( IniXMLDocument, "client", "winposchat",
|
||||
QString().fromLatin1 ( pClient->vecWindowPosChat.toBase64() ) );
|
||||
|
||||
// window position of the connect window
|
||||
PutIniSetting ( IniXMLDocument, "client", "winposcon",
|
||||
QString().fromLatin1 ( pClient->vecWindowPosConnect.toBase64() ) );
|
||||
|
||||
// visibility state of the settings window
|
||||
SetFlagIniSet ( IniXMLDocument, "client", "winvisset",
|
||||
pClient->bWindowWasShownSettings );
|
||||
|
||||
// visibility state of the chat window
|
||||
SetFlagIniSet ( IniXMLDocument, "client", "winvischat",
|
||||
pClient->bWindowWasShownChat );
|
||||
|
||||
// visibility state of the connect window
|
||||
SetFlagIniSet ( IniXMLDocument, "client", "winviscon",
|
||||
pClient->bWindowWasShownConnect );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue