GUI: added execute on gui thread function
This commit is contained in:
parent
ac6c518f50
commit
fa67d56ef4
|
@ -1135,6 +1135,11 @@ BRIDGE_IMPEXP void GuiCloseQWidgetTab(void* qWidget)
|
||||||
_gui_sendmessage(GUI_CLOSE_QWIDGET_TAB, qWidget, nullptr);
|
_gui_sendmessage(GUI_CLOSE_QWIDGET_TAB, qWidget, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BRIDGE_IMPEXP void GuiExecuteOnGuiThread(GUICALLBACK cbGuiThread)
|
||||||
|
{
|
||||||
|
_gui_sendmessage(GUI_EXECUTE_ON_GUI_THREAD, cbGuiThread, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
{
|
{
|
||||||
hInst = hinstDLL;
|
hInst = hinstDLL;
|
||||||
|
|
|
@ -764,9 +764,13 @@ typedef enum
|
||||||
GUI_SHOW_CPU, // param1=unused, param2=unused
|
GUI_SHOW_CPU, // param1=unused, param2=unused
|
||||||
GUI_ADD_QWIDGET_TAB, // param1=QWidget*, param2=unused
|
GUI_ADD_QWIDGET_TAB, // param1=QWidget*, param2=unused
|
||||||
GUI_SHOW_QWIDGET_TAB, // param1=QWidget*, param2=unused
|
GUI_SHOW_QWIDGET_TAB, // param1=QWidget*, param2=unused
|
||||||
GUI_CLOSE_QWIDGET_TAB // param1=QWidget*, param2=unused
|
GUI_CLOSE_QWIDGET_TAB, // param1=QWidget*, param2=unused
|
||||||
|
GUI_EXECUTE_ON_GUI_THREAD // param1=GUICALLBACK, param2=unused
|
||||||
} GUIMSG;
|
} GUIMSG;
|
||||||
|
|
||||||
|
//GUI Typedefs
|
||||||
|
typedef void (*GUICALLBACK)();
|
||||||
|
|
||||||
//GUI structures
|
//GUI structures
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -854,6 +858,7 @@ BRIDGE_IMPEXP void GuiShowCpu();
|
||||||
BRIDGE_IMPEXP void GuiAddQWidgetTab(void* qWidget);
|
BRIDGE_IMPEXP void GuiAddQWidgetTab(void* qWidget);
|
||||||
BRIDGE_IMPEXP void GuiShowQWidgetTab(void* qWidget);
|
BRIDGE_IMPEXP void GuiShowQWidgetTab(void* qWidget);
|
||||||
BRIDGE_IMPEXP void GuiCloseQWidgetTab(void* qWidget);
|
BRIDGE_IMPEXP void GuiCloseQWidgetTab(void* qWidget);
|
||||||
|
BRIDGE_IMPEXP void GuiExecuteOnGuiThread(GUICALLBACK cbGuiThread);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>BUILD_BRIDGE;WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>BUILD_BRIDGE;WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
@ -139,7 +139,7 @@
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>BUILD_BRIDGE;WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>BUILD_BRIDGE;WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -123,7 +123,7 @@
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -425,6 +425,12 @@ void Bridge::emitCloseQWidgetTab(QWidget* qWidget)
|
||||||
emit closeQWidgetTab(qWidget);
|
emit closeQWidgetTab(qWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Bridge::emitExecuteOnGuiThread(void* cbGuiThread)
|
||||||
|
{
|
||||||
|
GuiAddLogMessage(QString().sprintf("thread id (bridge) %X\n", GetCurrentThreadId()).toUtf8().constData());
|
||||||
|
emit executeOnGuiThread(cbGuiThread);
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
Static Functions
|
Static Functions
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
@ -857,6 +863,12 @@ __declspec(dllexport) void* _gui_sendmessage(GUIMSG type, void* param1, void* pa
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GUI_EXECUTE_ON_GUI_THREAD:
|
||||||
|
{
|
||||||
|
Bridge::getBridge()->emitExecuteOnGuiThread(param1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,7 @@ public:
|
||||||
void emitAddQWidgetTab(QWidget* qWidget);
|
void emitAddQWidgetTab(QWidget* qWidget);
|
||||||
void emitShowQWidgetTab(QWidget* qWidget);
|
void emitShowQWidgetTab(QWidget* qWidget);
|
||||||
void emitCloseQWidgetTab(QWidget* qWidget);
|
void emitCloseQWidgetTab(QWidget* qWidget);
|
||||||
|
void emitExecuteOnGuiThread(void* cbGuiThread);
|
||||||
|
|
||||||
//Public variables
|
//Public variables
|
||||||
void* winId;
|
void* winId;
|
||||||
|
@ -163,6 +164,7 @@ signals:
|
||||||
void addQWidgetTab(QWidget* qWidget);
|
void addQWidgetTab(QWidget* qWidget);
|
||||||
void showQWidgetTab(QWidget* qWidget);
|
void showQWidgetTab(QWidget* qWidget);
|
||||||
void closeQWidgetTab(QWidget* qWidget);
|
void closeQWidgetTab(QWidget* qWidget);
|
||||||
|
void executeOnGuiThread(void* cbGuiThread);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMutex* mBridgeMutex;
|
QMutex* mBridgeMutex;
|
||||||
|
|
|
@ -33,6 +33,8 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
||||||
connect(Bridge::getBridge(), SIGNAL(showCpu()), this, SLOT(displayCpuWidget()));
|
connect(Bridge::getBridge(), SIGNAL(showCpu()), this, SLOT(displayCpuWidget()));
|
||||||
connect(Bridge::getBridge(), SIGNAL(addQWidgetTab(QWidget*)), this, SLOT(addQWidgetTab(QWidget*)));
|
connect(Bridge::getBridge(), SIGNAL(addQWidgetTab(QWidget*)), this, SLOT(addQWidgetTab(QWidget*)));
|
||||||
connect(Bridge::getBridge(), SIGNAL(showQWidgetTab(QWidget*)), this, SLOT(showQWidgetTab(QWidget*)));
|
connect(Bridge::getBridge(), SIGNAL(showQWidgetTab(QWidget*)), this, SLOT(showQWidgetTab(QWidget*)));
|
||||||
|
connect(Bridge::getBridge(), SIGNAL(closeQWidgetTab(QWidget*)), this, SLOT(closeQWidgetTab(QWidget*)));
|
||||||
|
connect(Bridge::getBridge(), SIGNAL(executeOnGuiThread(void*)), this, SLOT(executeOnGuiThread(void*)));
|
||||||
|
|
||||||
//setup menu api
|
//setup menu api
|
||||||
initMenuApi();
|
initMenuApi();
|
||||||
|
@ -239,6 +241,8 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
||||||
mCloseDialog = new CloseDialog(this);
|
mCloseDialog = new CloseDialog(this);
|
||||||
|
|
||||||
mCpuWidget->mDisas->setFocus();
|
mCpuWidget->mDisas->setFocus();
|
||||||
|
|
||||||
|
GuiAddLogMessage(QString().sprintf("thread id (GUI thread) %X\n", GetCurrentThreadId()).toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent* event)
|
void MainWindow::closeEvent(QCloseEvent* event)
|
||||||
|
@ -345,7 +349,7 @@ void MainWindow::loadMRUList(int maxItems)
|
||||||
mMaxMRU = maxItems;
|
mMaxMRU = maxItems;
|
||||||
for(int i = 0; i < mMaxMRU; i++)
|
for(int i = 0; i < mMaxMRU; i++)
|
||||||
{
|
{
|
||||||
char currentFile[MAX_PATH] = "";
|
char currentFile[MAX_SETTING_SIZE] = "";
|
||||||
if(!BridgeSettingGet("Recent Files", QString().sprintf("%.2d", i + 1).toUtf8().constData(), currentFile))
|
if(!BridgeSettingGet("Recent Files", QString().sprintf("%.2d", i + 1).toUtf8().constData(), currentFile))
|
||||||
break;
|
break;
|
||||||
if(QString(currentFile).size() && QFile(currentFile).exists())
|
if(QString(currentFile).size() && QFile(currentFile).exists())
|
||||||
|
@ -1124,3 +1128,8 @@ void MainWindow::closeQWidgetTab(QWidget* qWidget)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::executeOnGuiThread(void* cbGuiThread)
|
||||||
|
{
|
||||||
|
((GUICALLBACK)cbGuiThread)();
|
||||||
|
}
|
||||||
|
|
|
@ -107,6 +107,7 @@ public slots:
|
||||||
void addQWidgetTab(QWidget* qWidget);
|
void addQWidgetTab(QWidget* qWidget);
|
||||||
void showQWidgetTab(QWidget* qWidget);
|
void showQWidgetTab(QWidget* qWidget);
|
||||||
void closeQWidgetTab(QWidget* qWidget);
|
void closeQWidgetTab(QWidget* qWidget);
|
||||||
|
void executeOnGuiThread(void* cbGuiThread);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow* ui;
|
Ui::MainWindow* ui;
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;X64_DBG_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
Loading…
Reference in New Issue