X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fwindow.cpp;h=2d809bfb0610c8a3924213148528d9693c377c22;hb=9cc3bd82e832f5d49911048d6dc053e177922abf;hp=90517e4b0aa24e786b9323051f457a0d1c5cf0b4;hpb=9cf9becd655832d406dab5686bdfe44f3959e38e;p=fstl diff --git a/src/window.cpp b/src/window.cpp index 90517e4..2d809bf 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -7,11 +7,15 @@ #include "loader.h" Window::Window(QWidget *parent) : - QMainWindow(parent) + QMainWindow(parent), + open_action(new QAction("Open", this)), + about_action(new QAction("About", this)), + quit_action(new QAction("Quit", this)) + { setWindowTitle("fstl"); - QFile styleFile( ":/style.qss" ); + QFile styleFile(":/qt/style.qss"); styleFile.open( QFile::ReadOnly ); setStyleSheet(styleFile.readAll()); @@ -22,19 +26,16 @@ Window::Window(QWidget *parent) : canvas = new Canvas(format, this); setCentralWidget(canvas); - open_action = new QAction("Open", this); open_action->setShortcut(QKeySequence::Open); - QObject::connect(open_action, SIGNAL(triggered()), - this, SLOT(on_open())); + QObject::connect(open_action, &QAction::triggered, + this, &Window::on_open); - quit_action = new QAction("Quit", this); quit_action->setShortcut(QKeySequence::Quit); - QObject::connect(quit_action, SIGNAL(triggered()), - this, SLOT(close())); + QObject::connect(quit_action, &QAction::triggered, + this, &Window::close); - about_action = new QAction("About", this); - QObject::connect(about_action, SIGNAL(triggered()), - this, SLOT(on_about())); + QObject::connect(about_action, &QAction::triggered, + this, &Window::on_about); auto file_menu = menuBar()->addMenu("File"); file_menu->addAction(open_action); @@ -68,31 +69,62 @@ void Window::on_about() " style=\"color: #93a1a1;\">matt.j.keeter@gmail.com
"); } +void Window::on_ascii_stl() +{ + QMessageBox::critical(this, "Error", + "Error:.stl
file.stl
and retry");
+}
-void Window::enable_open_action()
+void Window::on_bad_stl()
{
- open_action->setEnabled(true);
+ QMessageBox::critical(this, "Error",
+ "Error:.stl
file is invalid or corrupted.