mirror of
https://github.com/rwengine/openrw.git
synced 2024-09-03 00:59:47 +02:00
UI polish
This commit is contained in:
parent
70dba94de4
commit
3e764dc3b8
@ -5,6 +5,7 @@ ArchiveContentsWidget::ArchiveContentsWidget(QWidget* parent, Qt::WindowFlags fl
|
||||
{
|
||||
setWindowTitle("Archive");
|
||||
table = new QTableView();
|
||||
table->setShowGrid(false);
|
||||
setWidget(table);
|
||||
}
|
||||
|
||||
|
@ -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)");
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user