mirror of
https://github.com/logos-storage/logos-storage-app-skeleton.git
synced 2026-06-15 04:49:29 +00:00
Remove cleanup function
This commit is contained in:
parent
4df4f78694
commit
2dc3d84616
@ -79,7 +79,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
qDebug() << "Application cleanup...";
|
||||
|
||||
window.cleanup();
|
||||
window.destroy();
|
||||
|
||||
// Cleanup core before exit
|
||||
logos_core_cleanup();
|
||||
|
||||
@ -10,26 +10,11 @@ extern "C" {
|
||||
void logos_core_cleanup();
|
||||
}
|
||||
|
||||
void MainWindow::cleanup() {
|
||||
qDebug() << "MainWindow: Cleaning up before exit...";
|
||||
void MainWindow::destroy() {
|
||||
qDebug() << "MainWindow: Destroying MainWindow...";
|
||||
|
||||
if (storageWidget) {
|
||||
qDebug() << "MainWindow: Stopping Storage before destroying...";
|
||||
|
||||
QEventLoop loop;
|
||||
QObject::connect(storageWidget, SIGNAL(storageStop()), &loop, SLOT(quit()));
|
||||
QMetaObject::invokeMethod(storageWidget, "stopStorage", Qt::QueuedConnection);
|
||||
loop.exec();
|
||||
|
||||
qDebug() << "MainWindow: Storage stopped.";
|
||||
|
||||
qDebug() << "MainWindow: Destroying Storage...";
|
||||
|
||||
QObject::connect(storageWidget, SIGNAL(storageCleanup()), &loop, SLOT(quit()));
|
||||
QMetaObject::invokeMethod(storageWidget, "destroy", Qt::QueuedConnection);
|
||||
loop.exec();
|
||||
|
||||
qDebug() << "MainWindow: Storage destroyed.";
|
||||
if (plugin && storageWidget) {
|
||||
QMetaObject::invokeMethod(plugin, "destroyWidget", Qt::DirectConnection, Q_ARG(QWidget*, storageWidget));
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,6 +25,7 @@ MainWindow::~MainWindow() {}
|
||||
void MainWindow::setupUi() {
|
||||
// Determine the appropriate plugin extension based on the platform
|
||||
QString pluginExtension;
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
pluginExtension = ".dll";
|
||||
#elif defined(Q_OS_MAC)
|
||||
@ -55,7 +41,7 @@ void MainWindow::setupUi() {
|
||||
QWidget* widget = nullptr;
|
||||
|
||||
if (loader.load()) {
|
||||
QObject* plugin = loader.instance();
|
||||
plugin = loader.instance();
|
||||
if (plugin) {
|
||||
// Try to create the storage widget using the plugin's createWidget method
|
||||
QMetaObject::invokeMethod(plugin, "createWidget", Qt::DirectConnection, Q_RETURN_ARG(QWidget*, widget));
|
||||
@ -86,6 +72,6 @@ void MainWindow::setupUi() {
|
||||
}
|
||||
|
||||
// Set window title and size
|
||||
setWindowTitle("Logos Storage UI App !");
|
||||
setWindowTitle("Logos Storage UI App");
|
||||
resize(800, 600);
|
||||
}
|
||||
|
||||
@ -11,13 +11,14 @@ class MainWindow : public QMainWindow {
|
||||
public:
|
||||
MainWindow(QWidget* parent = nullptr);
|
||||
~MainWindow();
|
||||
void cleanup();
|
||||
void destroy();
|
||||
|
||||
private:
|
||||
void setupUi();
|
||||
void setupMenu();
|
||||
|
||||
QWidget* storageWidget = nullptr;
|
||||
QObject* plugin = nullptr;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user