Code cleaning (#898)

This commit is contained in:
xarkes 2018-11-01 23:23:01 +01:00 committed by GitHub
parent 4434e146bf
commit 3f76ee000c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 22 deletions

View File

@ -24,6 +24,7 @@
CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc, argv)
{
// Load translations
QTranslator *t = new QTranslator;
QTranslator *qtBaseTranslator = new QTranslator;
QTranslator *qtTranslator = new QTranslator;
@ -61,12 +62,25 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
}
}
// Setup application information
setOrganizationName("Cutter");
setApplicationName("Cutter");
setApplicationVersion(CUTTER_VERSION_FULL);
setWindowIcon(QIcon(":/img/cutter.svg"));
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
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)

View File

@ -85,20 +85,6 @@
#include <QGraphicsScene>
#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) :
QMainWindow(parent),
core(Core()),
@ -117,12 +103,9 @@ void MainWindow::initUI()
{
ui->setupUi(this);
registerCustomFonts();
/*
* Toolbar
*/
// Sepparator between undo/redo and goto lineEdit
QWidget *spacer3 = new QWidget();
spacer3->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
@ -133,9 +116,7 @@ void MainWindow::initUI()
DebugToolbar *debugToolbar = new DebugToolbar(this);
ui->mainToolBar->addWidget(debugToolbar);
// Debug menu
// ui->menuDebug->addAction(debugToolbar->actionStart);
ui->menuDebug->addAction(debugToolbar->actionStartEmul);
// ui->menuDebug->addAction(debugToolbar->actionAttach);
ui->menuDebug->addSeparator();
ui->menuDebug->addAction(debugToolbar->actionStep);
ui->menuDebug->addAction(debugToolbar->actionStepOver);
@ -279,7 +260,7 @@ void MainWindow::initUI()
connect(core->getAsyncTaskManager(), &AsyncTaskManager::tasksChanged, this,
&MainWindow::updateTasksIndicator);
/* Load plugins */
/* Setup plugins interfaces */
QList<CutterPlugin *> plugins = core->getCutterPlugins();
for (auto plugin : plugins) {
CutterDockWidget *pluginDock = plugin->setupInterface(this);