1 |
// qsamplerOptions.cpp |
// qsamplerOptions.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2015, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2016, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007,2015 Christian Schoenebeck |
Copyright (C) 2007,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 |
337 |
return false; |
return false; |
338 |
} |
} |
339 |
else if (sArg == "-v" || sArg == "--version") { |
else if (sArg == "-v" || sArg == "--version") { |
340 |
out << QObject::tr("Qt: %1\n").arg(qVersion()); |
out << QObject::tr("Qt: %1\n") |
341 |
|
.arg(qVersion()); |
342 |
|
out << QObject::tr("%1: %2 (%3)\n") |
343 |
|
.arg(QSAMPLER_TITLE) |
344 |
|
.arg(QSAMPLER_VERSION) |
345 |
|
.arg(CONFIG_BUILD_DATE); |
346 |
#ifdef CONFIG_LIBGIG |
#ifdef CONFIG_LIBGIG |
347 |
out << QString("%1: %2\n") |
out << QString("%1: %2\n") |
348 |
.arg(gig::libraryName().c_str()) |
.arg(gig::libraryName().c_str()) |
351 |
out << QString("%1: %2\n") |
out << QString("%1: %2\n") |
352 |
.arg(::lscp_client_package()) |
.arg(::lscp_client_package()) |
353 |
.arg(::lscp_client_version()); |
.arg(::lscp_client_version()); |
|
out << QObject::tr(QSAMPLER_TITLE ": %1\n").arg(QSAMPLER_VERSION); |
|
354 |
return false; |
return false; |
355 |
} |
} |
356 |
else { |
else { |
373 |
{ |
{ |
374 |
// Try to restore old form window positioning. |
// Try to restore old form window positioning. |
375 |
if (pWidget) { |
if (pWidget) { |
376 |
|
// if (bVisible) pWidget->show(); -- force initial exposure? |
377 |
|
m_settings.beginGroup("/Geometry/" + pWidget->objectName()); |
378 |
|
#if QT_VERSION >= 0x050000 |
379 |
|
const QByteArray& geometry |
380 |
|
= m_settings.value("/geometry").toByteArray(); |
381 |
|
if (!geometry.isEmpty()) |
382 |
|
pWidget->restoreGeometry(geometry); |
383 |
|
else |
384 |
|
#else//--LOAD_OLD_GEOMETRY |
385 |
QPoint wpos; |
QPoint wpos; |
386 |
QSize wsize; |
QSize wsize; |
|
m_settings.beginGroup("/Geometry/" + pWidget->objectName()); |
|
387 |
wpos.setX(m_settings.value("/x", -1).toInt()); |
wpos.setX(m_settings.value("/x", -1).toInt()); |
388 |
wpos.setY(m_settings.value("/y", -1).toInt()); |
wpos.setY(m_settings.value("/y", -1).toInt()); |
389 |
wsize.setWidth(m_settings.value("/width", -1).toInt()); |
wsize.setWidth(m_settings.value("/width", -1).toInt()); |
390 |
wsize.setHeight(m_settings.value("/height", -1).toInt()); |
wsize.setHeight(m_settings.value("/height", -1).toInt()); |
|
if (!bVisible) bVisible = m_settings.value("/visible", false).toBool(); |
|
|
m_settings.endGroup(); |
|
391 |
if (wpos.x() > 0 && wpos.y() > 0) |
if (wpos.x() > 0 && wpos.y() > 0) |
392 |
pWidget->move(wpos); |
pWidget->move(wpos); |
393 |
if (wsize.width() > 0 && wsize.height() > 0) |
if (wsize.width() > 0 && wsize.height() > 0) |
394 |
pWidget->resize(wsize); |
pWidget->resize(wsize); |
395 |
// else |
else |
396 |
// pWidget->adjustSize(); |
#endif |
397 |
|
pWidget->adjustSize(); |
398 |
|
if (!bVisible) |
399 |
|
bVisible = m_settings.value("/visible", false).toBool(); |
400 |
if (bVisible) |
if (bVisible) |
401 |
pWidget->show(); |
pWidget->show(); |
402 |
// else |
else |
403 |
// pWidget->hide(); |
pWidget->hide(); |
404 |
|
m_settings.endGroup(); |
405 |
} |
} |
406 |
} |
} |
407 |
|
|
413 |
// only save the form geometry while its up and visible) |
// only save the form geometry while its up and visible) |
414 |
if (pWidget) { |
if (pWidget) { |
415 |
m_settings.beginGroup("/Geometry/" + pWidget->objectName()); |
m_settings.beginGroup("/Geometry/" + pWidget->objectName()); |
416 |
|
#if QT_VERSION >= 0x050000 |
417 |
|
m_settings.setValue("/geometry", pWidget->saveGeometry()); |
418 |
|
#else//--SAVE_OLD_GEOMETRY |
419 |
const QPoint& wpos = pWidget->pos(); |
const QPoint& wpos = pWidget->pos(); |
420 |
const QSize& wsize = pWidget->size(); |
const QSize& wsize = pWidget->size(); |
|
if (!bVisible) bVisible = pWidget->isVisible(); |
|
421 |
m_settings.setValue("/x", wpos.x()); |
m_settings.setValue("/x", wpos.x()); |
422 |
m_settings.setValue("/y", wpos.y()); |
m_settings.setValue("/y", wpos.y()); |
423 |
m_settings.setValue("/width", wsize.width()); |
m_settings.setValue("/width", wsize.width()); |
424 |
m_settings.setValue("/height", wsize.height()); |
m_settings.setValue("/height", wsize.height()); |
425 |
|
#endif |
426 |
|
if (!bVisible) bVisible = pWidget->isVisible(); |
427 |
m_settings.setValue("/visible", bVisible); |
m_settings.setValue("/visible", bVisible); |
428 |
m_settings.endGroup(); |
m_settings.endGroup(); |
429 |
} |
} |