Mercurial > hg > sonic-visualiser
comparison main/main.cpp @ 624:c0a20cd1a9ff
If maximised on exit, don't save (maximised) geometry but instead mark as maximised and maximise on restart
author | Chris Cannam |
---|---|
date | Fri, 20 Sep 2013 16:38:00 +0100 |
parents | fba4839f8811 |
children | 763b1fbeb31c 6d8a76bd91a7 |
comparison
equal
deleted
inserted
replaced
622:2093255c8203 | 624:c0a20cd1a9ff |
---|---|
361 int height = available.height() / 2; | 361 int height = available.height() / 2; |
362 if (height < 450) height = (available.height() * 2) / 3; | 362 if (height < 450) height = (available.height() * 2) / 3; |
363 if (width > height * 2) width = height * 2; | 363 if (width > height * 2) width = height * 2; |
364 | 364 |
365 settings.beginGroup("MainWindow"); | 365 settings.beginGroup("MainWindow"); |
366 | |
366 QSize size = settings.value("size", QSize(width, height)).toSize(); | 367 QSize size = settings.value("size", QSize(width, height)).toSize(); |
367 gui->resizeConstrained(size); | 368 gui->resizeConstrained(size); |
369 | |
368 if (settings.contains("position")) { | 370 if (settings.contains("position")) { |
369 QRect prevrect(settings.value("position").toPoint(), size); | 371 QRect prevrect(settings.value("position").toPoint(), size); |
370 if (!(available & prevrect).isEmpty()) { | 372 if (!(available & prevrect).isEmpty()) { |
371 gui->move(prevrect.topLeft()); | 373 gui->move(prevrect.topLeft()); |
372 } | 374 } |
373 } | 375 } |
376 | |
377 if (settings.value("maximised", false).toBool()) { | |
378 gui->setWindowState(Qt::WindowMaximized); | |
379 } | |
380 | |
374 settings.endGroup(); | 381 settings.endGroup(); |
375 | 382 |
376 gui->show(); | 383 gui->show(); |
377 | 384 |
378 // The MainWindow class seems to have trouble dealing with this if | 385 // The MainWindow class seems to have trouble dealing with this if |