From 3e764dc3b8334e420fc47e1ef941d6e53365d033 Mon Sep 17 00:00:00 2001 From: Daniel Evans Date: Mon, 10 Feb 2014 16:15:22 +0000 Subject: [PATCH] UI polish --- rwviewer/ArchiveContentsWidget.cpp | 1 + rwviewer/ViewerWindow.cpp | 18 ++++++++++++++++++ rwviewer/ViewerWindow.hpp | 3 ++- rwviewer/main.cpp | 4 ++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/rwviewer/ArchiveContentsWidget.cpp b/rwviewer/ArchiveContentsWidget.cpp index 4742f978..856dc5ab 100644 --- a/rwviewer/ArchiveContentsWidget.cpp +++ b/rwviewer/ArchiveContentsWidget.cpp @@ -5,6 +5,7 @@ ArchiveContentsWidget::ArchiveContentsWidget(QWidget* parent, Qt::WindowFlags fl { setWindowTitle("Archive"); table = new QTableView(); + table->setShowGrid(false); setWidget(table); } diff --git a/rwviewer/ViewerWindow.cpp b/rwviewer/ViewerWindow.cpp index e68739b6..52ee1caf 100644 --- a/rwviewer/ViewerWindow.cpp +++ b/rwviewer/ViewerWindow.cpp @@ -3,6 +3,8 @@ #include "ArchiveContentsWidget.hpp" #include #include +#include +#include ViewerWindow::ViewerWindow(QWidget* parent, Qt::WindowFlags flags): QMainWindow(parent, flags) { @@ -12,11 +14,18 @@ ViewerWindow::ViewerWindow(QWidget* parent, Qt::WindowFlags flags): QMainWindow( this->setCentralWidget(viewer); archivewidget = new ArchiveContentsWidget; + archivewidget->setObjectName("archivewidget"); this->addDockWidget(Qt::LeftDockWidgetArea, archivewidget); QMenuBar* mb = this->menuBar(); QMenu* file = mb->addMenu("&File"); file->addAction("Open &Archive", this, SLOT(openArchive())); + file->addSeparator(); + file->addAction("E&xit", QApplication::instance(), SLOT(quit()), QKeySequence::Quit); + + QSettings settings("OpenRW", "rwviewer"); + restoreGeometry(settings.value("geometry").toByteArray()); + restoreState(settings.value("windowState").toByteArray()); } void ViewerWindow::openArchive(const QString& name) @@ -33,6 +42,15 @@ void ViewerWindow::openArchive(const QString& name) archivewidget->setArchive(ld); } +void ViewerWindow::closeEvent(QCloseEvent* event) +{ + QSettings settings("OpenRW", "rwviewer"); + settings.setValue("geometry", saveGeometry()); + settings.setValue("windowState", saveState()); + QMainWindow::closeEvent(event); +} + + void ViewerWindow::openArchive() { QFileDialog dialog(this, "Open Archive", QDir::homePath(), "IMG Archives (*.img)"); diff --git a/rwviewer/ViewerWindow.hpp b/rwviewer/ViewerWindow.hpp index 21ab780e..71621c5b 100644 --- a/rwviewer/ViewerWindow.hpp +++ b/rwviewer/ViewerWindow.hpp @@ -15,7 +15,8 @@ public: ViewerWindow(QWidget* parent = 0, Qt::WindowFlags flags = 0); void openArchive(const QString& name); - + + virtual void closeEvent(QCloseEvent*); public slots: void openArchive(); diff --git a/rwviewer/main.cpp b/rwviewer/main.cpp index 77832b18..69e07ca2 100644 --- a/rwviewer/main.cpp +++ b/rwviewer/main.cpp @@ -1,10 +1,14 @@ #include +#include #include "ViewerWindow.hpp" int main(int argc, char *argv[]) { QApplication app(argc, argv); + /* HACK until Qt curve supports Qt5 */ + QApplication::setStyle(QStyleFactory::create("GTK+")); + ViewerWindow viewer; viewer.show();