mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-24 05:45:27 +00:00
Code cleaning (#898)
This commit is contained in:
parent
4434e146bf
commit
3f76ee000c
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc, argv)
|
CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc, argv)
|
||||||
{
|
{
|
||||||
|
// Load translations
|
||||||
QTranslator *t = new QTranslator;
|
QTranslator *t = new QTranslator;
|
||||||
QTranslator *qtBaseTranslator = new QTranslator;
|
QTranslator *qtBaseTranslator = new QTranslator;
|
||||||
QTranslator *qtTranslator = new QTranslator;
|
QTranslator *qtTranslator = new QTranslator;
|
||||||
@ -61,12 +62,25 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup application information
|
||||||
setOrganizationName("Cutter");
|
setOrganizationName("Cutter");
|
||||||
setApplicationName("Cutter");
|
setApplicationName("Cutter");
|
||||||
setApplicationVersion(CUTTER_VERSION_FULL);
|
setApplicationVersion(CUTTER_VERSION_FULL);
|
||||||
setWindowIcon(QIcon(":/img/cutter.svg"));
|
setWindowIcon(QIcon(":/img/cutter.svg"));
|
||||||
setAttribute(Qt::AA_DontShowIconsInMenus);
|
setAttribute(Qt::AA_DontShowIconsInMenus);
|
||||||
|
|
||||||
|
// Load fonts
|
||||||
|
int ret = QFontDatabase::addApplicationFont(":/fonts/Anonymous Pro.ttf");
|
||||||
|
if (ret == -1) {
|
||||||
|
qWarning() << "Cannot load Anonymous Pro font.";
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = QFontDatabase::addApplicationFont(":/fonts/Inconsolata-Regular.ttf");
|
||||||
|
if (ret == -1) {
|
||||||
|
qWarning() << "Cannot load Incosolata-Regular font.";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set QString codec to UTF-8
|
// Set QString codec to UTF-8
|
||||||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
|
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||||
|
@ -85,20 +85,6 @@
|
|||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
static void registerCustomFonts()
|
|
||||||
{
|
|
||||||
int ret = QFontDatabase::addApplicationFont(":/fonts/Anonymous Pro.ttf");
|
|
||||||
assert(-1 != ret && "unable to register Anonymous Pro.ttf");
|
|
||||||
|
|
||||||
ret = QFontDatabase::addApplicationFont(":/fonts/Inconsolata-Regular.ttf");
|
|
||||||
assert(-1 != ret && "unable to register Inconsolata-Regular.ttf");
|
|
||||||
|
|
||||||
// Do not issue a warning in release
|
|
||||||
Q_UNUSED(ret)
|
|
||||||
}
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
core(Core()),
|
core(Core()),
|
||||||
@ -117,12 +103,9 @@ void MainWindow::initUI()
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
registerCustomFonts();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Toolbar
|
* Toolbar
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Sepparator between undo/redo and goto lineEdit
|
// Sepparator between undo/redo and goto lineEdit
|
||||||
QWidget *spacer3 = new QWidget();
|
QWidget *spacer3 = new QWidget();
|
||||||
spacer3->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
spacer3->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
@ -133,9 +116,7 @@ void MainWindow::initUI()
|
|||||||
DebugToolbar *debugToolbar = new DebugToolbar(this);
|
DebugToolbar *debugToolbar = new DebugToolbar(this);
|
||||||
ui->mainToolBar->addWidget(debugToolbar);
|
ui->mainToolBar->addWidget(debugToolbar);
|
||||||
// Debug menu
|
// Debug menu
|
||||||
// ui->menuDebug->addAction(debugToolbar->actionStart);
|
|
||||||
ui->menuDebug->addAction(debugToolbar->actionStartEmul);
|
ui->menuDebug->addAction(debugToolbar->actionStartEmul);
|
||||||
// ui->menuDebug->addAction(debugToolbar->actionAttach);
|
|
||||||
ui->menuDebug->addSeparator();
|
ui->menuDebug->addSeparator();
|
||||||
ui->menuDebug->addAction(debugToolbar->actionStep);
|
ui->menuDebug->addAction(debugToolbar->actionStep);
|
||||||
ui->menuDebug->addAction(debugToolbar->actionStepOver);
|
ui->menuDebug->addAction(debugToolbar->actionStepOver);
|
||||||
@ -279,7 +260,7 @@ void MainWindow::initUI()
|
|||||||
connect(core->getAsyncTaskManager(), &AsyncTaskManager::tasksChanged, this,
|
connect(core->getAsyncTaskManager(), &AsyncTaskManager::tasksChanged, this,
|
||||||
&MainWindow::updateTasksIndicator);
|
&MainWindow::updateTasksIndicator);
|
||||||
|
|
||||||
/* Load plugins */
|
/* Setup plugins interfaces */
|
||||||
QList<CutterPlugin *> plugins = core->getCutterPlugins();
|
QList<CutterPlugin *> plugins = core->getCutterPlugins();
|
||||||
for (auto plugin : plugins) {
|
for (auto plugin : plugins) {
|
||||||
CutterDockWidget *pluginDock = plugin->setupInterface(this);
|
CutterDockWidget *pluginDock = plugin->setupInterface(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user