MCPcopy Create free account
hub / github.com/baumgarr/nixnote2 / NixNote

Method NixNote

nixnote.cpp:110–240  ·  view source on GitHub ↗

This is the main class that is used to start everything else.

Source from the content-addressed store, hash-verified

108//* everything else.
109//*************************************************
110NixNote::NixNote(QWidget *parent) : QMainWindow(parent)
111{
112 splashScreen = new QSplashScreen(this, global.getPixmapResource(":splashLogoImage"));
113 global.settings->beginGroup("Appearance");
114 if(global.settings->value("showSplashScreen", false).toBool()) {
115 splashScreen->setWindowFlags( Qt::WindowStaysOnTopHint | Qt::SplashScreen | Qt::FramelessWindowHint );
116 splashScreen->show();
117 QTimer::singleShot(2500, splashScreen, SLOT(close()));
118 }
119 global.settings->endGroup();
120
121#if QT_VERSION < 0x050000
122 QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
123#endif
124 global.setDebugLevel();
125
126 // Load any plugins
127 this->loadPlugins();
128
129 QTranslator *nixnoteTranslator = new QTranslator();
130 QLOG_DEBUG() << "Looking for transaltions: " << global.fileManager.getTranslateFilePath("nixnote2_" + QLocale::system().name() + ".qm");
131 nixnoteTranslator->load(global.fileManager.getTranslateFilePath("nixnote2_" + QLocale::system().name() + ".qm"));
132 QApplication::instance()->installTranslator(nixnoteTranslator);
133
134 connect(&syncThread, SIGNAL(started()), this, SLOT(syncThreadStarted()));
135 connect(&counterThread, SIGNAL(started()), this, SLOT(counterThreadStarted()));
136 connect(&indexThread, SIGNAL(started()), this, SLOT(indexThreadStarted()));
137 counterThread.start(QThread::LowestPriority);
138 syncThread.start(QThread::LowPriority);
139 indexThread.start(QThread::LowestPriority);
140 this->thread()->setPriority(QThread::HighestPriority);
141
142 heartbeatTimer.setInterval(1000);
143 heartbeatTimer.setSingleShot(false);
144 connect(&heartbeatTimer, SIGNAL(timeout()), this, SLOT(heartbeatTimerTriggered()));
145 heartbeatTimer.start();
146
147 QFont f = this->font();
148 //f.setPointSize(8);
149 global.getGuiFont(f);
150 this->setFont(f);
151
152 db = new DatabaseConnection("nixnote"); // Startup the database
153
154 // Setup the sync thread
155 QLOG_TRACE() << "Setting up counter thread";
156 connect(this, SIGNAL(updateCounts()), &counterRunner, SLOT(countAll()));
157
158 // Setup the counter thread
159 QLOG_TRACE() << "Setting up sync thread";
160 connect(this,SIGNAL(syncRequested()),&syncRunner,SLOT(synchronize()));
161 connect(&syncRunner, SIGNAL(setMessage(QString, int)), this, SLOT(setMessage(QString, int)));
162
163 QLOG_TRACE() << "Setting up GUI";
164 global.filterPosition = 0;
165 this->setupGui();
166
167 global.resourceWatcher = new QFileSystemWatcher(this);

Callers

nothing calls this directly

Calls 15

loadPluginsMethod · 0.95
setupGuiMethod · 0.95
newExternalNoteMethod · 0.95
getPixmapResourceMethod · 0.80
valueMethod · 0.80
showMethod · 0.80
setDebugLevelMethod · 0.80
getTranslateFilePathMethod · 0.80
loadMethod · 0.80
getGuiFontMethod · 0.80
startTimerMethod · 0.80

Tested by

no test coverage detected