Remove redundant CL args

knobtest
Phil Taylor 2022-09-23 17:42:36 +01:00
rodzic d9190a5060
commit f838e22498
5 zmienionych plików z 11 dodań i 69 usunięć

Wyświetl plik

@ -71,10 +71,6 @@ int main(int argc, char *argv[])
//debugMode = true;
#endif
QString serialPortCL;
QString hostCL;
QString civCL;
QDateTime date = QDateTime::currentDateTime();
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")));
@ -83,7 +79,7 @@ int main(int argc, char *argv[])
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
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))
@ -102,34 +98,10 @@ int main(int argc, char *argv[])
//qInfo() << "Argc: " << c << " argument: " << argv[c];
currentArg = QString(argv[c]);
if ((currentArg == "-p") || (currentArg == "--port"))
{
if (argc > c)
{
serialPortCL = argv[c + 1];
c += 1;
}
}
else if ((currentArg == "-d") || (currentArg == "--debug"))
if ((currentArg == "-d") || (currentArg == "--debug"))
{
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"))
{
if (argc > c)
@ -173,9 +145,7 @@ int main(int argc, char *argv[])
qInstallMessageHandler(messageHandler);
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
#ifdef BUILD_WFSERVER
#ifdef Q_OS_WIN
@ -185,10 +155,10 @@ int main(int argc, char *argv[])
signal(SIGTERM, cleanup);
signal(SIGKILL, cleanup);
#endif
w = new servermain(serialPortCL, hostCL, logFilename, settingsFile);
w = new servermain(logFilename, settingsFile);
#else
a.setWheelScrollLines(1); // one line per wheel click
wfmain w(serialPortCL, hostCL, settingsFile, logFilename, debugMode);
wfmain w(settingsFile, logFilename, debugMode);
w.show();
#endif

Wyświetl plik

@ -8,10 +8,8 @@
// This code is copyright 2017-2020 Elliott H. Liggett
// 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 <rigCapabilities>();

Wyświetl plik

@ -46,9 +46,7 @@ class servermain : public QObject
Q_OBJECT
public:
servermain(const QString serialPortCL, const QString hostCL, const QString logFile, const QString settingsFile);
QString serialPortCL;
QString hostCL;
servermain(const QString logFile, const QString settingsFile);
~servermain();
signals:

Wyświetl plik

@ -20,7 +20,7 @@ bool debugModeLogging = true;
bool debugModeLogging = false;
#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),
ui(new Ui::wfmain),
logFilename(logFile)
@ -45,9 +45,6 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s
logWindow->setInitialDebugState(debugMode);
qInfo(logSystem()) << version;
this->serialPortCL = serialPortCL;
this->hostCL = hostCL;
cal = new calibrationWindow();
rpt = new repeaterSetup();
sat = new satelliteSetup();
@ -201,20 +198,6 @@ void wfmain::openRig()
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();
if (prefs.enableLAN)
@ -226,16 +209,11 @@ void wfmain::openRig()
emit sendCommSetup(prefs.radioCIVAddr, udpPrefs, rxSetup, txSetup, prefs.virtualSerialPort, prefs.tcpPort);
} else {
ui->serialEnableBtn->setChecked(true);
if( (prefs.serialPortRadio.toLower() == QString("auto")) && (serialPortCL.isEmpty()))
if( (prefs.serialPortRadio.toLower() == QString("auto")))
{
findSerialPort();
} else {
if(serialPortCL.isEmpty())
{
serialPortRig = prefs.serialPortRadio;
} else {
serialPortRig = serialPortCL;
}
serialPortRig = prefs.serialPortRadio;
}
usingLAN = false;
emit sendCommSetup(prefs.radioCIVAddr, serialPortRig, prefs.serialPortBaud,prefs.virtualSerialPort, prefs.tcpPort,prefs.waterfallFormat);

Wyświetl plik

@ -64,9 +64,7 @@ class wfmain : public QMainWindow
Q_OBJECT
public:
explicit wfmain(const QString serialPortCL, const QString hostCL, const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent = 0);
QString serialPortCL;
QString hostCL;
explicit wfmain(const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent = 0);
~wfmain();
static void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg);
void handleLogText(QString text);