Skip to content

Commit

Permalink
testing with qthread
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCrazyT committed Aug 25, 2019
1 parent aecb570 commit 8111b72
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pluginmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
#include <QGridLayout>
#include <QCompleter>
#include <QStringListModel>
#include <QThread>
#include <qlist.h>
#include <pluginsdk/_plugins.h>
#include <string.h>
#include <stdbool.h>
#include <thread>

#include "helper.h"
#define plugin_name "QuickAccess"
Expand Down Expand Up @@ -95,13 +95,21 @@ void show_qa_window(){
txt.setFocus();
}

class ShowQaWinThread : public QThread
{
void run() Q_DECL_OVERRIDE {
show_qa_window();
}
};

bool cb_plugin_command(
int argc, //argument count (number of arguments + 1)
char** argv //array of arguments (argv[0] is the full command, arguments start at argv[1])
)
{
if(strcmp(argv[0],"quickaccess")==0){
std::thread window_thread (show_qa_window);
QThread* window_thread = new ShowQaWinThread();
window_thread->start();
}
return true;
}
Expand All @@ -110,7 +118,8 @@ void cb_plugin_menuentry(CBTYPE bType,void* info)
PLUG_CB_MENUENTRY* callbackInfo = (PLUG_CB_MENUENTRY*)info;
if(callbackInfo->hEntry == ME_QUICKACCESS){
dbg("Menu clicked");
std::thread window_thread (show_qa_window);
QThread* window_thread = new ShowQaWinThread();
window_thread->start();
}else{
dbgf("Entry: %016x != %16x\n",callbackInfo->hEntry,ME_QUICKACCESS);
}
Expand Down

0 comments on commit 8111b72

Please sign in to comment.