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
|
|
|
|
2020-04-20 21:22:10 +00:00
|
|
|
enum class AutomaticAnalysisLevel {
|
|
|
|
Ask, None, AAA, AAAA
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CutterCommandLineOptions {
|
|
|
|
QStringList args;
|
|
|
|
AutomaticAnalysisLevel analLevel = AutomaticAnalysisLevel::Ask;
|
|
|
|
InitialOptions fileOpenOptions;
|
|
|
|
QString pythonHome;
|
|
|
|
bool outputRedirectionEnabled = true;
|
|
|
|
bool enableCutterPlugins = true;
|
|
|
|
bool enableR2Plugins = true;
|
|
|
|
};
|
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
|
|
|
|
2018-03-21 20:32:32 +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 = {});
|
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();
|
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-02-05 07:46:39 +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
|