From a665e3408bcc1fabd1bdb9b16e06c4d16b05c4df Mon Sep 17 00:00:00 2001 From: jjl Date: Wed, 22 Sep 2010 21:40:44 +0200 Subject: [PVSGUI] Turn on/off toolbar via menu and cmd-switch (pvsgui -h) --- i18n/pvsgui_ar_JO.ts | 83 +++++++++++++++++++++++++++++++++++++------------- i18n/pvsgui_de_DE.ts | 85 +++++++++++++++++++++++++++++++++++++++------------- i18n/pvsgui_es_MX.ts | 83 +++++++++++++++++++++++++++++++++++++------------- i18n/pvsgui_fr_FR.ts | 83 +++++++++++++++++++++++++++++++++++++------------- i18n/pvsgui_pl_PL.ts | 83 +++++++++++++++++++++++++++++++++++++------------- src/pvsgui.cpp | 47 ++++++++++++++++++++++++++++- src/pvsgui.h | 2 ++ 7 files changed, 364 insertions(+), 102 deletions(-) diff --git a/i18n/pvsgui_ar_JO.ts b/i18n/pvsgui_ar_JO.ts index 3cda399..59b40b9 100644 --- a/i18n/pvsgui_ar_JO.ts +++ b/i18n/pvsgui_ar_JO.ts @@ -394,84 +394,127 @@ p, li { white-space: pre-wrap; } PVSGUI - + Connect - + + Show &toolbar + + + + &Disconnect - + C&hat - + &Send File - + &Config - + &Information - + &About - + &Quit - - - + + + PVS Connection - + Please enter password (If not needed leave blank): - + Are you sure you want to disconnect? - - + + PVS connection - - + + Connected to - - + + Disconnected - + New host available: + + QObject + + + Usage: pvsgui [OPTIONS]... + + + + + Start the Pool Video Switch GUI. + + + + + Options: + + + + + Start only with systray icon. + + + + + Show this help text and quit. + + + + + Show version and quit. + + + + + Version: + + + diff --git a/i18n/pvsgui_de_DE.ts b/i18n/pvsgui_de_DE.ts index 60230ed..ba2fe27 100644 --- a/i18n/pvsgui_de_DE.ts +++ b/i18n/pvsgui_de_DE.ts @@ -6,7 +6,7 @@ Version: - Version: + Version: @@ -402,84 +402,127 @@ p, li { white-space: pre-wrap; } PVSGUI - + Connect Verbinden - + + Show &toolbar + &Werkzeugleiste anzeigen + + + &Disconnect &Trennen - + C&hat - + &Send File Datei &Senden - + &Config &Konfiguration - + &Information &Information - + &About &Über - + &Quit &Beenden - - - + + + PVS Connection PVS Verbindung - + Please enter password (If not needed leave blank): Bitte geben sie ein Passwor ein (Falls nicht erforderlich einfach leer lassen): - + Are you sure you want to disconnect? Sind sie sicher dass sie die Verbindung trennen möchten? - - + + PVS connection PVS Verbindung - - + + Connected to Verbunden mit - - + + Disconnected Getrennt - + New host available: Neuer Host verfügbar: + + QObject + + + Usage: pvsgui [OPTIONS]... + Aufruf: pvsgui [OPTIONEN]... + + + + Start the Pool Video Switch GUI. + Startet die Pool Video Switch GUI. + + + + Options: + Optionen: + + + + Start only with systray icon. + Starte nur mit Symbol in Systray. + + + + Show this help text and quit. + Zeige diesen Hilfetext an und beende. + + + + Show version and quit. + Zeige Versionsinformationen an und beende. + + + + Version: + Version: + + diff --git a/i18n/pvsgui_es_MX.ts b/i18n/pvsgui_es_MX.ts index 5720604..d3cb2d6 100644 --- a/i18n/pvsgui_es_MX.ts +++ b/i18n/pvsgui_es_MX.ts @@ -414,84 +414,127 @@ p, li { white-space: pre-wrap; } PVSGUI - + Connect Conectar - + + Show &toolbar + + + + &Disconnect &Desconectar - + C&hat ??? - + &Send File &Enviar archivo - + &Config &Configuración - + &Information &Información - + &About &Acerca de - + &Quit &Cerrar - - - + + + PVS Connection PVS Connección - + Please enter password (If not needed leave blank): Porfavor ingrese una contraseña (Deje la seccion vacia si no lo necesita): - + Are you sure you want to disconnect? Realmente desea desconectarse? - - + + PVS connection PVS Connección - - + + Connected to Connectar a - - + + Disconnected Desconectado - + New host available: Nuevo Host disponible: + + QObject + + + Usage: pvsgui [OPTIONS]... + + + + + Start the Pool Video Switch GUI. + + + + + Options: + + + + + Start only with systray icon. + + + + + Show this help text and quit. + + + + + Show version and quit. + + + + + Version: + Version: + + diff --git a/i18n/pvsgui_fr_FR.ts b/i18n/pvsgui_fr_FR.ts index 3cda399..59b40b9 100644 --- a/i18n/pvsgui_fr_FR.ts +++ b/i18n/pvsgui_fr_FR.ts @@ -394,84 +394,127 @@ p, li { white-space: pre-wrap; } PVSGUI - + Connect - + + Show &toolbar + + + + &Disconnect - + C&hat - + &Send File - + &Config - + &Information - + &About - + &Quit - - - + + + PVS Connection - + Please enter password (If not needed leave blank): - + Are you sure you want to disconnect? - - + + PVS connection - - + + Connected to - - + + Disconnected - + New host available: + + QObject + + + Usage: pvsgui [OPTIONS]... + + + + + Start the Pool Video Switch GUI. + + + + + Options: + + + + + Start only with systray icon. + + + + + Show this help text and quit. + + + + + Show version and quit. + + + + + Version: + + + diff --git a/i18n/pvsgui_pl_PL.ts b/i18n/pvsgui_pl_PL.ts index 3cda399..59b40b9 100644 --- a/i18n/pvsgui_pl_PL.ts +++ b/i18n/pvsgui_pl_PL.ts @@ -394,84 +394,127 @@ p, li { white-space: pre-wrap; } PVSGUI - + Connect - + + Show &toolbar + + + + &Disconnect - + C&hat - + &Send File - + &Config - + &Information - + &About - + &Quit - - - + + + PVS Connection - + Please enter password (If not needed leave blank): - + Are you sure you want to disconnect? - - + + PVS connection - - + + Connected to - - + + Disconnected - + New host available: + + QObject + + + Usage: pvsgui [OPTIONS]... + + + + + Start the Pool Video Switch GUI. + + + + + Options: + + + + + Start only with systray icon. + + + + + Show this help text and quit. + + + + + Show version and quit. + + + + + Version: + + + diff --git a/src/pvsgui.cpp b/src/pvsgui.cpp index 5f2ac60..c2ac3cb 100644 --- a/src/pvsgui.cpp +++ b/src/pvsgui.cpp @@ -18,6 +18,7 @@ */ #include "pvsgui.h" +#include "version.h" PVSGUI::PVSGUI(QWidget *parent) : QWidget(parent) @@ -88,6 +89,7 @@ PVSGUI::PVSGUI(QWidget *parent) : connect(_serverSocket, SIGNAL(newConnection()), this, SLOT(receiveFile())); // signals & slots - menu + connect(_showAction, SIGNAL(toggled(bool)), this, SLOT(setVisible(bool))); connect(_disconnectAction, SIGNAL(triggered()), this, SLOT(pvsDisconnect())); connect(_startChatAction, SIGNAL(triggered()), _chatDialog, SLOT(open())); connect(_sendFileAction, SIGNAL(triggered()), this, SLOT(sendFile())); @@ -116,7 +118,6 @@ PVSGUI::PVSGUI(QWidget *parent) : setWindowFlags(Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint | Qt::FramelessWindowHint); setAttribute(Qt::WA_AlwaysShowToolTips); updateConfig(); - setVisible(true); hide(); } @@ -136,6 +137,13 @@ void PVSGUI::updateConfig() setLocation(_settings.value("Display/location").toInt()); } + +void PVSGUI::setVisible(bool visible) +{ + QWidget::setVisible(visible); + _showAction->setChecked(isVisible()); +} + //////////////////////////////////////////////////////////////////////////////// // Protected @@ -178,6 +186,8 @@ void PVSGUI::mouseMoveEvent(QMouseEvent *event) void PVSGUI::setupMenu() { // setup actions + _showAction = new QAction(tr("Show &toolbar"), this); + _showAction->setCheckable(true); _disconnectAction = new QAction(tr("&Disconnect"), this); _startChatAction = new QAction(tr("C&hat"), this); _sendFileAction = new QAction(tr("&Send File"), this); @@ -187,6 +197,7 @@ void PVSGUI::setupMenu() _quitAction = new QAction(tr("&Quit"), this); // setup menu + _menu->addAction(_showAction); _menu->addMenu(_hostMenu); _menu->addAction(_disconnectAction); _menu->addAction(_showInfoAction); @@ -402,9 +413,34 @@ void PVSGUI::receiveFile() //////////////////////////////////////////////////////////////////////////////// // Main +void printHelp() +{ + QTextStream qout(stdout); + qout << QObject::tr("Usage: pvsgui [OPTIONS]...") << endl; + qout << QObject::tr("Start the Pool Video Switch GUI.") << endl; + qout << QObject::tr("Options:") << endl << endl; + qout << "-n or --nobar" << "\t" << QObject::tr("Start only with systray icon.") << endl; + qout << "-h or --help" << "\t" << QObject::tr("Show this help text and quit.") << endl; + qout << "-v or --version" << "\t" << QObject::tr("Show version and quit.") << endl; + qout << endl; + qout.flush(); + exit(0); +} + +void printVersion() +{ + QTextStream qout(stdout); + qout << QObject::tr("Version: ") << VERSION_STRING << endl; + qout << endl; + qout.flush(); + exit(0); +} + int main(int argc, char *argv[]) { QApplication app(argc, argv); + QStringList args = app.arguments(); + app.setQuitOnLastWindowClosed(false); app.setOrganizationName("openslx"); app.setOrganizationDomain("openslx.org"); app.setApplicationName("pvsgui"); @@ -414,7 +450,16 @@ int main(int argc, char *argv[]) translator.load(":pvsgui"); app.installTranslator(&translator); + if (args.contains("-h") || args.contains("--help")) + printHelp(); + + if (args.contains("-v") || args.contains("--version")) + printVersion(); + PVSGUI pvsgui; + if (!args.contains("-n") && !args.contains("--nobar")) + pvsgui.setVisible(true); + return app.exec(); } diff --git a/src/pvsgui.h b/src/pvsgui.h index ec7c6d7..171f6bd 100644 --- a/src/pvsgui.h +++ b/src/pvsgui.h @@ -44,6 +44,7 @@ public: public Q_SLOTS: void updateConfig(); + void setVisible(bool visible); protected: void enterEvent(QEvent *e); @@ -80,6 +81,7 @@ private: ClientVNCViewer *_vncViewer; AboutDialog *_aboutDialog; + QAction *_showAction; QAction *_disconnectAction; QAction *_startChatAction; QAction *_sendFileAction; -- cgit v1.2.3-55-g7522