mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 03:26:05 -04:00
Make the KiwixApp responsible to create the MainWindow.
This commit is contained in:
parent
4c8996d95b
commit
12a2a3c036
@ -5,10 +5,14 @@ KiwixApp::KiwixApp(int& argc, char *argv[])
|
||||
: QApplication(argc, argv),
|
||||
reader(nullptr)
|
||||
{
|
||||
mainWindow = new MainWindow;
|
||||
setApplicationName("kiwix-desktop");
|
||||
mainWindow->show();
|
||||
}
|
||||
|
||||
KiwixApp::~KiwixApp()
|
||||
{
|
||||
delete mainWindow;
|
||||
if (reader)
|
||||
delete reader;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <kiwix/reader.h>
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
||||
class KiwixApp : public QApplication
|
||||
@ -20,6 +21,7 @@ public:
|
||||
|
||||
private:
|
||||
kiwix::Reader* reader;
|
||||
MainWindow* mainWindow;
|
||||
};
|
||||
|
||||
#endif // KIWIXAPP_H
|
||||
|
4
main.cpp
4
main.cpp
@ -1,5 +1,4 @@
|
||||
#include "kiwixapp.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QCommandLineParser>
|
||||
#include <QFileDialog>
|
||||
@ -8,7 +7,6 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
KiwixApp a(argc, argv);
|
||||
KiwixApp::setApplicationName("kiwix-desktop");
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.addPositionalArgument("zimfile", "The zim file");
|
||||
@ -27,8 +25,6 @@ int main(int argc, char *argv[])
|
||||
std::string f = zimfile.toUtf8().constData();
|
||||
std::cout << f << std::endl;
|
||||
|
||||
MainWindow w;
|
||||
w.show();
|
||||
a.openZimFile(zimfile);
|
||||
|
||||
return a.exec();
|
||||
|
Loading…
x
Reference in New Issue
Block a user