kopia lustrzana https://gitlab.com/eliggett/wfview
Remove redundant CL args
rodzic
d9190a5060
commit
f838e22498
40
main.cpp
40
main.cpp
|
@ -71,10 +71,6 @@ int main(int argc, char *argv[])
|
||||||
//debugMode = true;
|
//debugMode = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString serialPortCL;
|
|
||||||
QString hostCL;
|
|
||||||
QString civCL;
|
|
||||||
|
|
||||||
QDateTime date = QDateTime::currentDateTime();
|
QDateTime date = QDateTime::currentDateTime();
|
||||||
QString formattedTime = date.toString("dd.MM.yyyy hh:mm:ss");
|
QString formattedTime = date.toString("dd.MM.yyyy hh:mm:ss");
|
||||||
QString logFilename = (QString("%1/%2-%3.log").arg(QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0]).arg(a.applicationName()).arg(date.toString("yyyyMMddhhmmss")));
|
QString logFilename = (QString("%1/%2-%3.log").arg(QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0]).arg(a.applicationName()).arg(date.toString("yyyyMMddhhmmss")));
|
||||||
|
@ -83,7 +79,7 @@ int main(int argc, char *argv[])
|
||||||
QString currentArg;
|
QString currentArg;
|
||||||
|
|
||||||
|
|
||||||
const QString helpText = QString("\nUsage: -p --port /dev/port, -h --host remotehostname, -c --civ 0xAddr, -l --logfile filename.log, -s --settings filename.ini, -d --debug, -v --version\n"); // TODO...
|
const QString helpText = QString("\nUsage: -l --logfile filename.log, -s --settings filename.ini, -d --debug, -v --version\n"); // TODO...
|
||||||
#ifdef BUILD_WFSERVER
|
#ifdef BUILD_WFSERVER
|
||||||
const QString version = QString("wfserver version: %1 (Git:%2 on %3 at %4 by %5@%6)\nOperating System: %7 (%8)\nBuild Qt Version %9. Current Qt Version: %10\n")
|
const QString version = QString("wfserver version: %1 (Git:%2 on %3 at %4 by %5@%6)\nOperating System: %7 (%8)\nBuild Qt Version %9. Current Qt Version: %10\n")
|
||||||
.arg(QString(WFVIEW_VERSION))
|
.arg(QString(WFVIEW_VERSION))
|
||||||
|
@ -102,34 +98,10 @@ int main(int argc, char *argv[])
|
||||||
//qInfo() << "Argc: " << c << " argument: " << argv[c];
|
//qInfo() << "Argc: " << c << " argument: " << argv[c];
|
||||||
currentArg = QString(argv[c]);
|
currentArg = QString(argv[c]);
|
||||||
|
|
||||||
if ((currentArg == "-p") || (currentArg == "--port"))
|
if ((currentArg == "-d") || (currentArg == "--debug"))
|
||||||
{
|
|
||||||
if (argc > c)
|
|
||||||
{
|
|
||||||
serialPortCL = argv[c + 1];
|
|
||||||
c += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((currentArg == "-d") || (currentArg == "--debug"))
|
|
||||||
{
|
{
|
||||||
debugMode = true;
|
debugMode = true;
|
||||||
}
|
}
|
||||||
else if ((currentArg == "-h") || (currentArg == "--host"))
|
|
||||||
{
|
|
||||||
if(argc > c)
|
|
||||||
{
|
|
||||||
hostCL = argv[c+1];
|
|
||||||
c+=1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((currentArg == "-c") || (currentArg == "--civ"))
|
|
||||||
{
|
|
||||||
if (argc > c)
|
|
||||||
{
|
|
||||||
civCL = argv[c + 1];
|
|
||||||
c += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((currentArg == "-l") || (currentArg == "--logfile"))
|
else if ((currentArg == "-l") || (currentArg == "--logfile"))
|
||||||
{
|
{
|
||||||
if (argc > c)
|
if (argc > c)
|
||||||
|
@ -173,9 +145,7 @@ int main(int argc, char *argv[])
|
||||||
qInstallMessageHandler(messageHandler);
|
qInstallMessageHandler(messageHandler);
|
||||||
|
|
||||||
qInfo(logSystem()) << version;
|
qInfo(logSystem()) << version;
|
||||||
qDebug(logSystem()) << QString("SerialPortCL as set by parser: %1").arg(serialPortCL);
|
|
||||||
qDebug(logSystem()) << QString("remote host as set by parser: %1").arg(hostCL);
|
|
||||||
qDebug(logSystem()) << QString("CIV as set by parser: %1").arg(civCL);
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUILD_WFSERVER
|
#ifdef BUILD_WFSERVER
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
@ -185,10 +155,10 @@ int main(int argc, char *argv[])
|
||||||
signal(SIGTERM, cleanup);
|
signal(SIGTERM, cleanup);
|
||||||
signal(SIGKILL, cleanup);
|
signal(SIGKILL, cleanup);
|
||||||
#endif
|
#endif
|
||||||
w = new servermain(serialPortCL, hostCL, logFilename, settingsFile);
|
w = new servermain(logFilename, settingsFile);
|
||||||
#else
|
#else
|
||||||
a.setWheelScrollLines(1); // one line per wheel click
|
a.setWheelScrollLines(1); // one line per wheel click
|
||||||
wfmain w(serialPortCL, hostCL, settingsFile, logFilename, debugMode);
|
wfmain w(settingsFile, logFilename, debugMode);
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,10 +8,8 @@
|
||||||
// This code is copyright 2017-2020 Elliott H. Liggett
|
// This code is copyright 2017-2020 Elliott H. Liggett
|
||||||
// All rights reserved
|
// All rights reserved
|
||||||
|
|
||||||
servermain::servermain(const QString serialPortCL, const QString hostCL, const QString settingsFile, const QString logFile)
|
servermain::servermain(const QString settingsFile, const QString logFile)
|
||||||
{
|
{
|
||||||
this->serialPortCL = serialPortCL;
|
|
||||||
this->hostCL = hostCL;
|
|
||||||
|
|
||||||
qRegisterMetaType <udpPreferences>(); // Needs to be registered early.
|
qRegisterMetaType <udpPreferences>(); // Needs to be registered early.
|
||||||
qRegisterMetaType <rigCapabilities>();
|
qRegisterMetaType <rigCapabilities>();
|
||||||
|
|
|
@ -46,9 +46,7 @@ class servermain : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
servermain(const QString serialPortCL, const QString hostCL, const QString logFile, const QString settingsFile);
|
servermain(const QString logFile, const QString settingsFile);
|
||||||
QString serialPortCL;
|
|
||||||
QString hostCL;
|
|
||||||
~servermain();
|
~servermain();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
28
wfmain.cpp
28
wfmain.cpp
|
@ -20,7 +20,7 @@ bool debugModeLogging = true;
|
||||||
bool debugModeLogging = false;
|
bool debugModeLogging = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent ) :
|
wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent ) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::wfmain),
|
ui(new Ui::wfmain),
|
||||||
logFilename(logFile)
|
logFilename(logFile)
|
||||||
|
@ -45,9 +45,6 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s
|
||||||
logWindow->setInitialDebugState(debugMode);
|
logWindow->setInitialDebugState(debugMode);
|
||||||
qInfo(logSystem()) << version;
|
qInfo(logSystem()) << version;
|
||||||
|
|
||||||
this->serialPortCL = serialPortCL;
|
|
||||||
this->hostCL = hostCL;
|
|
||||||
|
|
||||||
cal = new calibrationWindow();
|
cal = new calibrationWindow();
|
||||||
rpt = new repeaterSetup();
|
rpt = new repeaterSetup();
|
||||||
sat = new satelliteSetup();
|
sat = new satelliteSetup();
|
||||||
|
@ -201,20 +198,6 @@ void wfmain::openRig()
|
||||||
|
|
||||||
ui->connectBtn->setText("Cancel connection"); // We are attempting to connect
|
ui->connectBtn->setText("Cancel connection"); // We are attempting to connect
|
||||||
|
|
||||||
// TODO: Use these if they are found
|
|
||||||
if(!serialPortCL.isEmpty())
|
|
||||||
{
|
|
||||||
qDebug(logSystem()) << "Serial port specified by user: " << serialPortCL;
|
|
||||||
} else {
|
|
||||||
qDebug(logSystem()) << "Serial port not specified. ";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!hostCL.isEmpty())
|
|
||||||
{
|
|
||||||
qDebug(logSystem()) << "Remote host name specified by user: " << hostCL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
makeRig();
|
makeRig();
|
||||||
|
|
||||||
if (prefs.enableLAN)
|
if (prefs.enableLAN)
|
||||||
|
@ -226,16 +209,11 @@ void wfmain::openRig()
|
||||||
emit sendCommSetup(prefs.radioCIVAddr, udpPrefs, rxSetup, txSetup, prefs.virtualSerialPort, prefs.tcpPort);
|
emit sendCommSetup(prefs.radioCIVAddr, udpPrefs, rxSetup, txSetup, prefs.virtualSerialPort, prefs.tcpPort);
|
||||||
} else {
|
} else {
|
||||||
ui->serialEnableBtn->setChecked(true);
|
ui->serialEnableBtn->setChecked(true);
|
||||||
if( (prefs.serialPortRadio.toLower() == QString("auto")) && (serialPortCL.isEmpty()))
|
if( (prefs.serialPortRadio.toLower() == QString("auto")))
|
||||||
{
|
{
|
||||||
findSerialPort();
|
findSerialPort();
|
||||||
} else {
|
} else {
|
||||||
if(serialPortCL.isEmpty())
|
serialPortRig = prefs.serialPortRadio;
|
||||||
{
|
|
||||||
serialPortRig = prefs.serialPortRadio;
|
|
||||||
} else {
|
|
||||||
serialPortRig = serialPortCL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
usingLAN = false;
|
usingLAN = false;
|
||||||
emit sendCommSetup(prefs.radioCIVAddr, serialPortRig, prefs.serialPortBaud,prefs.virtualSerialPort, prefs.tcpPort,prefs.waterfallFormat);
|
emit sendCommSetup(prefs.radioCIVAddr, serialPortRig, prefs.serialPortBaud,prefs.virtualSerialPort, prefs.tcpPort,prefs.waterfallFormat);
|
||||||
|
|
4
wfmain.h
4
wfmain.h
|
@ -64,9 +64,7 @@ class wfmain : public QMainWindow
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit wfmain(const QString serialPortCL, const QString hostCL, const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent = 0);
|
explicit wfmain(const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent = 0);
|
||||||
QString serialPortCL;
|
|
||||||
QString hostCL;
|
|
||||||
~wfmain();
|
~wfmain();
|
||||||
static void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg);
|
static void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg);
|
||||||
void handleLogText(QString text);
|
void handleLogText(QString text);
|
||||||
|
|
Ładowanie…
Reference in New Issue