From cc4f309c0f0c611b4224238ad90bcc9557864703 Mon Sep 17 00:00:00 2001 From: eelke Date: Mon, 31 Dec 2018 09:40:25 +0100 Subject: [PATCH] Completed removal of ASyncWindow --- pglab/ASyncWindow.cpp | 25 ------------------------- pglab/ASyncWindow.h | 24 ------------------------ pglab/CrudModel.cpp | 1 - pglab/DatabaseWindow.h | 1 - pglab/ServerWindow.cpp | 2 +- pglab/ServerWindow.h | 4 ++-- pglab/pglab.pro | 2 -- 7 files changed, 3 insertions(+), 56 deletions(-) delete mode 100644 pglab/ASyncWindow.cpp delete mode 100644 pglab/ASyncWindow.h diff --git a/pglab/ASyncWindow.cpp b/pglab/ASyncWindow.cpp deleted file mode 100644 index ab15bf6..0000000 --- a/pglab/ASyncWindow.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "ASyncWindow.h" -#include - -ASyncWindow::ASyncWindow(QWidget *parent) - : QMainWindow(parent) -{} - -void ASyncWindow::QueueTask(TSQueue::t_Callable c) -{ - m_taskQueue.add(std::move(c)); - // Theoretically this needs to be only called if the queue was empty because otherwise it already would - // be busy emptying the queue. For now however I think it is safer to call it just to make sure. - QMetaObject::invokeMethod(this, "processCallableQueue", Qt::QueuedConnection); // queues on main thread -} - -void ASyncWindow::processCallableQueue() -{ - if (!m_taskQueue.empty()) { - auto c = m_taskQueue.pop(); - c(); - if (!m_taskQueue.empty()) { - QTimer::singleShot(0, this, SLOT(processCallableQueue())); - } - } -} diff --git a/pglab/ASyncWindow.h b/pglab/ASyncWindow.h deleted file mode 100644 index 59f3f67..0000000 --- a/pglab/ASyncWindow.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef ASYNCWINDOW_H -#define ASYNCWINDOW_H - -#include -#include "tsqueue.h" - -class ASyncWindow : public QMainWindow { - Q_OBJECT -public: - ASyncWindow(QWidget *parent); - /* Meant to be called from other threads to pass a code block - * that has to be executed in the context of the thread of the window. - */ - void QueueTask(TSQueue::t_Callable c); -private: - TSQueue m_taskQueue; -private slots: - - void processCallableQueue(); -}; - - - -#endif // ASYNCWINDOW_H diff --git a/pglab/CrudModel.cpp b/pglab/CrudModel.cpp index 18eda02..f404c1b 100644 --- a/pglab/CrudModel.cpp +++ b/pglab/CrudModel.cpp @@ -1,5 +1,4 @@ #include "CrudModel.h" -#include "ASyncWindow.h" #include "OpenDatabase.h" #include "catalog/PgDatabaseCatalog.h" #include "catalog/PgAttribute.h" diff --git a/pglab/DatabaseWindow.h b/pglab/DatabaseWindow.h index bb09bfa..8999774 100644 --- a/pglab/DatabaseWindow.h +++ b/pglab/DatabaseWindow.h @@ -5,7 +5,6 @@ #include "ConnectionConfig.h" #include "OpenDatabase.h" #include -//#include "ASyncWindow.h" #include #include #include diff --git a/pglab/ServerWindow.cpp b/pglab/ServerWindow.cpp index c2c49da..31cb27e 100644 --- a/pglab/ServerWindow.cpp +++ b/pglab/ServerWindow.cpp @@ -6,7 +6,7 @@ #include "catalog/PgDatabaseCatalog.h" ServerWindow::ServerWindow(MasterController *master, QWidget *parent) - : ASyncWindow(parent) + : QMainWindow(parent) , ui(new Ui::ServerWindow) , m_masterController(master) { diff --git a/pglab/ServerWindow.h b/pglab/ServerWindow.h index 9d90e28..d9a9d39 100644 --- a/pglab/ServerWindow.h +++ b/pglab/ServerWindow.h @@ -1,8 +1,8 @@ #ifndef SERVERWINDOW_H #define SERVERWINDOW_H -#include "ASyncWindow.h" #include "ConnectionConfig.h" +#include #include namespace Ui { @@ -14,7 +14,7 @@ class OpenDatabase; class DatabasesTableModel; class RolesTableModel; -class ServerWindow : public ASyncWindow { +class ServerWindow : public QMainWindow { Q_OBJECT public: explicit ServerWindow(MasterController *master, QWidget *parent ); diff --git a/pglab/pglab.pro b/pglab/pglab.pro index 3824e8a..a2dcd1e 100644 --- a/pglab/pglab.pro +++ b/pglab/pglab.pro @@ -42,7 +42,6 @@ SOURCES += main.cpp\ OpenDatabase.cpp \ SqlSyntaxHighlighter.cpp \ ServerWindow.cpp \ - ASyncWindow.cpp \ DatabasesTableModel.cpp \ RolesTableModel.cpp \ ConnectionList.cpp \ @@ -107,7 +106,6 @@ HEADERS += \ OpenDatabase.h \ SqlSyntaxHighlighter.h \ ServerWindow.h \ - ASyncWindow.h \ DatabasesTableModel.h \ RolesTableModel.h \ ConnectionList.h \