2018-02-10 18:04:31 +00:00
|
|
|
#ifndef CUTTERAPPLICATION_H
|
|
|
|
#define CUTTERAPPLICATION_H
|
|
|
|
|
|
|
|
#include <QEvent>
|
|
|
|
#include <QApplication>
|
2018-06-26 07:40:08 +00:00
|
|
|
#include <QList>
|
2019-02-05 07:46:39 +00:00
|
|
|
#include <QProxyStyle>
|
2018-02-10 18:04:31 +00:00
|
|
|
|
2019-02-22 16:50:45 +00:00
|
|
|
#include "core/MainWindow.h"
|
2018-02-10 18:04:31 +00:00
|
|
|
|
2021-01-24 14:50:13 +00:00
|
|
|
enum class AutomaticAnalysisLevel { Ask, None, AAA, AAAA };
|
2020-04-20 21:22:10 +00:00
|
|
|
|
2021-01-24 14:50:13 +00:00
|
|
|
struct CutterCommandLineOptions
|
|
|
|
{
|
2020-04-20 21:22:10 +00:00
|
|
|
QStringList args;
|
2021-09-15 18:48:02 +00:00
|
|
|
AutomaticAnalysisLevel analysisLevel = AutomaticAnalysisLevel::Ask;
|
2020-04-20 21:22:10 +00:00
|
|
|
InitialOptions fileOpenOptions;
|
|
|
|
QString pythonHome;
|
|
|
|
bool outputRedirectionEnabled = true;
|
|
|
|
bool enableCutterPlugins = true;
|
2020-12-16 10:59:23 +00:00
|
|
|
bool enableRizinPlugins = true;
|
2020-04-20 21:22:10 +00:00
|
|
|
};
|
2018-02-10 18:04:31 +00:00
|
|
|
|
|
|
|
class CutterApplication : public QApplication
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
CutterApplication(int &argc, char **argv);
|
2018-02-27 13:06:04 +00:00
|
|
|
~CutterApplication();
|
2018-02-10 18:04:31 +00:00
|
|
|
|
2021-01-24 14:50:13 +00:00
|
|
|
MainWindow *getMainWindow() { return mainWindow; }
|
2018-02-10 18:04:31 +00:00
|
|
|
|
2020-04-20 21:22:10 +00:00
|
|
|
void launchNewInstance(const QStringList &args = {});
|
2021-01-24 14:50:13 +00:00
|
|
|
|
2018-02-10 18:04:31 +00:00
|
|
|
protected:
|
|
|
|
bool event(QEvent *e);
|
|
|
|
|
2019-01-20 17:00:23 +00:00
|
|
|
private:
|
2019-03-06 20:30:39 +00:00
|
|
|
/**
|
|
|
|
* @brief Load and translations depending on Language settings
|
|
|
|
* @return true on success
|
2019-01-20 17:00:23 +00:00
|
|
|
*/
|
|
|
|
bool loadTranslations();
|
2020-04-20 21:22:10 +00:00
|
|
|
/**
|
|
|
|
* @brief Parse commandline options and store them in a structure.
|
|
|
|
* @return false if options have error
|
|
|
|
*/
|
|
|
|
bool parseCommandLineOptions();
|
2021-01-24 14:50:13 +00:00
|
|
|
|
2018-02-10 18:04:31 +00:00
|
|
|
private:
|
|
|
|
bool m_FileAlreadyDropped;
|
2018-02-27 13:06:04 +00:00
|
|
|
MainWindow *mainWindow;
|
2020-04-20 21:22:10 +00:00
|
|
|
CutterCommandLineOptions clOptions;
|
2018-02-10 18:04:31 +00:00
|
|
|
};
|
|
|
|
|
2019-03-06 20:30:39 +00:00
|
|
|
/**
|
|
|
|
* @brief CutterProxyStyle is used to force shortcuts displaying in context menu
|
2019-02-05 07:46:39 +00:00
|
|
|
*/
|
|
|
|
class CutterProxyStyle : public QProxyStyle
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2019-03-06 20:30:39 +00:00
|
|
|
/**
|
|
|
|
* @brief it is enough to get notification about QMenu polishing to force shortcut displaying
|
2019-02-05 07:46:39 +00:00
|
|
|
*/
|
|
|
|
void polish(QWidget *widget) override;
|
|
|
|
};
|
|
|
|
|
2018-02-10 18:04:31 +00:00
|
|
|
#endif // CUTTERAPPLICATION_H
|