2013-05-23 16:21:47 -04:00
|
|
|
#ifdef QT5
|
|
|
|
#include <QtWidgets>
|
|
|
|
#else
|
2012-05-22 13:09:48 -04:00
|
|
|
#include <QtGui>
|
2013-05-23 16:21:47 -04:00
|
|
|
#endif
|
2013-05-23 15:35:37 -04:00
|
|
|
#include <QApplication>
|
2013-08-05 09:57:55 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
#include "mainwindow.h"
|
|
|
|
|
2013-08-05 09:57:55 -04:00
|
|
|
|
2013-07-18 20:23:40 -04:00
|
|
|
// Multiple instances:
|
|
|
|
QSharedMemory mem_jt9;
|
|
|
|
QUuid my_uuid;
|
|
|
|
QString my_key;
|
2013-04-13 08:28:03 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2013-04-10 10:41:16 -04:00
|
|
|
QApplication a(argc, argv);
|
|
|
|
|
|
|
|
QFile f("fonts.txt");
|
2013-07-24 15:07:57 -04:00
|
|
|
qint32 fontSize,fontWeight,fontSize2,fontWeight2; // Defaults 8 50 10 50
|
|
|
|
fontSize2=10;
|
|
|
|
fontWeight2=50;
|
2013-04-10 10:41:16 -04:00
|
|
|
if(f.open(QIODevice::ReadOnly)) {
|
2013-07-24 15:07:57 -04:00
|
|
|
QTextStream in(&f);
|
|
|
|
in >> fontSize >> fontWeight >> fontSize2 >> fontWeight2;
|
2013-04-10 10:41:16 -04:00
|
|
|
f.close();
|
2013-07-24 15:07:57 -04:00
|
|
|
QFont font=a.font();
|
|
|
|
if(fontSize!=8) font.setPointSize(fontSize);
|
|
|
|
font.setWeight(fontWeight); //Set the GUI fonts
|
2013-04-10 10:41:16 -04:00
|
|
|
a.setFont(font);
|
|
|
|
}
|
|
|
|
|
2013-04-13 08:28:03 -04:00
|
|
|
// Create and initialize shared memory segment
|
2013-07-18 20:23:40 -04:00
|
|
|
// Multiple instances: generate shared memory keys with UUID
|
|
|
|
my_uuid = QUuid::createUuid();
|
|
|
|
my_key = my_uuid.toString();
|
|
|
|
mem_jt9.setKey(my_key);
|
|
|
|
|
2013-04-13 08:28:03 -04:00
|
|
|
if(!mem_jt9.attach()) {
|
|
|
|
if (!mem_jt9.create(sizeof(jt9com_))) {
|
|
|
|
QMessageBox::critical( 0, "Error", "Unable to create shared memory segment.");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char *to = (char*)mem_jt9.data();
|
|
|
|
int size=sizeof(jt9com_);
|
|
|
|
if(jt9com_.newdat==0) {
|
|
|
|
}
|
|
|
|
memset(to,0,size); //Zero all decoding params in shared memory
|
|
|
|
|
2013-07-18 20:23:40 -04:00
|
|
|
// Multiple instances: Call MainWindow() with the UUID key
|
2013-07-24 15:07:57 -04:00
|
|
|
MainWindow w(&mem_jt9, &my_key, fontSize2, fontWeight2);
|
2013-04-10 10:41:16 -04:00
|
|
|
w.show();
|
|
|
|
return a.exec();
|
2012-05-22 13:09:48 -04:00
|
|
|
}
|