forked from Subtivals/subtivals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
33 lines (30 loc) · 1.03 KB
/
main.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
#include <QtGui/QApplication>
#include <QtCore/QFileInfo>
#include "mainwindow.h"
#include "subtitlesform.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QCoreApplication::setOrganizationName("Gedial");
QCoreApplication::setOrganizationDomain("gedial.com");
QCoreApplication::setApplicationName("Subtivals");
a.setQuitOnLastWindowClosed(true);
SubtitlesForm f;
MainWindow w;
QObject::connect(&w, SIGNAL(eventStart(Event*)), &f, SLOT(addEvent(Event*)));
QObject::connect(&w, SIGNAL(eventEnd(Event*)), &f, SLOT(remEvent(Event*)));
QObject::connect(&w, SIGNAL(configChanged()), &f, SLOT(applyConfig()));
QObject::connect(&w, SIGNAL(toggleHide(bool)), &f, SLOT(toggleHide(bool)));
f.show();
w.show();
// If more than one arg and last arg is a file, open it
if( argc > 1)
{
QFileInfo fileInfo(argv[argc - 1]);
if (fileInfo.exists() && fileInfo.isReadable())
{
w.openFile(fileInfo.absoluteFilePath());
}
}
return a.exec();
}