/[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 3820 by capela, Tue Sep 1 10:55:24 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 42  Line 46 
46  #include <QProcess>  #include <QProcess>
47  #include <QMessageBox>  #include <QMessageBox>
48    
 #include <QRegExp>  
49  #include <QTextStream>  #include <QTextStream>
50  #include <QFileDialog>  #include <QFileDialog>
51  #include <QFileInfo>  #include <QFileInfo>
# Line 74  const WindowFlags WindowCloseButtonHint Line 77  const WindowFlags WindowCloseButtonHint
77  #include <gig.h>  #include <gig.h>
78  #endif  #endif
79    
80    // Deprecated QTextStreamFunctions/Qt namespaces workaround.
81    #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
82    #define endl    Qt::endl
83    #endif
84    
85  // Needed for lroundf()  // Needed for lroundf()
86  #include <math.h>  #include <math.h>
87    
# Line 1091  bool MainForm::saveSessionFile ( const Q Line 1099  bool MainForm::saveSessionFile ( const Q
1099          // Write the file.          // Write the file.
1100          int iErrors = 0;          int iErrors = 0;
1101          QTextStream ts(&file);          QTextStream ts(&file);
1102          ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << Qt::endl;          ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl;
1103          ts << "# " << tr("Version") << ": " CONFIG_BUILD_VERSION << Qt::endl;          ts << "# " << tr("Version") << ": " CONFIG_BUILD_VERSION << endl;
1104  //      ts << "# " << tr("Build") << ": " CONFIG_BUILD_DATE << Qt::endl;  //      ts << "# " << tr("Build") << ": " CONFIG_BUILD_DATE << endl;
1105          ts << "#"  << Qt::endl;          ts << "#"  << endl;
1106          ts << "# " << tr("File")          ts << "# " << tr("File")
1107          << ": " << QFileInfo(sFilename).fileName() << Qt::endl;          << ": " << QFileInfo(sFilename).fileName() << endl;
1108          ts << "# " << tr("Date")          ts << "# " << tr("Date")
1109          << ": " << QDate::currentDate().toString("MMM dd yyyy")          << ": " << QDate::currentDate().toString("MMM dd yyyy")
1110          << " "  << QTime::currentTime().toString("hh:mm:ss") << Qt::endl;          << " "  << QTime::currentTime().toString("hh:mm:ss") << endl;
1111          ts << "#"  << Qt::endl;          ts << "#"  << endl;
1112          ts << Qt::endl;          ts << endl;
1113    
1114          // It is assumed that this new kind of device+session file          // It is assumed that this new kind of device+session file
1115          // will be loaded from a complete initialized server...          // will be loaded from a complete initialized server...
1116          int *piDeviceIDs;          int *piDeviceIDs;
1117          int  i, iDevice;          int  i, iDevice;
1118          ts << "RESET" << Qt::endl;          ts << "RESET" << endl;
1119    
1120          // Audio device mapping.          // Audio device mapping.
1121          QMap<int, int> audioDeviceMap; iDevice = 0;          QMap<int, int> audioDeviceMap; iDevice = 0;
# Line 1118  bool MainForm::saveSessionFile ( const Q Line 1126  bool MainForm::saveSessionFile ( const Q
1126                  if (device.driverName().toUpper() == "PLUGIN")                  if (device.driverName().toUpper() == "PLUGIN")
1127                          continue;                          continue;
1128                  // Audio device specification...                  // Audio device specification...
1129                  ts << Qt::endl;                  ts << endl;
1130                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
1131                          << " " << tr("Device") << " " << iDevice << Qt::endl;                          << " " << tr("Device") << " " << iDevice << endl;
1132                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();
1133                  DeviceParamMap::ConstIterator deviceParam;                  DeviceParamMap::ConstIterator deviceParam;
1134                  for (deviceParam = device.params().begin();                  for (deviceParam = device.params().begin();
# Line 1130  bool MainForm::saveSessionFile ( const Q Line 1138  bool MainForm::saveSessionFile ( const Q
1138                          if (param.value.isEmpty()) ts << "# ";                          if (param.value.isEmpty()) ts << "# ";
1139                          ts << " " << deviceParam.key() << "='" << param.value << "'";                          ts << " " << deviceParam.key() << "='" << param.value << "'";
1140                  }                  }
1141                  ts << Qt::endl;                  ts << endl;
1142                  // Audio channel parameters...                  // Audio channel parameters...
1143                  int iPort = 0;                  int iPort = 0;
1144                  QListIterator<DevicePort *> iter(device.ports());                  QListIterator<DevicePort *> iter(device.ports());
# Line 1144  bool MainForm::saveSessionFile ( const Q Line 1152  bool MainForm::saveSessionFile ( const Q
1152                                  if (param.fix || param.value.isEmpty()) ts << "# ";                                  if (param.fix || param.value.isEmpty()) ts << "# ";
1153                                  ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice                                  ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice
1154                                          << " " << iPort << " " << portParam.key()                                          << " " << iPort << " " << portParam.key()
1155                                          << "='" << param.value << "'" << Qt::endl;                                          << "='" << param.value << "'" << endl;
1156                          }                          }
1157                          iPort++;                          iPort++;
1158                  }                  }
# Line 1163  bool MainForm::saveSessionFile ( const Q Line 1171  bool MainForm::saveSessionFile ( const Q
1171                  if (device.driverName().toUpper() == "PLUGIN")                  if (device.driverName().toUpper() == "PLUGIN")
1172                          continue;                          continue;
1173                  // MIDI device specification...                  // MIDI device specification...
1174                  ts << Qt::endl;                  ts << endl;
1175                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
1176                          << " " << tr("Device") << " " << iDevice << Qt::endl;                          << " " << tr("Device") << " " << iDevice << endl;
1177                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();
1178                  DeviceParamMap::ConstIterator deviceParam;                  DeviceParamMap::ConstIterator deviceParam;
1179                  for (deviceParam = device.params().begin();                  for (deviceParam = device.params().begin();
# Line 1175  bool MainForm::saveSessionFile ( const Q Line 1183  bool MainForm::saveSessionFile ( const Q
1183                          if (param.value.isEmpty()) ts << "# ";                          if (param.value.isEmpty()) ts << "# ";
1184                          ts << " " << deviceParam.key() << "='" << param.value << "'";                          ts << " " << deviceParam.key() << "='" << param.value << "'";
1185                  }                  }
1186                  ts << Qt::endl;                  ts << endl;
1187                  // MIDI port parameters...                  // MIDI port parameters...
1188                  int iPort = 0;                  int iPort = 0;
1189                  QListIterator<DevicePort *> iter(device.ports());                  QListIterator<DevicePort *> iter(device.ports());
# Line 1189  bool MainForm::saveSessionFile ( const Q Line 1197  bool MainForm::saveSessionFile ( const Q
1197                                  if (param.fix || param.value.isEmpty()) ts << "# ";                                  if (param.fix || param.value.isEmpty()) ts << "# ";
1198                                  ts << "SET MIDI_INPUT_PORT_PARAMETER " << iDevice                                  ts << "SET MIDI_INPUT_PORT_PARAMETER " << iDevice
1199                                  << " " << iPort << " " << portParam.key()                                  << " " << iPort << " " << portParam.key()
1200                                  << "='" << param.value << "'" << Qt::endl;                                  << "='" << param.value << "'" << endl;
1201                          }                          }
1202                          iPort++;                          iPort++;
1203                  }                  }
# Line 1198  bool MainForm::saveSessionFile ( const Q Line 1206  bool MainForm::saveSessionFile ( const Q
1206                  // Try to keep it snappy :)                  // Try to keep it snappy :)
1207                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
1208          }          }
1209          ts << Qt::endl;          ts << endl;
1210    
1211  #ifdef CONFIG_MIDI_INSTRUMENT  #ifdef CONFIG_MIDI_INSTRUMENT
1212          // MIDI instrument mapping...          // MIDI instrument mapping...
# Line 1211  bool MainForm::saveSessionFile ( const Q Line 1219  bool MainForm::saveSessionFile ( const Q
1219                  ts << "# " << tr("MIDI instrument map") << " " << iMap;                  ts << "# " << tr("MIDI instrument map") << " " << iMap;
1220                  if (pszMapName)                  if (pszMapName)
1221                          ts << " - " << pszMapName;                          ts << " - " << pszMapName;
1222                  ts << Qt::endl;                  ts << endl;
1223                  ts << "ADD MIDI_INSTRUMENT_MAP";                  ts << "ADD MIDI_INSTRUMENT_MAP";
1224                  if (pszMapName)                  if (pszMapName)
1225                          ts << " '" << pszMapName << "'";                          ts << " '" << pszMapName << "'";
1226                  ts << Qt::endl;                  ts << endl;
1227                  // MIDI instrument mapping...                  // MIDI instrument mapping...
1228                  lscp_midi_instrument_t *pInstrs                  lscp_midi_instrument_t *pInstrs
1229                          = ::lscp_list_midi_instruments(m_pClient, iMidiMap);                          = ::lscp_list_midi_instruments(m_pClient, iMidiMap);
# Line 1246  bool MainForm::saveSessionFile ( const Q Line 1254  bool MainForm::saveSessionFile ( const Q
1254                                  }                                  }
1255                                  if (pInstrInfo->name)                                  if (pInstrInfo->name)
1256                                          ts << " '" << pInstrInfo->name << "'";                                          ts << " '" << pInstrInfo->name << "'";
1257                                  ts << Qt::endl;                                  ts << endl;
1258                          }       // Check for errors...                          }       // Check for errors...
1259                          else if (::lscp_client_get_errno(m_pClient)) {                          else if (::lscp_client_get_errno(m_pClient)) {
1260                                  appendMessagesClient("lscp_get_midi_instrument_info");                                  appendMessagesClient("lscp_get_midi_instrument_info");
# Line 1255  bool MainForm::saveSessionFile ( const Q Line 1263  bool MainForm::saveSessionFile ( const Q
1263                          // Try to keep it snappy :)                          // Try to keep it snappy :)
1264                          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
1265                  }                  }
1266                  ts << Qt::endl;                  ts << endl;
1267                  // Check for errors...                  // Check for errors...
1268                  if (pInstrs == nullptr && ::lscp_client_get_errno(m_pClient)) {                  if (pInstrs == nullptr && ::lscp_client_get_errno(m_pClient)) {
1269                          appendMessagesClient("lscp_list_midi_instruments");                          appendMessagesClient("lscp_list_midi_instruments");
# Line 1289  bool MainForm::saveSessionFile ( const Q Line 1297  bool MainForm::saveSessionFile ( const Q
1297                                  if (!midiDeviceMap.contains(iMidiDevice))                                  if (!midiDeviceMap.contains(iMidiDevice))
1298                                          continue;                                          continue;
1299                                  // Go for regular, canonical devices...                                  // Go for regular, canonical devices...
1300                                  ts << "# " << tr("Channel") << " " << iChannelID << Qt::endl;                                  ts << "# " << tr("Channel") << " " << iChannelID << endl;
1301                                  ts << "ADD CHANNEL" << Qt::endl;                                  ts << "ADD CHANNEL" << endl;
1302                                  if (audioDeviceMap.isEmpty()) {                                  if (audioDeviceMap.isEmpty()) {
1303                                          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID                                          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID
1304                                                  << " " << pChannel->audioDriver() << Qt::endl;                                                  << " " << pChannel->audioDriver() << endl;
1305                                  } else {                                  } else {
1306                                          ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannelID                                          ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannelID
1307                                                  << " " << audioDeviceMap.value(iAudioDevice) << Qt::endl;                                                  << " " << audioDeviceMap.value(iAudioDevice) << endl;
1308                                  }                                  }
1309                                  if (midiDeviceMap.isEmpty()) {                                  if (midiDeviceMap.isEmpty()) {
1310                                          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID                                          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID
1311                                                  << " " << pChannel->midiDriver() << Qt::endl;                                                  << " " << pChannel->midiDriver() << endl;
1312                                  } else {                                  } else {
1313                                          ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannelID                                          ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannelID
1314                                                  << " " << midiDeviceMap.value(iMidiDevice) << Qt::endl;                                                  << " " << midiDeviceMap.value(iMidiDevice) << endl;
1315                                  }                                  }
1316                                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID                                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID
1317                                          << " " << pChannel->midiPort() << Qt::endl;                                          << " " << pChannel->midiPort() << endl;
1318                                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " ";                                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " ";
1319                                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)                                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)
1320                                          ts << "ALL";                                          ts << "ALL";
1321                                  else                                  else
1322                                          ts << pChannel->midiChannel();                                          ts << pChannel->midiChannel();
1323                                  ts << Qt::endl;                                  ts << endl;
1324                                  ts << "LOAD ENGINE " << pChannel->engineName()                                  ts << "LOAD ENGINE " << pChannel->engineName()
1325                                          << " " << iChannelID << Qt::endl;                                          << " " << iChannelID << endl;
1326                                  if (pChannel->instrumentStatus() < 100) ts << "# ";                                  if (pChannel->instrumentStatus() < 100) ts << "# ";
1327                                  ts << "LOAD INSTRUMENT NON_MODAL '"                                  ts << "LOAD INSTRUMENT NON_MODAL '"
1328                                          << pChannel->instrumentFile() << "' "                                          << pChannel->instrumentFile() << "' "
1329                                          << pChannel->instrumentNr() << " " << iChannelID << Qt::endl;                                          << pChannel->instrumentNr() << " " << iChannelID << endl;
1330                                  ChannelRoutingMap::ConstIterator audioRoute;                                  ChannelRoutingMap::ConstIterator audioRoute;
1331                                  for (audioRoute = pChannel->audioRouting().begin();                                  for (audioRoute = pChannel->audioRouting().begin();
1332                                                  audioRoute != pChannel->audioRouting().end();                                                  audioRoute != pChannel->audioRouting().end();
1333                                                          ++audioRoute) {                                                          ++audioRoute) {
1334                                          ts << "SET CHANNEL AUDIO_OUTPUT_CHANNEL " << iChannelID                                          ts << "SET CHANNEL AUDIO_OUTPUT_CHANNEL " << iChannelID
1335                                                  << " " << audioRoute.key()                                                  << " " << audioRoute.key()
1336                                                  << " " << audioRoute.value() << Qt::endl;                                                  << " " << audioRoute.value() << endl;
1337                                  }                                  }
1338                                  ts << "SET CHANNEL VOLUME " << iChannelID                                  ts << "SET CHANNEL VOLUME " << iChannelID
1339                                          << " " << pChannel->volume() << Qt::endl;                                          << " " << pChannel->volume() << endl;
1340                                  if (pChannel->channelMute())                                  if (pChannel->channelMute())
1341                                          ts << "SET CHANNEL MUTE " << iChannelID << " 1" << Qt::endl;                                          ts << "SET CHANNEL MUTE " << iChannelID << " 1" << endl;
1342                                  if (pChannel->channelSolo())                                  if (pChannel->channelSolo())
1343                                          ts << "SET CHANNEL SOLO " << iChannelID << " 1" << Qt::endl;                                          ts << "SET CHANNEL SOLO " << iChannelID << " 1" << endl;
1344                          #ifdef CONFIG_MIDI_INSTRUMENT                          #ifdef CONFIG_MIDI_INSTRUMENT
1345                                  const int iMidiMap = pChannel->midiMap();                                  const int iMidiMap = pChannel->midiMap();
1346                                  if (midiInstrumentMap.contains(iMidiMap)) {                                  if (midiInstrumentMap.contains(iMidiMap)) {
1347                                          ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannelID                                          ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannelID
1348                                                  << " " << midiInstrumentMap.value(iMidiMap) << Qt::endl;                                                  << " " << midiInstrumentMap.value(iMidiMap) << endl;
1349                                  }                                  }
1350                          #endif                          #endif
1351                          #ifdef CONFIG_FXSEND                          #ifdef CONFIG_FXSEND
# Line 1352  bool MainForm::saveSessionFile ( const Q Line 1360  bool MainForm::saveSessionFile ( const Q
1360                                                          << " " << pFxSendInfo->midi_controller;                                                          << " " << pFxSendInfo->midi_controller;
1361                                                  if (pFxSendInfo->name)                                                  if (pFxSendInfo->name)
1362                                                          ts << " '" << pFxSendInfo->name << "'";                                                          ts << " '" << pFxSendInfo->name << "'";
1363                                                  ts << Qt::endl;                                                  ts << endl;
1364                                                  int *piRouting = pFxSendInfo->audio_routing;                                                  int *piRouting = pFxSendInfo->audio_routing;
1365                                                  for (int iAudioSrc = 0;                                                  for (int iAudioSrc = 0;
1366                                                                  piRouting && piRouting[iAudioSrc] >= 0;                                                                  piRouting && piRouting[iAudioSrc] >= 0;
# Line 1361  bool MainForm::saveSessionFile ( const Q Line 1369  bool MainForm::saveSessionFile ( const Q
1369                                                                  << iChannelID                                                                  << iChannelID
1370                                                                  << " " << iFxSend                                                                  << " " << iFxSend
1371                                                                  << " " << iAudioSrc                                                                  << " " << iAudioSrc
1372                                                                  << " " << piRouting[iAudioSrc] << Qt::endl;                                                                  << " " << piRouting[iAudioSrc] << endl;
1373                                                  }                                                  }
1374                                          #ifdef CONFIG_FXSEND_LEVEL                                          #ifdef CONFIG_FXSEND_LEVEL
1375                                                  ts << "SET FX_SEND LEVEL " << iChannelID                                                  ts << "SET FX_SEND LEVEL " << iChannelID
1376                                                          << " " << iFxSend                                                          << " " << iFxSend
1377                                                          << " " << pFxSendInfo->level << Qt::endl;                                                          << " " << pFxSendInfo->level << endl;
1378                                          #endif                                          #endif
1379                                          }       // Check for errors...                                          }       // Check for errors...
1380                                          else if (::lscp_client_get_errno(m_pClient)) {                                          else if (::lscp_client_get_errno(m_pClient)) {
# Line 1375  bool MainForm::saveSessionFile ( const Q Line 1383  bool MainForm::saveSessionFile ( const Q
1383                                          }                                          }
1384                                  }                                  }
1385                          #endif                          #endif
1386                                  ts << Qt::endl;                                  ts << endl;
1387                                  // Go for next channel...                                  // Go for next channel...
1388                                  ++iChannelID;                                  ++iChannelID;
1389                          }                          }
# Line 1385  bool MainForm::saveSessionFile ( const Q Line 1393  bool MainForm::saveSessionFile ( const Q
1393          }          }
1394    
1395  #ifdef CONFIG_VOLUME  #ifdef CONFIG_VOLUME
1396          ts << "# " << tr("Global volume level") << Qt::endl;          ts << "# " << tr("Global volume level") << endl;
1397          ts << "SET VOLUME " << ::lscp_get_volume(m_pClient) << Qt::endl;          ts << "SET VOLUME " << ::lscp_get_volume(m_pClient) << endl;
1398          ts << Qt::endl;          ts << endl;
1399  #endif  #endif
1400    
1401          // Ok. we've wrote it.          // Ok. we've wrote it.
# Line 1868  void MainForm::viewOptions (void) Line 1876  void MainForm::viewOptions (void)
1876                  if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)                  if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)
1877                          m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();                          m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();
1878                  // To track down deferred or immediate changes.                  // To track down deferred or immediate changes.
1879                  const QString sOldServerHost      = m_pOptions->sServerHost;                  const QString sOldServerHost       = m_pOptions->sServerHost;
1880                  const int     iOldServerPort      = m_pOptions->iServerPort;                  const int     iOldServerPort       = m_pOptions->iServerPort;
1881                  const int     iOldServerTimeout   = m_pOptions->iServerTimeout;                  const int     iOldServerTimeout    = m_pOptions->iServerTimeout;
1882                  const bool    bOldServerStart     = m_pOptions->bServerStart;                  const bool    bOldServerStart      = m_pOptions->bServerStart;
1883                  const QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;                  const QString sOldServerCmdLine    = m_pOptions->sServerCmdLine;
1884                  const bool    bOldMessagesLog     = m_pOptions->bMessagesLog;                  const bool    bOldMessagesLog      = m_pOptions->bMessagesLog;
1885                  const QString sOldMessagesLogPath = m_pOptions->sMessagesLogPath;                  const QString sOldMessagesLogPath  = m_pOptions->sMessagesLogPath;
1886                  const QString sOldDisplayFont     = m_pOptions->sDisplayFont;                  const QString sOldDisplayFont      = m_pOptions->sDisplayFont;
1887                  const bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;                  const bool    bOldDisplayEffect    = m_pOptions->bDisplayEffect;
1888                  const int     iOldMaxVolume       = m_pOptions->iMaxVolume;                  const int     iOldMaxVolume        = m_pOptions->iMaxVolume;
1889                  const QString sOldMessagesFont    = m_pOptions->sMessagesFont;                  const QString sOldMessagesFont     = m_pOptions->sMessagesFont;
1890                  const bool    bOldKeepOnTop       = m_pOptions->bKeepOnTop;                  const bool    bOldKeepOnTop        = m_pOptions->bKeepOnTop;
1891                  const bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;                  const bool    bOldStdoutCapture    = m_pOptions->bStdoutCapture;
1892                  const int     bOldMessagesLimit   = m_pOptions->bMessagesLimit;                  const int     bOldMessagesLimit    = m_pOptions->bMessagesLimit;
1893                  const int     iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines;                  const int     iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines;
1894                  const bool    bOldCompletePath    = m_pOptions->bCompletePath;                  const bool    bOldCompletePath     = m_pOptions->bCompletePath;
1895                  const bool    bOldInstrumentNames = m_pOptions->bInstrumentNames;                  const bool    bOldInstrumentNames  = m_pOptions->bInstrumentNames;
1896                  const int     iOldMaxRecentFiles  = m_pOptions->iMaxRecentFiles;                  const int     iOldMaxRecentFiles   = m_pOptions->iMaxRecentFiles;
1897                  const int     iOldBaseFontSize    = m_pOptions->iBaseFontSize;                  const int     iOldBaseFontSize     = m_pOptions->iBaseFontSize;
1898                    const QString sOldCustomStyleTheme = m_pOptions->sCustomStyleTheme;
1899                    const QString sOldCustomColorTheme = m_pOptions->sCustomColorTheme;
1900                  // Load the current setup settings.                  // Load the current setup settings.
1901                  pOptionsForm->setup(m_pOptions);                  pOptionsForm->setup(m_pOptions);
1902                  // Show the setup dialog...                  // Show the setup dialog...
1903                  if (pOptionsForm->exec()) {                  if (pOptionsForm->exec()) {
1904                          // Warn if something will be only effective on next run.                          // Warn if something will be only effective on next run.
1905                            int iNeedRestart = 0;
1906                          if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) ||                          if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) ||
1907                                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture) ||                                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture)) {
1908                                  ( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||                                  updateMessagesCapture();
1909                                    ++iNeedRestart;
1910                            }
1911                            if (( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||
1912                                  (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)     ||                                  (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)     ||
1913                                  (iOldBaseFontSize   !=  m_pOptions->iBaseFontSize)) {                                  (iOldBaseFontSize   !=  m_pOptions->iBaseFontSize)) {
1914                                  QMessageBox::information(this,                                  ++iNeedRestart;
1915                                          tr("Information"),                          }
1916                                          tr("Some settings may be only effective\n"                          // Check whether restart is needed or whether
1917                                          "next time you start this program."));                          // custom options maybe set up immediately...
1918                                  updateMessagesCapture();                          if (m_pOptions->sCustomStyleTheme != sOldCustomStyleTheme) {
1919                                    if (m_pOptions->sCustomStyleTheme.isEmpty()) {
1920                                            ++iNeedRestart;
1921                                    } else {
1922                                            QApplication::setStyle(
1923                                                    QStyleFactory::create(m_pOptions->sCustomStyleTheme));
1924                                    }
1925                            }
1926                            if (m_pOptions->sCustomColorTheme != sOldCustomColorTheme) {
1927                                    if (m_pOptions->sCustomColorTheme.isEmpty()) {
1928                                            ++iNeedRestart;
1929                                    } else {
1930                                            QPalette pal;
1931                                            if (PaletteForm::namedPalette(
1932                                                            &m_pOptions->settings(), m_pOptions->sCustomColorTheme, pal))
1933                                                    QApplication::setPalette(pal);
1934                                    }
1935                          }                          }
1936                          // Check wheather something immediate has changed.                          // Check wheather something immediate has changed.
1937                          if (( bOldMessagesLog && !m_pOptions->bMessagesLog) ||                          if (( bOldMessagesLog && !m_pOptions->bMessagesLog) ||
# Line 1929  void MainForm::viewOptions (void) Line 1959  void MainForm::viewOptions (void)
1959                                  (!bOldMessagesLimit &&  m_pOptions->bMessagesLimit) ||                                  (!bOldMessagesLimit &&  m_pOptions->bMessagesLimit) ||
1960                                  (iOldMessagesLimitLines !=  m_pOptions->iMessagesLimitLines))                                  (iOldMessagesLimitLines !=  m_pOptions->iMessagesLimitLines))
1961                                  updateMessagesLimit();                                  updateMessagesLimit();
1962                            // Show restart needed message...
1963                            if (iNeedRestart > 0) {
1964                                    QMessageBox::information(this,
1965                                            tr("Information"),
1966                                            tr("Some settings may be only effective\n"
1967                                            "next time you start this program."));
1968                            }
1969                          // And now the main thing, whether we'll do client/server recycling?                          // And now the main thing, whether we'll do client/server recycling?
1970                          if ((sOldServerHost != m_pOptions->sServerHost) ||                          if ((sOldServerHost != m_pOptions->sServerHost) ||
1971                                  (iOldServerPort != m_pOptions->iServerPort) ||                                  (iOldServerPort != m_pOptions->iServerPort) ||
# Line 2456  void MainForm::updateMaxVolume (void) Line 2493  void MainForm::updateMaxVolume (void)
2493  // QSampler::MainForm -- Messages window form handlers.  // QSampler::MainForm -- Messages window form handlers.
2494    
2495  // Messages output methods.  // Messages output methods.
2496  void MainForm::appendMessages( const QString& s )  void MainForm::appendMessages ( const QString& s )
2497  {  {
2498          if (m_pMessages)          if (m_pMessages)
2499                  m_pMessages->appendMessages(s);                  m_pMessages->appendMessages(s);
# Line 2464  void MainForm::appendMessages( const QSt Line 2501  void MainForm::appendMessages( const QSt
2501          statusBar()->showMessage(s, 3000);          statusBar()->showMessage(s, 3000);
2502  }  }
2503    
2504  void MainForm::appendMessagesColor( const QString& s, const QString& c )  void MainForm::appendMessagesColor ( const QString& s, const QColor& rgb )
2505  {  {
2506          if (m_pMessages)          if (m_pMessages)
2507                  m_pMessages->appendMessagesColor(s, c);                  m_pMessages->appendMessagesColor(s, rgb);
2508    
2509          statusBar()->showMessage(s, 3000);          statusBar()->showMessage(s, 3000);
2510  }  }
2511    
2512  void MainForm::appendMessagesText( const QString& s )  void MainForm::appendMessagesText ( const QString& s )
2513  {  {
2514          if (m_pMessages)          if (m_pMessages)
2515                  m_pMessages->appendMessagesText(s);                  m_pMessages->appendMessagesText(s);
2516  }  }
2517    
2518  void MainForm::appendMessagesError( const QString& sText )  void MainForm::appendMessagesError ( const QString& s )
2519  {  {
2520          if (m_pMessages)          if (m_pMessages)
2521                  m_pMessages->show();                  m_pMessages->show();
2522    
2523          appendMessagesColor(sText.simplified(), "#ff0000");          appendMessagesColor(s.simplified(), Qt::red);
2524    
2525          // Make it look responsive...:)          // Make it look responsive...:)
2526          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
# Line 2496  void MainForm::appendMessagesError( cons Line 2533  void MainForm::appendMessagesError( cons
2533                  QMessageBox mbox(this);                  QMessageBox mbox(this);
2534                  mbox.setIcon(QMessageBox::Critical);                  mbox.setIcon(QMessageBox::Critical);
2535                  mbox.setWindowTitle(sTitle);                  mbox.setWindowTitle(sTitle);
2536                  mbox.setText(sText);                  mbox.setText(s);
2537                  mbox.setStandardButtons(QMessageBox::Cancel);                  mbox.setStandardButtons(QMessageBox::Cancel);
2538                  QCheckBox cbox(tr("Don't show this again"));                  QCheckBox cbox(tr("Don't show this again"));
2539                  cbox.setChecked(false);                  cbox.setChecked(false);

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

  ViewVC Help
Powered by ViewVC