mirror of
https://github.com/wf-group/wfview
synced 2026-08-13 17:32:59 -04:00
the user if serial port isn't opening. Added command-line arguments for serial port (example: "-p /dev/ttyUSB0" or "--port /dev/ttyUSB0"). Cleaned up some of the debug messages. wfview also will now tell the user what radio was found in the status bar of the main window. Added the begininning of code to determine the waveform type (center or fixed). rigcommander now knows which is which. The next step is to emit a signal when this changes, which then causes the main window to check or uncheck the box (without triggering any other code). Added some TODO remarks on mode (DV, DD). Added some command line arguments that are not used at this time for -- host and --civ.
79 lines
1.8 KiB
C++
79 lines
1.8 KiB
C++
#include "wfmain.h"
|
|
#include <QApplication>
|
|
#include <iostream>
|
|
|
|
// Copytight 2017-2021 Elliott H. Liggett
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QApplication a(argc, argv);
|
|
//a.setStyle( "Fusion" );
|
|
|
|
a.setOrganizationName("eliggett");
|
|
a.setOrganizationDomain("nodomain");
|
|
a.setApplicationName("wfview");
|
|
|
|
|
|
|
|
QString serialPortCL;
|
|
QString hostCL;
|
|
QString civCL;
|
|
|
|
QString currentArg;
|
|
|
|
const QString helpText = QString("Usage: -p --port /dev/port, -h --host remotehostname, -c --civ 0xAddr"); // TODO...
|
|
|
|
for(int c=1; c<argc; c++)
|
|
{
|
|
//qDebug() << "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 == "-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 == "--help"))
|
|
{
|
|
std::cout << helpText.toStdString();
|
|
return 0;
|
|
} else {
|
|
std::cout << "Unrecognized option: " << currentArg.toStdString();
|
|
std::cout << helpText.toStdString();
|
|
return -1;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
#ifdef QT_DEBUG
|
|
qDebug() << "SerialPortCL as set by parser: " << serialPortCL;
|
|
qDebug() << "remote host as set by parser: " << hostCL;
|
|
qDebug() << "CIV as set by parser: " << civCL;
|
|
#endif
|
|
a.setWheelScrollLines(1); // one line per wheel click
|
|
wfmain w( serialPortCL, hostCL);
|
|
|
|
w.show();
|
|
|
|
|
|
|
|
return a.exec();
|
|
}
|