/[svn]/qsampler/trunk/src/qsamplerMainForm.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerMainForm.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3758 by capela, Fri Mar 27 17:57:40 2020 UTC revision 3760 by capela, Mon Mar 30 16:38:22 2020 UTC
# Line 35  Line 35 
35  #include "qsamplerOptionsForm.h"  #include "qsamplerOptionsForm.h"
36  #include "qsamplerDeviceStatusForm.h"  #include "qsamplerDeviceStatusForm.h"
37    
38    #include "qsamplerPaletteForm.h"
39    
40    #include <QStyleFactory>
41    
42  #include <QMdiArea>  #include <QMdiArea>
43  #include <QMdiSubWindow>  #include <QMdiSubWindow>
44    
# Line 70  const WindowFlags WindowCloseButtonHint Line 74  const WindowFlags WindowCloseButtonHint
74  }  }
75  #endif  #endif
76    
77    // Deprecated QTextStreamFunctions/Qt namespaces workaround.
78    #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
79    #define endl    Qt::endl
80    #endif
81    
82    
83  #ifdef CONFIG_LIBGIG  #ifdef CONFIG_LIBGIG
84  #include <gig.h>  #include <gig.h>
85  #endif  #endif
# Line 1091  bool MainForm::saveSessionFile ( const Q Line 1101  bool MainForm::saveSessionFile ( const Q
1101          // Write the file.          // Write the file.
1102          int iErrors = 0;          int iErrors = 0;
1103          QTextStream ts(&file);          QTextStream ts(&file);
1104          ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << Qt::endl;          ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl;
1105          ts << "# " << tr("Version") << ": " CONFIG_BUILD_VERSION << Qt::endl;          ts << "# " << tr("Version") << ": " CONFIG_BUILD_VERSION << endl;
1106  //      ts << "# " << tr("Build") << ": " CONFIG_BUILD_DATE << Qt::endl;  //      ts << "# " << tr("Build") << ": " CONFIG_BUILD_DATE << endl;
1107          ts << "#"  << Qt::endl;          ts << "#"  << endl;
1108          ts << "# " << tr("File")          ts << "# " << tr("File")
1109          << ": " << QFileInfo(sFilename).fileName() << Qt::endl;          << ": " << QFileInfo(sFilename).fileName() << endl;
1110          ts << "# " << tr("Date")          ts << "# " << tr("Date")
1111          << ": " << QDate::currentDate().toString("MMM dd yyyy")          << ": " << QDate::currentDate().toString("MMM dd yyyy")
1112          << " "  << QTime::currentTime().toString("hh:mm:ss") << Qt::endl;          << " "  << QTime::currentTime().toString("hh:mm:ss") << endl;
1113          ts << "#"  << Qt::endl;          ts << "#"  << endl;
1114          ts << Qt::endl;          ts << endl;
1115    
1116          // It is assumed that this new kind of device+session file          // It is assumed that this new kind of device+session file
1117          // will be loaded from a complete initialized server...          // will be loaded from a complete initialized server...
1118          int *piDeviceIDs;          int *piDeviceIDs;
1119          int  i, iDevice;          int  i, iDevice;
1120          ts << "RESET" << Qt::endl;          ts << "RESET" << endl;
1121    
1122          // Audio device mapping.          // Audio device mapping.
1123          QMap<int, int> audioDeviceMap; iDevice = 0;          QMap<int, int> audioDeviceMap; iDevice = 0;
# Line 1118  bool MainForm::saveSessionFile ( const Q Line 1128  bool MainForm::saveSessionFile ( const Q
1128                  if (device.driverName().toUpper() == "PLUGIN")                  if (device.driverName().toUpper() == "PLUGIN")
1129                          continue;                          continue;
1130                  // Audio device specification...                  // Audio device specification...
1131                  ts << Qt::endl;                  ts << endl;
1132                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
1133                          << " " << tr("Device") << " " << iDevice << Qt::endl;                          << " " << tr("Device") << " " << iDevice << endl;
1134                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();
1135                  DeviceParamMap::ConstIterator deviceParam;                  DeviceParamMap::ConstIterator deviceParam;
1136                  for (deviceParam = device.params().begin();                  for (deviceParam = device.params().begin();
# Line 1130  bool MainForm::saveSessionFile ( const Q Line 1140  bool MainForm::saveSessionFile ( const Q
1140                          if (param.value.isEmpty()) ts << "# ";                          if (param.value.isEmpty()) ts << "# ";
1141                          ts << " " << deviceParam.key() << "='" << param.value << "'";                          ts << " " << deviceParam.key() << "='" << param.value << "'";
1142                  }                  }
1143                  ts << Qt::endl;                  ts << endl;
1144                  // Audio channel parameters...                  // Audio channel parameters...
1145                  int iPort = 0;                  int iPort = 0;
1146                  QListIterator<DevicePort *> iter(device.ports());                  QListIterator<DevicePort *> iter(device.ports());
# Line 1144  bool MainForm::saveSessionFile ( const Q Line 1154  bool MainForm::saveSessionFile ( const Q
1154                                  if (param.fix || param.value.isEmpty()) ts << "# ";                                  if (param.fix || param.value.isEmpty()) ts << "# ";
1155                                  ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice                                  ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice
1156                                          << " " << iPort << " " << portParam.key()                                          << " " << iPort << " " << portParam.key()
1157                                          << "='" << param.value << "'" << Qt::endl;                                          << "='" << param.value << "'" << endl;
1158                          }                          }
1159                          iPort++;                          iPort++;
1160                  }                  }
# Line 1163  bool MainForm::saveSessionFile ( const Q Line 1173  bool MainForm::saveSessionFile ( const Q
1173                  if (device.driverName().toUpper() == "PLUGIN")                  if (device.driverName().toUpper() == "PLUGIN")
1174                          continue;                          continue;
1175                  // MIDI device specification...                  // MIDI device specification...
1176                  ts << Qt::endl;                  ts << endl;
1177                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
1178                          << " " << tr("Device") << " " << iDevice << Qt::endl;                          << " " << tr("Device") << " " << iDevice << endl;
1179                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();
1180                  DeviceParamMap::ConstIterator deviceParam;                  DeviceParamMap::ConstIterator deviceParam;
1181                  for (deviceParam = device.params().begin();                  for (deviceParam = device.params().begin();
# Line 1175  bool MainForm::saveSessionFile ( const Q Line 1185  bool MainForm::saveSessionFile ( const Q
1185                          if (param.value.isEmpty()) ts << "# ";                          if (param.value.isEmpty()) ts << "# ";
1186                          ts << " " << deviceParam.key() << "='" << param.value << "'";                          ts << " " << deviceParam.key() << "='" << param.value << "'";
1187                  }                  }
1188                  ts << Qt::endl;                  ts << endl;
1189                  // MIDI port parameters...                  // MIDI port parameters...
1190                  int iPort = 0;                  int iPort = 0;
1191                  QListIterator<DevicePort *> iter(device.ports());                  QListIterator<DevicePort *> iter(device.ports());
# Line 1189  bool MainForm::saveSessionFile ( const Q Line 1199  bool MainForm::saveSessionFile ( const Q
1199                                  if (param.fix || param.value.isEmpty()) ts << "# ";                                  if (param.fix || param.value.isEmpty()) ts << "# ";
1200                                  ts << "SET MIDI_INPUT_PORT_PARAMETER " << iDevice                                  ts << "SET MIDI_INPUT_PORT_PARAMETER " << iDevice
1201                                  << " " << iPort << " " << portParam.key()                                  << " " << iPort << " " << portParam.key()
1202                                  << "='" << param.value << "'" << Qt::endl;                                  << "='" << param.value << "'" << endl;
1203                          }                          }
1204                          iPort++;                          iPort++;
1205                  }                  }
# Line 1198  bool MainForm::saveSessionFile ( const Q Line 1208  bool MainForm::saveSessionFile ( const Q
1208                  // Try to keep it snappy :)                  // Try to keep it snappy :)
1209                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
1210          }          }
1211          ts << Qt::endl;          ts << endl;
1212    
1213  #ifdef CONFIG_MIDI_INSTRUMENT  #ifdef CONFIG_MIDI_INSTRUMENT
1214          // MIDI instrument mapping...          // MIDI instrument mapping...
# Line 1211  bool MainForm::saveSessionFile ( const Q Line 1221  bool MainForm::saveSessionFile ( const Q
1221                  ts << "# " << tr("MIDI instrument map") << " " << iMap;                  ts << "# " << tr("MIDI instrument map") << " " << iMap;
1222                  if (pszMapName)                  if (pszMapName)
1223                          ts << " - " << pszMapName;                          ts << " - " << pszMapName;
1224                  ts << Qt::endl;                  ts << endl;
1225                  ts << "ADD MIDI_INSTRUMENT_MAP";                  ts << "ADD MIDI_INSTRUMENT_MAP";
1226                  if (pszMapName)                  if (pszMapName)
1227                          ts << " '" << pszMapName << "'";                          ts << " '" << pszMapName << "'";
1228                  ts << Qt::endl;                  ts << endl;
1229                  // MIDI instrument mapping...                  // MIDI instrument mapping...
1230                  lscp_midi_instrument_t *pInstrs                  lscp_midi_instrument_t *pInstrs
1231                          = ::lscp_list_midi_instruments(m_pClient, iMidiMap);                          = ::lscp_list_midi_instruments(m_pClient, iMidiMap);
# Line 1246  bool MainForm::saveSessionFile ( const Q Line 1256  bool MainForm::saveSessionFile ( const Q
1256                                  }                                  }
1257                                  if (pInstrInfo->name)                                  if (pInstrInfo->name)
1258                                          ts << " '" << pInstrInfo->name << "'";                                          ts << " '" << pInstrInfo->name << "'";
1259                                  ts << Qt::endl;                                  ts << endl;
1260                          }       // Check for errors...                          }       // Check for errors...
1261                          else if (::lscp_client_get_errno(m_pClient)) {                          else if (::lscp_client_get_errno(m_pClient)) {
1262                                  appendMessagesClient("lscp_get_midi_instrument_info");                                  appendMessagesClient("lscp_get_midi_instrument_info");
# Line 1255  bool MainForm::saveSessionFile ( const Q Line 1265  bool MainForm::saveSessionFile ( const Q
1265                          // Try to keep it snappy :)                          // Try to keep it snappy :)
1266                          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
1267                  }                  }
1268                  ts << Qt::endl;                  ts << endl;
1269                  // Check for errors...                  // Check for errors...
1270                  if (pInstrs == nullptr && ::lscp_client_get_errno(m_pClient)) {                  if (pInstrs == nullptr && ::lscp_client_get_errno(m_pClient)) {
1271                          appendMessagesClient("lscp_list_midi_instruments");                          appendMessagesClient("lscp_list_midi_instruments");
# Line 1289  bool MainForm::saveSessionFile ( const Q Line 1299  bool MainForm::saveSessionFile ( const Q
1299                                  if (!midiDeviceMap.contains(iMidiDevice))                                  if (!midiDeviceMap.contains(iMidiDevice))
1300                                          continue;                                          continue;
1301                                  // Go for regular, canonical devices...                                  // Go for regular, canonical devices...
1302                                  ts << "# " << tr("Channel") << " " << iChannelID << Qt::endl;                                  ts << "# " << tr("Channel") << " " << iChannelID << endl;
1303                                  ts << "ADD CHANNEL" << Qt::endl;                                  ts << "ADD CHANNEL" << endl;
1304                                  if (audioDeviceMap.isEmpty()) {                                  if (audioDeviceMap.isEmpty()) {
1305                                          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID                                          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID
1306                                                  << " " << pChannel->audioDriver() << Qt::endl;                                                  << " " << pChannel->audioDriver() << endl;
1307                                  } else {                                  } else {
1308                                          ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannelID                                          ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannelID
1309                                                  << " " << audioDeviceMap.value(iAudioDevice) << Qt::endl;                                                  << " " << audioDeviceMap.value(iAudioDevice) << endl;
1310                                  }                                  }
1311                                  if (midiDeviceMap.isEmpty()) {                                  if (midiDeviceMap.isEmpty()) {
1312                                          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID                                          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID
1313                                                  << " " << pChannel->midiDriver() << Qt::endl;                                                  << " " << pChannel->midiDriver() << endl;
1314                                  } else {                                  } else {
1315                                          ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannelID                                          ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannelID
1316                                                  << " " << midiDeviceMap.value(iMidiDevice) << Qt::endl;                                                  << " " << midiDeviceMap.value(iMidiDevice) << endl;
1317                                  }                                  }
1318                                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID                                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID
1319                                          << " " << pChannel->midiPort() << Qt::endl;                                          << " " << pChannel->midiPort() << endl;
1320                                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " ";                                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " ";
1321                                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)                                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)
1322                                          ts << "ALL";                                          ts << "ALL";
1323                                  else                                  else
1324                                          ts << pChannel->midiChannel();                                          ts << pChannel->midiChannel();
1325                                  ts << Qt::endl;                                  ts << endl;
1326                                  ts << "LOAD ENGINE " << pChannel->engineName()                                  ts << "LOAD ENGINE " << pChannel->engineName()
1327                                          << " " << iChannelID << Qt::endl;                                          << " " << iChannelID << endl;
1328                                  if (pChannel->instrumentStatus() < 100) ts << "# ";                                  if (pChannel->instrumentStatus() < 100) ts << "# ";
1329                                  ts << "LOAD INSTRUMENT NON_MODAL '"                                  ts << "LOAD INSTRUMENT NON_MODAL '"
1330                                          << pChannel->instrumentFile() << "' "                                          << pChannel->instrumentFile() << "' "
1331                                          << pChannel->instrumentNr() << " " << iChannelID << Qt::endl;                                          << pChannel->instrumentNr() << " " << iChannelID << endl;
1332                                  ChannelRoutingMap::ConstIterator audioRoute;                                  ChannelRoutingMap::ConstIterator audioRoute;
1333                                  for (audioRoute = pChannel->audioRouting().begin();                                  for (audioRoute = pChannel->audioRouting().begin();
1334                                                  audioRoute != pChannel->audioRouting().end();                                                  audioRoute != pChannel->audioRouting().end();
1335                                                          ++audioRoute) {                                                          ++audioRoute) {
1336                                          ts << "SET CHANNEL AUDIO_OUTPUT_CHANNEL " << iChannelID                                          ts << "SET CHANNEL AUDIO_OUTPUT_CHANNEL " << iChannelID
1337                                                  << " " << audioRoute.key()                                                  << " " << audioRoute.key()
1338                                                  << " " << audioRoute.value() << Qt::endl;                                                  << " " << audioRoute.value() << endl;
1339                                  }                                  }
1340                                  ts << "SET CHANNEL VOLUME " << iChannelID                                  ts << "SET CHANNEL VOLUME " << iChannelID
1341                                          << " " << pChannel->volume() << Qt::endl;                                          << " " << pChannel->volume() << endl;
1342                                  if (pChannel->channelMute())                                  if (pChannel->channelMute())
1343                                          ts << "SET CHANNEL MUTE " << iChannelID << " 1" << Qt::endl;                                          ts << "SET CHANNEL MUTE " << iChannelID << " 1" << endl;
1344                                  if (pChannel->channelSolo())                                  if (pChannel->channelSolo())
1345                                          ts << "SET CHANNEL SOLO " << iChannelID << " 1" << Qt::endl;                                          ts << "SET CHANNEL SOLO " << iChannelID << " 1" << endl;
1346                          #ifdef CONFIG_MIDI_INSTRUMENT                          #ifdef CONFIG_MIDI_INSTRUMENT
1347                                  const int iMidiMap = pChannel->midiMap();                                  const int iMidiMap = pChannel->midiMap();
1348                                  if (midiInstrumentMap.contains(iMidiMap)) {                                  if (midiInstrumentMap.contains(iMidiMap)) {
1349                                          ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannelID                                          ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannelID
1350                                                  << " " << midiInstrumentMap.value(iMidiMap) << Qt::endl;                                                  << " " << midiInstrumentMap.value(iMidiMap) << endl;
1351                                  }                                  }
1352                          #endif                          #endif
1353                          #ifdef CONFIG_FXSEND                          #ifdef CONFIG_FXSEND
# Line 1352  bool MainForm::saveSessionFile ( const Q Line 1362  bool MainForm::saveSessionFile ( const Q
1362                                                          << " " << pFxSendInfo->midi_controller;                                                          << " " << pFxSendInfo->midi_controller;
1363                                                  if (pFxSendInfo->name)                                                  if (pFxSendInfo->name)
1364                                                          ts << " '" << pFxSendInfo->name << "'";                                                          ts << " '" << pFxSendInfo->name << "'";
1365                                                  ts << Qt::endl;                                                  ts << endl;
1366                                                  int *piRouting = pFxSendInfo->audio_routing;                                                  int *piRouting = pFxSendInfo->audio_routing;
1367                                                  for (int iAudioSrc = 0;                                                  for (int iAudioSrc = 0;
1368                                                                  piRouting && piRouting[iAudioSrc] >= 0;                                                                  piRouting && piRouting[iAudioSrc] >= 0;
# Line 1361  bool MainForm::saveSessionFile ( const Q Line 1371  bool MainForm::saveSessionFile ( const Q
1371                                                                  << iChannelID                                                                  << iChannelID
1372                                                                  << " " << iFxSend                                                                  << " " << iFxSend
1373                                                                  << " " << iAudioSrc                                                                  << " " << iAudioSrc
1374                                                                  << " " << piRouting[iAudioSrc] << Qt::endl;                                                                  << " " << piRouting[iAudioSrc] << endl;
1375                                                  }                                                  }
1376                                          #ifdef CONFIG_FXSEND_LEVEL                                          #ifdef CONFIG_FXSEND_LEVEL
1377                                                  ts << "SET FX_SEND LEVEL " << iChannelID                                                  ts << "SET FX_SEND LEVEL " << iChannelID
1378                                                          << " " << iFxSend                                                          << " " << iFxSend
1379                                                          << " " << pFxSendInfo->level << Qt::endl;                                                          << " " << pFxSendInfo->level << endl;
1380                                          #endif                                          #endif
1381                                          }       // Check for errors...                                          }       // Check for errors...
1382                                          else if (::lscp_client_get_errno(m_pClient)) {                                          else if (::lscp_client_get_errno(m_pClient)) {
# Line 1375  bool MainForm::saveSessionFile ( const Q Line 1385  bool MainForm::saveSessionFile ( const Q
1385                                          }                                          }
1386                                  }                                  }
1387                          #endif                          #endif
1388                                  ts << Qt::endl;                                  ts << endl;
1389                                  // Go for next channel...                                  // Go for next channel...
1390                                  ++iChannelID;                                  ++iChannelID;
1391                          }                          }
# Line 1385  bool MainForm::saveSessionFile ( const Q Line 1395  bool MainForm::saveSessionFile ( const Q
1395          }          }
1396    
1397  #ifdef CONFIG_VOLUME  #ifdef CONFIG_VOLUME
1398          ts << "# " << tr("Global volume level") << Qt::endl;          ts << "# " << tr("Global volume level") << endl;
1399          ts << "SET VOLUME " << ::lscp_get_volume(m_pClient) << Qt::endl;          ts << "SET VOLUME " << ::lscp_get_volume(m_pClient) << endl;
1400          ts << Qt::endl;          ts << endl;
1401  #endif  #endif
1402    
1403          // Ok. we've wrote it.          // Ok. we've wrote it.
# Line 1868  void MainForm::viewOptions (void) Line 1878  void MainForm::viewOptions (void)
1878                  if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)                  if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)
1879                          m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();                          m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();
1880                  // To track down deferred or immediate changes.                  // To track down deferred or immediate changes.
1881                  const QString sOldServerHost      = m_pOptions->sServerHost;                  const QString sOldServerHost       = m_pOptions->sServerHost;
1882                  const int     iOldServerPort      = m_pOptions->iServerPort;                  const int     iOldServerPort       = m_pOptions->iServerPort;
1883                  const int     iOldServerTimeout   = m_pOptions->iServerTimeout;                  const int     iOldServerTimeout    = m_pOptions->iServerTimeout;
1884                  const bool    bOldServerStart     = m_pOptions->bServerStart;                  const bool    bOldServerStart      = m_pOptions->bServerStart;
1885                  const QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;                  const QString sOldServerCmdLine    = m_pOptions->sServerCmdLine;
1886                  const bool    bOldMessagesLog     = m_pOptions->bMessagesLog;                  const bool    bOldMessagesLog      = m_pOptions->bMessagesLog;
1887                  const QString sOldMessagesLogPath = m_pOptions->sMessagesLogPath;                  const QString sOldMessagesLogPath  = m_pOptions->sMessagesLogPath;
1888                  const QString sOldDisplayFont     = m_pOptions->sDisplayFont;                  const QString sOldDisplayFont      = m_pOptions->sDisplayFont;
1889                  const bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;                  const bool    bOldDisplayEffect    = m_pOptions->bDisplayEffect;
1890                  const int     iOldMaxVolume       = m_pOptions->iMaxVolume;                  const int     iOldMaxVolume        = m_pOptions->iMaxVolume;
1891                  const QString sOldMessagesFont    = m_pOptions->sMessagesFont;                  const QString sOldMessagesFont     = m_pOptions->sMessagesFont;
1892                  const bool    bOldKeepOnTop       = m_pOptions->bKeepOnTop;                  const bool    bOldKeepOnTop        = m_pOptions->bKeepOnTop;
1893                  const bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;                  const bool    bOldStdoutCapture    = m_pOptions->bStdoutCapture;
1894                  const int     bOldMessagesLimit   = m_pOptions->bMessagesLimit;                  const int     bOldMessagesLimit    = m_pOptions->bMessagesLimit;
1895                  const int     iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines;                  const int     iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines;
1896                  const bool    bOldCompletePath    = m_pOptions->bCompletePath;                  const bool    bOldCompletePath     = m_pOptions->bCompletePath;
1897                  const bool    bOldInstrumentNames = m_pOptions->bInstrumentNames;                  const bool    bOldInstrumentNames  = m_pOptions->bInstrumentNames;
1898                  const int     iOldMaxRecentFiles  = m_pOptions->iMaxRecentFiles;                  const int     iOldMaxRecentFiles   = m_pOptions->iMaxRecentFiles;
1899                  const int     iOldBaseFontSize    = m_pOptions->iBaseFontSize;                  const int     iOldBaseFontSize     = m_pOptions->iBaseFontSize;
1900                    const QString sOldCustomStyleTheme = m_pOptions->sCustomStyleTheme;
1901                    const QString sOldCustomColorTheme = m_pOptions->sCustomColorTheme;
1902                  // Load the current setup settings.                  // Load the current setup settings.
1903                  pOptionsForm->setup(m_pOptions);                  pOptionsForm->setup(m_pOptions);
1904                  // Show the setup dialog...                  // Show the setup dialog...
1905                  if (pOptionsForm->exec()) {                  if (pOptionsForm->exec()) {
1906                          // Warn if something will be only effective on next run.                          // Warn if something will be only effective on next run.
1907                            int iNeedRestart = 0;
1908                          if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) ||                          if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) ||
1909                                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture) ||                                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture)) {
1910                                  ( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||                                  updateMessagesCapture();
1911                                    ++iNeedRestart;
1912                            }
1913                            if (( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||
1914                                  (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)     ||                                  (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)     ||
1915                                  (iOldBaseFontSize   !=  m_pOptions->iBaseFontSize)) {                                  (iOldBaseFontSize   !=  m_pOptions->iBaseFontSize)) {
1916                                  QMessageBox::information(this,                                  ++iNeedRestart;
1917                                          tr("Information"),                          }
1918                                          tr("Some settings may be only effective\n"                          // Check whether restart is needed or whether
1919                                          "next time you start this program."));                          // custom options maybe set up immediately...
1920                                  updateMessagesCapture();                          if (m_pOptions->sCustomStyleTheme != sOldCustomStyleTheme) {
1921                            #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
1922                                    ++iNeedRestart;
1923                            #else          
1924                                    if (m_pOptions->sCustomStyleTheme.isEmpty()) {
1925                                            ++iNeedRestart;
1926                                    } else {
1927                                            QApplication::setStyle(
1928                                                    QStyleFactory::create(m_pOptions->sCustomStyleTheme));
1929                                    }
1930                            #endif
1931                            }
1932                            if (m_pOptions->sCustomColorTheme != sOldCustomColorTheme) {
1933                            #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
1934                                    ++iNeedRestart;
1935                            #else
1936                                    if (m_pOptions->sCustomColorTheme.isEmpty()) {
1937                                            ++iNeedRestart;
1938                                    } else {
1939                                            QPalette pal;
1940                                            if (PaletteForm::namedPalette(
1941                                                            &m_pOptions->settings(), m_pOptions->sCustomColorTheme, pal))
1942                                                    QApplication::setPalette(pal);
1943                                    }
1944                            #endif
1945                          }                          }
1946                          // Check wheather something immediate has changed.                          // Check wheather something immediate has changed.
1947                          if (( bOldMessagesLog && !m_pOptions->bMessagesLog) ||                          if (( bOldMessagesLog && !m_pOptions->bMessagesLog) ||
# Line 1929  void MainForm::viewOptions (void) Line 1969  void MainForm::viewOptions (void)
1969                                  (!bOldMessagesLimit &&  m_pOptions->bMessagesLimit) ||                                  (!bOldMessagesLimit &&  m_pOptions->bMessagesLimit) ||
1970                                  (iOldMessagesLimitLines !=  m_pOptions->iMessagesLimitLines))                                  (iOldMessagesLimitLines !=  m_pOptions->iMessagesLimitLines))
1971                                  updateMessagesLimit();                                  updateMessagesLimit();
1972                            // Show restart needed message...
1973                            if (iNeedRestart > 0) {
1974                                    QMessageBox::information(this,
1975                                            tr("Information"),
1976                                            tr("Some settings may be only effective\n"
1977                                            "next time you start this program."));
1978                            }
1979                          // And now the main thing, whether we'll do client/server recycling?                          // And now the main thing, whether we'll do client/server recycling?
1980                          if ((sOldServerHost != m_pOptions->sServerHost) ||                          if ((sOldServerHost != m_pOptions->sServerHost) ||
1981                                  (iOldServerPort != m_pOptions->iServerPort) ||                                  (iOldServerPort != m_pOptions->iServerPort) ||

Legend:
Removed from v.3758  
changed lines
  Added in v.3760

  ViewVC Help
Powered by ViewVC