1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-25 11:52:40 +01:00

UI polish

This commit is contained in:
Daniel Evans 2014-02-10 16:15:22 +00:00
parent 70dba94de4
commit 3e764dc3b8
4 changed files with 25 additions and 1 deletions

View File

@ -5,6 +5,7 @@ ArchiveContentsWidget::ArchiveContentsWidget(QWidget* parent, Qt::WindowFlags fl
{
setWindowTitle("Archive");
table = new QTableView();
table->setShowGrid(false);
setWidget(table);
}

View File

@ -3,6 +3,8 @@
#include "ArchiveContentsWidget.hpp"
#include <QMenuBar>
#include <QFileDialog>
#include <QApplication>
#include <QSettings>
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)");

View File

@ -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();

View File

@ -1,10 +1,14 @@
#include <QApplication>
#include <QStyleFactory>
#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();