55#include < QMessageBox>
66#include < QFileDialog>
77
8- ResultWindow::ResultWindow () {
8+ ResultWindow::ResultWindow (const QString& filePath, const BowResult& data ) {
99 // Main window properties
10- this ->setWindowTitle ( " Results " );
10+ this ->setWindowFilePath (filePath );
1111 this ->setWindowIcon (QIcon (" :/icons/logo.svg" ));
1212 this ->setStyleSheet (" QMainWindow { background-image:url(:/icons/background.png); background-position: center; background-repeat: no-repeat; }" );
1313 this ->menuBar ()->setAutoFillBackground (true );
1414 this ->resize ({1000 , 700 }); // Initial size, overwritten by stored window geometry if present
1515
16- // Load geometry and state
16+ // Load state and geometry
1717 UserSettings settings;
1818 restoreState (settings.value (" OutputWindow/state" ).toByteArray ());
1919 restoreGeometry (settings.value (" OutputWindow/geometry" ).toByteArray ());
20- }
21-
22- void ResultWindow::closeEvent (QCloseEvent *event) {
23- // Save state and geometry
24- UserSettings settings;
25- settings.setValue (" OutputWindow/state" , saveState ());
26- settings.setValue (" OutputWindow/geometry" , saveGeometry ());
27- }
2820
29- void ResultWindow:: load( const BowResult& data) {
21+ // Try to load output data
3022 try {
3123 this ->data = data;
3224 this ->setCentralWidget (new OutputWidget (this ->data ));
@@ -35,3 +27,10 @@ void ResultWindow::load(const BowResult& data) {
3527 QMessageBox::critical (this , " Error" , " Failed to open result data:\n " + QString (e.what ()));
3628 }
3729}
30+
31+ void ResultWindow::closeEvent (QCloseEvent *event) {
32+ // Save state and geometry
33+ UserSettings settings;
34+ settings.setValue (" OutputWindow/state" , saveState ());
35+ settings.setValue (" OutputWindow/geometry" , saveGeometry ());
36+ }
0 commit comments