-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRedmineConnectorPlugin.cpp
77 lines (57 loc) · 1.95 KB
/
RedmineConnectorPlugin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "RedmineConnectorPlugin.h"
#include "RedmineConnectorConstants.h"
#include <coreplugin/icore.h>
#include <coreplugin/icontext.h>
#include <coreplugin/coreconstants.h>
#include <QCoreApplication>
#include <QDebug>
#include <QLocale>
#include <QTranslator>
#include <QtCore/QtPlugin>
#include <QtCore/QLibraryInfo>
#include <QtGui/QMainWindow>
#include "MainMode.h"
#include "MainWindow.h"
#include "Settings.h"
using namespace RedmineConnector::Internal;
RedmineConnectorPlugin* RedmineConnectorPlugin::_instance = 0;
RedmineConnectorPlugin::RedmineConnectorPlugin()
{
}
RedmineConnectorPlugin::~RedmineConnectorPlugin()
{
}
bool RedmineConnectorPlugin::initialize(const QStringList &arguments, QString *errorString)
{
Q_UNUSED(arguments)
Q_UNUSED(errorString)
const QString &locale = Core::ICore::instance()->userInterfaceLanguage();
if (!locale.isEmpty()) {
QTranslator *translator = new QTranslator(this);
const QString &creatorTrPath = Core::ICore::instance()->resourcePath() + QLatin1String("/translations");
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString &trFile = QLatin1String("RedmineConnector_") + locale;
if( translator->load(trFile, qtTrPath) || translator->load(trFile, creatorTrPath) ) {
qApp->installTranslator(translator);
}
}
_instance = this;
MainWindow *mainWindow = new MainWindow();
Core::IMode *mainMode = new MainMode(mainWindow);
addAutoReleasedObject(mainMode);
Settings::instance()->setParent(this);
addAutoReleasedObject(Settings::instance());
return true;
}
void RedmineConnectorPlugin::extensionsInitialized()
{
}
ExtensionSystem::IPlugin::ShutdownFlag RedmineConnectorPlugin::aboutToShutdown()
{
return SynchronousShutdown;
}
RedmineConnectorPlugin* RedmineConnectorPlugin::instance()
{
return _instance;
}
Q_EXPORT_PLUGIN2(RedmineConnector, RedmineConnectorPlugin)