2014-05-18 11:52:39 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
|
|
|
// written by Christian Daniel //
|
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QTextCodec>
|
|
|
|
#include <QProxyStyle>
|
|
|
|
#include <QStyleFactory>
|
|
|
|
#include <QFontDatabase>
|
2018-01-06 19:48:53 -05:00
|
|
|
#include <QSysInfo>
|
2017-11-11 05:11:44 -05:00
|
|
|
|
2017-11-11 20:23:55 -05:00
|
|
|
#include "loggerwithfile.h"
|
2014-05-18 11:52:39 -04:00
|
|
|
#include "mainwindow.h"
|
2018-01-22 17:29:09 -05:00
|
|
|
#include "dsp/dsptypes.h"
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2017-11-11 20:23:55 -05:00
|
|
|
static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *logger)
|
2014-05-18 11:52:39 -04:00
|
|
|
{
|
|
|
|
QApplication a(argc, argv);
|
|
|
|
/*
|
|
|
|
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
|
|
|
|
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
|
|
|
*/
|
2015-10-04 22:47:23 -04:00
|
|
|
QCoreApplication::setOrganizationName("f4exb");
|
|
|
|
QCoreApplication::setApplicationName("SDRangel");
|
2018-10-15 18:31:45 -04:00
|
|
|
QCoreApplication::setApplicationVersion("4.2.3");
|
2014-05-18 11:52:39 -04:00
|
|
|
|
|
|
|
#if 1
|
|
|
|
qApp->setStyle(QStyleFactory::create("fusion"));
|
|
|
|
|
|
|
|
QPalette palette;
|
|
|
|
palette.setColor(QPalette::Window, QColor(53,53,53));
|
|
|
|
palette.setColor(QPalette::WindowText, Qt::white);
|
|
|
|
palette.setColor(QPalette::Base, QColor(25,25,25));
|
|
|
|
palette.setColor(QPalette::AlternateBase, QColor(53,53,53));
|
|
|
|
palette.setColor(QPalette::ToolTipBase, Qt::white);
|
|
|
|
palette.setColor(QPalette::ToolTipText, Qt::black);
|
|
|
|
palette.setColor(QPalette::Text, Qt::white);
|
|
|
|
palette.setColor(QPalette::Button, QColor(0x40, 0x40, 0x40));
|
|
|
|
palette.setColor(QPalette::ButtonText, Qt::white);
|
|
|
|
palette.setColor(QPalette::BrightText, Qt::red);
|
|
|
|
|
|
|
|
palette.setColor(QPalette::Light, QColor(53,53,53).lighter(125).lighter());
|
|
|
|
palette.setColor(QPalette::Mid, QColor(53,53,53).lighter(125));
|
|
|
|
palette.setColor(QPalette::Dark, QColor(53,53,53).lighter(125).darker());
|
|
|
|
|
|
|
|
palette.setColor(QPalette::Link, QColor(0,0xa0,0xa0));
|
|
|
|
palette.setColor(QPalette::LinkVisited, QColor(0,0xa0,0xa0).lighter());
|
|
|
|
palette.setColor(QPalette::Highlight, QColor(0xff, 0x8c, 0x00));
|
|
|
|
palette.setColor(QPalette::HighlightedText, Qt::black);
|
|
|
|
qApp->setPalette(palette);
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
if(QFontDatabase::addApplicationFont("/tmp/Cuprum.otf") >= 0) {
|
|
|
|
QFont font("CuprumFFU");
|
|
|
|
font.setPointSize(10);
|
|
|
|
qApp->setFont(font);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#if 0
|
|
|
|
if(QFontDatabase::addApplicationFont("/tmp/PTN57F.ttf") >= 0) {
|
|
|
|
QFont font("PT Sans Narrow");
|
|
|
|
font.setPointSize(10);
|
|
|
|
qApp->setFont(font);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#if 0
|
|
|
|
if(QFontDatabase::addApplicationFont("/tmp/PTS55F.ttf") >= 0) {
|
|
|
|
QFont font("PT Sans");
|
|
|
|
font.setPointSize(10);
|
|
|
|
qApp->setFont(font);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#if 0
|
|
|
|
{
|
|
|
|
QFont font("Ubuntu Condensed");
|
|
|
|
font.setPointSize(10);
|
|
|
|
qApp->setFont(font);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
2017-11-17 23:06:43 -05:00
|
|
|
MainParser parser;
|
|
|
|
parser.parse(*qApp);
|
2017-11-11 05:11:44 -05:00
|
|
|
|
2018-01-06 19:48:53 -05:00
|
|
|
#if QT_VERSION >= 0x050400
|
2018-01-22 17:29:09 -05:00
|
|
|
qInfo("%s %s Qt %s %db %s %s DSP Rx:%db Tx:%db PID %lld",
|
2018-01-06 19:48:53 -05:00
|
|
|
qPrintable(qApp->applicationName()),
|
|
|
|
qPrintable(qApp->applicationVersion()),
|
|
|
|
qPrintable(QString(QT_VERSION_STR)),
|
2018-01-06 21:20:27 -05:00
|
|
|
QT_POINTER_SIZE*8,
|
2018-01-06 19:48:53 -05:00
|
|
|
qPrintable(QSysInfo::currentCpuArchitecture()),
|
2018-01-22 17:29:09 -05:00
|
|
|
qPrintable(QSysInfo::prettyProductName()),
|
|
|
|
SDR_RX_SAMP_SZ,
|
|
|
|
SDR_TX_SAMP_SZ,
|
|
|
|
qApp->applicationPid());
|
2018-01-06 19:48:53 -05:00
|
|
|
#else
|
2018-01-22 17:29:09 -05:00
|
|
|
qInfo("%s %s Qt %s %db DSP Rx:%db Tx:%db PID: %lld",
|
2018-01-06 21:20:27 -05:00
|
|
|
qPrintable(qApp->applicationName()),
|
|
|
|
qPrintable((qApp->applicationVersion()),
|
|
|
|
qPrintable(QString(QT_VERSION_STR)),
|
2018-01-22 17:29:09 -05:00
|
|
|
QT_POINTER_SIZE*8,
|
|
|
|
SDR_RX_SAMP_SZ,
|
|
|
|
SDR_TX_SAMP_SZ,
|
|
|
|
applicationPid);
|
2018-01-06 19:48:53 -05:00
|
|
|
#endif
|
|
|
|
|
2017-11-17 23:06:43 -05:00
|
|
|
MainWindow w(logger, parser);
|
2014-05-18 11:52:39 -04:00
|
|
|
w.show();
|
|
|
|
|
|
|
|
return a.exec();
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
2017-11-11 20:23:55 -05:00
|
|
|
qtwebapp::LoggerWithFile *logger = new qtwebapp::LoggerWithFile(qApp);
|
2017-11-11 05:11:44 -05:00
|
|
|
logger->installMsgHandler();
|
|
|
|
int res = runQtApplication(argc, argv, logger);
|
2015-12-31 03:31:51 -05:00
|
|
|
qWarning("SDRangel quit.");
|
2014-05-18 11:52:39 -04:00
|
|
|
return res;
|
|
|
|
}
|