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

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

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

revision 3518 by capela, Sun Jun 30 16:58:30 2019 UTC revision 3558 by capela, Wed Aug 21 17:10:11 2019 UTC
# Line 27  Line 27 
27  #include <QTextStream>  #include <QTextStream>
28  #include <QComboBox>  #include <QComboBox>
29    
30    #include <QApplication>
31    #include <QDesktopWidget>
32    
33  #include <lscp/client.h>  #include <lscp/client.h>
34    
35  #ifdef CONFIG_LIBGIG  #ifdef CONFIG_LIBGIG
# Line 286  bool Options::parse_args ( const QString Line 289  bool Options::parse_args ( const QString
289  {  {
290          QTextStream out(stderr);          QTextStream out(stderr);
291          const QString sEol = "\n\n";          const QString sEol = "\n\n";
         int iCmdArgs = 0;  
292          const int argc = args.count();          const int argc = args.count();
293            int iCmdArgs = 0;
294    
295          for (int i = 1; i < argc; i++) {          for (int i = 1; i < argc; ++i) {
296    
297                  if (iCmdArgs > 0) {                  if (iCmdArgs > 0) {
298                          sSessionFile += " ";                          sSessionFile += " ";
299                          sSessionFile += args.at(i);                          sSessionFile += args.at(i);
300                          iCmdArgs++;                          ++iCmdArgs;
301                          continue;                          continue;
302                  }                  }
303    
# Line 321  bool Options::parse_args ( const QString Line 324  bool Options::parse_args ( const QString
324                          }                          }
325                          sServerHost = sVal;                          sServerHost = sVal;
326                          if (iEqual < 0)                          if (iEqual < 0)
327                                  i++;                                  ++i;
328                  }                  }
329                  else if (sArg == "-p" || sArg == "--port") {                  else if (sArg == "-p" || sArg == "--port") {
330                          if (sVal.isNull()) {                          if (sVal.isNull()) {
# Line 330  bool Options::parse_args ( const QString Line 333  bool Options::parse_args ( const QString
333                          }                          }
334                          iServerPort = sVal.toInt();                          iServerPort = sVal.toInt();
335                          if (iEqual < 0)                          if (iEqual < 0)
336                                  i++;                                  ++i;
337                  }                  }
338                  else if (sArg == "-?" || sArg == "--help") {                  else if (sArg == "-?" || sArg == "--help") {
339                          print_usage(args.at(0));                          print_usage(args.at(0));
# Line 356  bool Options::parse_args ( const QString Line 359  bool Options::parse_args ( const QString
359                          // If we don't have one by now,                          // If we don't have one by now,
360                          // this will be the startup sesion file...                          // this will be the startup sesion file...
361                          sSessionFile += sArg;                          sSessionFile += sArg;
362                          iCmdArgs++;                          ++iCmdArgs;
363                  }                  }
364          }          }
365    
# Line 374  void Options::loadWidgetGeometry ( QWidg Line 377  void Options::loadWidgetGeometry ( QWidg
377          if (pWidget) {          if (pWidget) {
378          //      if (bVisible) pWidget->show(); -- force initial exposure?          //      if (bVisible) pWidget->show(); -- force initial exposure?
379                  m_settings.beginGroup("/Geometry/" + pWidget->objectName());                  m_settings.beginGroup("/Geometry/" + pWidget->objectName());
380          #if QT_VERSION >= 0x050000          #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
381                  const QByteArray& geometry                  const QByteArray& geometry
382                          = m_settings.value("/geometry").toByteArray();                          = m_settings.value("/geometry").toByteArray();
383                  if (!geometry.isEmpty())                  if (geometry.isEmpty()) {
384                            QWidget *pParent = pWidget->parentWidget();
385                            if (pParent)
386                                    pParent = pParent->window();
387                            if (pParent == nullptr)
388                                    pParent = QApplication::desktop();
389                            if (pParent) {
390                                    QRect wrect(pWidget->geometry());
391                                    wrect.moveCenter(pParent->geometry().center());
392                                    pWidget->move(wrect.topLeft());
393                            }
394                    } else {
395                          pWidget->restoreGeometry(geometry);                          pWidget->restoreGeometry(geometry);
396                    }
397          #else//--LOAD_OLD_GEOMETRY          #else//--LOAD_OLD_GEOMETRY
398                  QPoint wpos;                  QPoint wpos;
399                  QSize  wsize;                  QSize  wsize;
# Line 411  void Options::saveWidgetGeometry ( QWidg Line 426  void Options::saveWidgetGeometry ( QWidg
426          // only save the form geometry while its up and visible)          // only save the form geometry while its up and visible)
427          if (pWidget) {          if (pWidget) {
428                  m_settings.beginGroup("/Geometry/" + pWidget->objectName());                  m_settings.beginGroup("/Geometry/" + pWidget->objectName());
429          #if QT_VERSION >= 0x050000          #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
430                  m_settings.setValue("/geometry", pWidget->saveGeometry());                  m_settings.setValue("/geometry", pWidget->saveGeometry());
431          #else//--SAVE_OLD_GEOMETRY          #else//--SAVE_OLD_GEOMETRY
432                  const QPoint& wpos  = pWidget->pos();                  const QPoint& wpos  = pWidget->pos();

Legend:
Removed from v.3518  
changed lines
  Added in v.3558

  ViewVC Help
Powered by ViewVC