Skip to content

Commit

Permalink
Updated to verstion 1.01
Browse files Browse the repository at this point in the history
Added command line option to specify the host string, overriding the cached host string.
Added command line help statement accessible via -h.
  • Loading branch information
aaronevers committed Mar 20, 2013
1 parent 76860da commit 4e37aef
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
indiprop - INDI Property Browser - v1.00
indiprop - INDI Property Browser - v1.01
_____________________________________________________________________

This program provides a generic user interface for browsing device
Expand Down
21 changes: 19 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,28 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
app.setApplicationName("indiprop");
app.setApplicationVersion("1.0");
app.setApplicationVersion("1.01");
app.setOrganizationName("indiprop.googlecode.com");
app.setOrganizationDomain("indiprop.googlecode.com");

QMap<QString, QString> argm;
QStringList args = qApp->arguments();
for (int i = 0; i < args.size(); i++)
if (args.at(i).startsWith("--"))
argm[args.at(i).section("=", 0, 0).mid(2)] = args.at(i).section("=", 1);

MainWindow mainWindow;
if (args.contains("-h") || args.contains("--help"))
{
qout << qApp->applicationName() << " " << qApp->applicationVersion() << endl;
qout << "Usage: " << qApp->applicationName() << " [options]" << endl;
qout << "Where [options] are the following:" << endl;
qout << " -h|--help Prints this help statement." << endl;
qout << " --host=<host>[:<port>] Overrides the cached host string." << endl;
qout << endl;
return false;
}

MainWindow mainWindow(argm);
mainWindow.show();

return app.exec();
Expand Down
10 changes: 7 additions & 3 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@

#include "mainwindow.h"

MainWindow::MainWindow() : mContextMenu(NULL)
MainWindow::MainWindow(const QMap<QString, QString> &argm) : mContextMenu(NULL)
{
QSettings settings;

setWindowTitle(qApp->applicationName() + " " + qApp->applicationVersion());
setObjectName(windowTitle());

mHostnameLineEdit = new QLineEdit(settings.value("Toolbar/Hostname").toString());
QString host = settings.value("Toolbar/Hostname").toString();
if (argm.contains("host"))
host = argm["host"];

mHostnameLineEdit = new QLineEdit(host);
mToolbar = addToolBar("Show Toolbar");
mToolbar->setObjectName(mToolbar->windowTitle());
mToolbar->addWidget(new QLabel("Hostname:"));
mToolbar->addWidget(new QLabel("Host:"));
mToolbar->addWidget(mHostnameLineEdit);
mToolbar->addAction("Connect", this, SLOT(socketConnect()));
connect(mHostnameLineEdit, SIGNAL(returnPressed()), SLOT(socketConnect()));
Expand Down
3 changes: 2 additions & 1 deletion src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MainWindow : public QMainWindow
Q_OBJECT;

public:
MainWindow();
MainWindow(const QMap<QString, QString> &argm);

private:
IndiClient mClient;
Expand All @@ -37,6 +37,7 @@ class MainWindow : public QMainWindow
QAction *mSexagesimal;

QMap<QString, TreeItem*> mTreeWidgetItems;


protected:
virtual void closeEvent(QCloseEvent *);
Expand Down

0 comments on commit 4e37aef

Please sign in to comment.