/[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 3014 by capela, Mon Oct 17 16:23:15 2016 UTC revision 3558 by capela, Wed Aug 21 17:10:11 2019 UTC
# Line 1  Line 1 
1  // qsamplerOptions.cpp  // qsamplerOptions.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2016, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2019, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007,2015 Christian Schoenebeck     Copyright (C) 2007,2008,2015 Christian Schoenebeck
6    
7     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License     modify it under the terms of the GNU General Public License
# 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 162  void Options::saveOptions (void) Line 165  void Options::saveOptions (void)
165  {  {
166          // Make program version available in the future.          // Make program version available in the future.
167          m_settings.beginGroup("/Program");          m_settings.beginGroup("/Program");
168          m_settings.setValue("/Version", QSAMPLER_VERSION);          m_settings.setValue("/Version", CONFIG_BUILD_VERSION);
169          m_settings.endGroup();          m_settings.endGroup();
170    
171          // And go into general options group.          // And go into general options group.
# 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    
304                  QString sArg = args.at(i);                  QString sArg = args.at(i);
305                  QString sVal = QString::null;                  QString sVal;
306                  const int iEqual = sArg.indexOf("=");                  const int iEqual = sArg.indexOf("=");
307                  if (iEqual >= 0) {                  if (iEqual >= 0) {
308                          sVal = sArg.right(sArg.length() - iEqual - 1);                          sVal = sArg.right(sArg.length() - iEqual - 1);
# 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));
340                          return false;                          return false;
341                  }                  }
342                  else if (sArg == "-v" || sArg == "--version") {                  else if (sArg == "-v" || sArg == "--version") {
343                          out << QObject::tr("Qt: %1\n")                          out << QString("Qt: %1\n")
344                                  .arg(qVersion());                                  .arg(qVersion());
345                          out << QObject::tr("%1: %2  (%3)\n")                          out << QString("%1: %2\n")
346                                  .arg(QSAMPLER_TITLE)                                  .arg(QSAMPLER_TITLE)
347                                  .arg(QSAMPLER_VERSION)                                  .arg(CONFIG_BUILD_VERSION);
                                 .arg(CONFIG_BUILD_DATE);  
348                  #ifdef CONFIG_LIBGIG                  #ifdef CONFIG_LIBGIG
349                          out << QString("%1: %2\n")                          out << QString("%1: %2\n")
350                                  .arg(gig::libraryName().c_str())                                  .arg(gig::libraryName().c_str())
# Line 357  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 375  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                  else                  }
397          #else//--LOAD_OLD_GEOMETRY          #else//--LOAD_OLD_GEOMETRY
398                  QPoint wpos;                  QPoint wpos;
399                  QSize  wsize;                  QSize  wsize;
# Line 392  void Options::loadWidgetGeometry ( QWidg Line 405  void Options::loadWidgetGeometry ( QWidg
405                          pWidget->move(wpos);                          pWidget->move(wpos);
406                  if (wsize.width() > 0 && wsize.height() > 0)                  if (wsize.width() > 0 && wsize.height() > 0)
407                          pWidget->resize(wsize);                          pWidget->resize(wsize);
                 else  
408          #endif          #endif
409                  pWidget->adjustSize();          //      else
410            //      pWidget->adjustSize();
411                  if (!bVisible)                  if (!bVisible)
412                          bVisible = m_settings.value("/visible", false).toBool();                          bVisible = m_settings.value("/visible", false).toBool();
413                  if (bVisible)                  if (bVisible)
# Line 413  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();
# Line 592  void Options::sendFineTuningSettings() { Line 605  void Options::sendFineTuningSettings() {
605    
606    
607  // end of qsamplerOptions.cpp  // end of qsamplerOptions.cpp
608    

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

  ViewVC Help
Powered by ViewVC