diff --git a/MainWindow.cpp b/MainWindow.cpp index ff126e8..6fd16a7 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -1,9 +1,11 @@ #include "MainWindow.h" #include "ui_MainWindow.h" +#include -MainWindow::MainWindow(QWidget *parent) +MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) , ui(new Ui::MainWindow) + , openCLManager(new OpenCLManager()) { ui->setupUi(this); } @@ -11,5 +13,19 @@ MainWindow::MainWindow(QWidget *parent) MainWindow::~MainWindow() { delete ui; + delete openCLManager; } +void MainWindow::keyPressEvent(QKeyEvent* event) +{ + if(event->key() == Qt::Key_1) + { + std::cout << "Simulating system suspend..." << std::endl; + openCLManager->handleSuspendResume(true); //Simulate suspend + } + else if(event->key() == Qt::Key_2) + { + std::cout << "Simulating system resume..." << std::endl; + openCLManager->handleSuspendResume(false); //Simulate resume + } +} diff --git a/MainWindow.h b/MainWindow.h index 4643e32..5a56b40 100644 --- a/MainWindow.h +++ b/MainWindow.h @@ -2,9 +2,11 @@ #define MAINWINDOW_H #include +#include "OpenCLManager.h" QT_BEGIN_NAMESPACE -namespace Ui { class MainWindow; } +namespace Ui { class MainWindow; +} QT_END_NAMESPACE class MainWindow : public QMainWindow @@ -12,10 +14,15 @@ class MainWindow : public QMainWindow Q_OBJECT public: - MainWindow(QWidget *parent = nullptr); + MainWindow(QWidget* parent = nullptr); ~MainWindow(); +protected: + void keyPressEvent(QKeyEvent* event) override; + private: - Ui::MainWindow *ui; + Ui::MainWindow* ui; + OpenCLManager* openCLManager; }; -#endif // MAINWINDOW_H + +#endif //MAINWINDOW_H diff --git a/main.cpp b/main.cpp index 34339a4..b4caa0d 100644 --- a/main.cpp +++ b/main.cpp @@ -13,7 +13,7 @@ int main(int argc, char* argv[]) { QApplication a(argc, argv); - OpenCLManager openCLManager; + //OpenCLManager openCLManager; MainWindow w; w.show();