Completed removal of ASyncWindow
This commit is contained in:
parent
424fb5984d
commit
cc4f309c0f
7 changed files with 3 additions and 56 deletions
|
|
@ -1,25 +0,0 @@
|
|||
#include "ASyncWindow.h"
|
||||
#include <QTimer>
|
||||
|
||||
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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
#ifndef ASYNCWINDOW_H
|
||||
#define ASYNCWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#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
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
#include "CrudModel.h"
|
||||
#include "ASyncWindow.h"
|
||||
#include "OpenDatabase.h"
|
||||
#include "catalog/PgDatabaseCatalog.h"
|
||||
#include "catalog/PgAttribute.h"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include "ConnectionConfig.h"
|
||||
#include "OpenDatabase.h"
|
||||
#include <QLabel>
|
||||
//#include "ASyncWindow.h"
|
||||
#include <QLabel>
|
||||
#include <QRunnable>
|
||||
#include <QSocketNotifier>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef SERVERWINDOW_H
|
||||
#define SERVERWINDOW_H
|
||||
|
||||
#include "ASyncWindow.h"
|
||||
#include "ConnectionConfig.h"
|
||||
#include <QMainWindow>
|
||||
#include <memory>
|
||||
|
||||
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 );
|
||||
|
|
|
|||
|
|
@ -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 \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue