The branch, master has been updated via ed0a622e995d6e2cdd7cd99b073ea3c631055e47 (commit) from b0d8a8de03376664323c178374eae7bf71ba3031 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ed0a622e995d6e2cdd7cd99b073ea3c631055e47 Author: Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> Date: Tue Oct 30 11:52:35 2012 +0100 implemented HelpDialog ----------------------------------------------------------------------- Summary of changes: configuratorspeed.cpp => helpdialog.cpp | 70 +++++++++---------- searchbar.h => helpdialog.h | 26 +++---- helpdialog.ui | 116 +++++++++++++++++++++++++++++++ main.cpp | 3 +- workarea.cpp | 3 - x2goapplication.cpp | 38 +++++++--- x2goapplication.h | 7 +- x2goclient2.pro | 5 +- x2goclientconfig.cpp | 7 +- x2goclientconfig.h | 2 + 10 files changed, 206 insertions(+), 71 deletions(-) copy configuratorspeed.cpp => helpdialog.cpp (61%) copy searchbar.h => helpdialog.h (81%) create mode 100644 helpdialog.ui The diff of changes is: diff --git a/configuratorspeed.cpp b/helpdialog.cpp similarity index 61% copy from configuratorspeed.cpp copy to helpdialog.cpp index 4bd3460..a48cdcc 100644 --- a/configuratorspeed.cpp +++ b/helpdialog.cpp @@ -18,64 +18,62 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include "configuratorspeed.h" -#include "profile.h" + +#include "helpdialog.h" +#include "x2goapplication.h" +#include "x2goclientconfig.h" +#include <QScrollBar> +#include <QTimer> #include <QFile> #include <QTextStream> -ConfiguratorSpeed::ConfiguratorSpeed(Profile* profile, QWidget* parent, Qt::WindowFlags f): ProfileDetailConfigurator(profile, parent, f) +HelpDialog::HelpDialog(QWidget* parent, Qt::WindowFlags f): QDialog(parent, f) { setupUi(this); +} + +HelpDialog::~HelpDialog() +{ + +} + +void HelpDialog::showPacks() +{ + textBrowser->append ("<b>"+tr ("Available pack methodes:" )+"</b>"); QFile file ( ":/txt/packs" ); if ( !file.open ( QIODevice::ReadOnly | QIODevice::Text ) ) return; QTextStream in ( &file ); + QString msg; while ( !in.atEnd() ) { QString pc=in.readLine(); if ( pc.indexOf ( "-%" ) !=-1 ) { pc=pc.left ( pc.indexOf ( "-%" ) ); - methods<<pc; + pc+="-[0-9]"; } - cbMethod->addItem ( pc ); + msg+=pc+"<br>"; } + textBrowser->append(msg); file.close(); - init(); -} - -ConfiguratorSpeed::~ConfiguratorSpeed() -{ - -} - -void ConfiguratorSpeed::apply() -{ - profile->set_speed((Profile::SpeedType)hsSpeed->value()); - profile->set_quality(sbQuality->value()); - profile->set_method(cbMethod->currentText()); - ProfileDetailConfigurator::apply(); + QTimer::singleShot(1,this, SLOT(slotScrollToBegin())); + exec(); } -void ConfiguratorSpeed::defaults() +void HelpDialog::showHelp() { - hsSpeed->setValue(2); - sbQuality->setValue(9); - cbMethod->setCurrentIndex(cbMethod->findText("16m-jpeg")); - ProfileDetailConfigurator::defaults(); -} - -void ConfiguratorSpeed::init() -{ - hsSpeed->setValue(profile->get_speed()); - sbQuality->setValue(profile->get_quality()); - cbMethod->setCurrentIndex(cbMethod->findText(profile->get_method())); - slotMethodChanged(profile->get_method()); + foreach (X2GoClientConfigDetail* detail, X2GoApplication::instance()->get_clientConfig()->get_configDetails()) + { + if(detail->get_commandLineParameter()==QString::null||detail->get_description()==QString::null) + continue; + textBrowser->append("<b>"+detail->get_commandLineParameter()+"</b><br>"+detail->get_description()+"<br>"); + } + QTimer::singleShot(1,this, SLOT(slotScrollToBegin())); + exec(); } -void ConfiguratorSpeed::slotMethodChanged(QString method) +void HelpDialog::slotScrollToBegin() { - bool haveQuality=methods.contains(method); - sbQuality->setEnabled(haveQuality); - lQuality->setEnabled(haveQuality); + textBrowser->verticalScrollBar()->setValue(0); } diff --git a/searchbar.h b/helpdialog.h similarity index 81% copy from searchbar.h copy to helpdialog.h index 725e341..7e79c54 100644 --- a/searchbar.h +++ b/helpdialog.h @@ -18,23 +18,23 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef SEARCHBAR_H -#define SEARCHBAR_H -#include "svgframe.h" -#include "ui_searchbar.h" +#ifndef HELPDIALOG_H +#define HELPDIALOG_H -class SearchBar : public SVGFrame, public Ui_searchBar +#include <QDialog> +#include "ui_helpdialog.h" + +class HelpDialog: public QDialog, public Ui_HelpDialog { Q_OBJECT public: - SearchBar(QWidget* parent = 0, Qt::WindowFlags f = 0); - ~SearchBar(); - QLineEdit* getLineEdit() - { - return lineEdit; - } - + HelpDialog(QWidget* parent = 0, Qt::WindowFlags f = 0); + virtual ~HelpDialog(); + void showHelp(); + void showPacks(); +private slots: + void slotScrollToBegin(); }; -#endif // SEARCHBAR_H +#endif // HELPDIALOG_H diff --git a/helpdialog.ui b/helpdialog.ui new file mode 100644 index 0000000..401507c --- /dev/null +++ b/helpdialog.ui @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>HelpDialog</class> + <widget class="QDialog" name="HelpDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>729</width> + <height>442</height> + </rect> + </property> + <property name="windowTitle"> + <string>X2Go Client</string> + </property> + <property name="windowIcon"> + <iconset resource="resources.qrc"> + <normaloff>:/icons/128x128/x2go.png</normaloff>:/icons/128x128/x2go.png</iconset> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QTextBrowser" name="textBrowser"> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWrapMode"> + <enum>QTextEdit::NoWrap</enum> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Ok</set> + </property> + <property name="centerButtons"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <resources> + <include location="resources.qrc"/> + </resources> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>HelpDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>259</x> + <y>275</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>HelpDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>259</x> + <y>281</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/main.cpp b/main.cpp index 07debfb..c4184cc 100644 --- a/main.cpp +++ b/main.cpp @@ -46,8 +46,7 @@ int main(int argc, char *argv[]) } else { - MainWindow* mw = new MainWindow; - mw->show(); + new MainWindow; return app.exec(); } return 0; diff --git a/workarea.cpp b/workarea.cpp index bb8dbbc..baf4317 100644 --- a/workarea.cpp +++ b/workarea.cpp @@ -60,10 +60,7 @@ WorkArea::WorkArea(QWidget* parent, Qt::WindowFlags f): QWidget( parent, f) X2GoApplication::instance()->set_profileDetailConfiguratorForm(profileDetailConfiguratorForm); QTimer::singleShot(100, this, SLOT(slotResizeChildForms())); - QTimer::singleShot(400, X2GoApplication::instance(), SLOT(slotInitProfiles())); formToScroll=profileForm; -// QPushButton* b1=new QPushButton("to profile", sessionForm); -// connect(b1, SIGNAL(clicked()), this, SLOT(slotScrollToProfileForm())); } WorkArea::~WorkArea() diff --git a/x2goapplication.cpp b/x2goapplication.cpp index deeff4c..117dee2 100644 --- a/x2goapplication.cpp +++ b/x2goapplication.cpp @@ -20,14 +20,17 @@ #include <QDebug> #include <QTimer> +#include <QScrollBar> +#include <QMessageBox> #include "x2goapplication.h" #include "profile.h" #include "profileform.h" #include "workarea.h" #include "messagebox.h" -#include <QScrollBar> #include "x2goclientconfig.h" +#include "helpdialog.h" +#include "mainwindow.h" X2GoApplication::X2GoApplication(int& argc, char** argv, int flags): QApplication(argc, argv, flags) { @@ -47,13 +50,7 @@ X2GoApplication::X2GoApplication(int& argc, char** argv, int flags): QApplicatio addTranslator (appNames, "MAILCLIENT",tr ( "Email client" ) ); addTranslator (appNames, "OFFICE",tr ( "Office" ) ); addTranslator (appNames, "TERMINAL",tr ( "Terminal" ) ); - clientConfig=new X2GoClientConfig; - clientConfig->loadConfigFiles(); - if(!clientConfig->parseCommandLineArguments(arguments())) - { - qDebug()<<"error parsing command line arguments"; - ::exit(-1); - } + QTimer::singleShot(1,this,SLOT(slotInitApplication())); } X2GoApplication::~X2GoApplication() @@ -62,6 +59,31 @@ X2GoApplication::~X2GoApplication() qDebug()<<"X2Go Application exited"; } +void X2GoApplication::slotInitApplication() +{ + clientConfig=new X2GoClientConfig; + clientConfig->loadConfigFiles(); + if(!clientConfig->parseCommandLineArguments(arguments())) + { + QMessageBox::critical(0,tr("Error"), tr("Error parsing command line arguments")); + exit(-1); + } + if(clientConfig->get_showHelp().get_value().toBool()) + { + HelpDialog dialog(0); + dialog.showHelp(); + exit(-1); + } + if(clientConfig->get_showHelpPack().get_value().toBool()) + { + HelpDialog dialog(0); + dialog.showPacks(); + exit(-1); + } + slotInitProfiles(); + mainWindow->show(); +} + X2GoApplication* X2GoApplication::instance() { return (X2GoApplication*) QApplication::instance(); diff --git a/x2goapplication.h b/x2goapplication.h index a715154..7f8fd5b 100644 --- a/x2goapplication.h +++ b/x2goapplication.h @@ -29,10 +29,7 @@ public: TYPE get_##NAME(){return NAME;} #define X2GO_RO_PROPERTY(TYPE,NAME) private: TYPE NAME; \ public: TYPE get_##NAME(){return NAME;} - #define X2GO_PROPERTY_GETTER(TYPE,NAME) public: TYPE get_##NAME(){return NAME;} -#define X2GO_PROPERTY_SETTER(TYP,NAME) public: void set_##NAME(TYPE val){NAME=val;} - class SessionForm; class WorkArea; @@ -58,7 +55,7 @@ class X2GoApplication: public QApplication X2GO_PROPERTY(SessionForm*, sessionForm) X2GO_PROPERTY(MainWindow*, mainWindow) X2GO_PROPERTY(ProfileDetailConfiguratorForm*, profileDetailConfiguratorForm) - X2GO_PROPERTY_GETTER(X2GoClientConfig*, clientConfig) + X2GO_RO_PROPERTY(X2GoClientConfig*, clientConfig) public: ~X2GoApplication(); X2GoApplication(int& argc, char** argv, int = ApplicationFlags); @@ -70,11 +67,11 @@ public: void updateProfiles(); public slots: void slotInitProfiles(); + void slotInitApplication(); private: QList<Profile*> profiles; QList<nameTranslator> desktopNames; QList<nameTranslator> appNames; - X2GoClientConfig* clientConfig; private: const nameTranslator* getTranslator(QList<nameTranslator>& list, int index); QString getInternName(QList<nameTranslator>& list, QString readableName); diff --git a/x2goclient2.pro b/x2goclient2.pro index 9f723f0..4484450 100755 --- a/x2goclient2.pro +++ b/x2goclient2.pro @@ -8,7 +8,7 @@ CONFIG += $$(X2GO_CLIENT_TARGET) CONFIG += $$(X2GO_LINUX_STATIC) #CONFIG += console - +CONFIG += debug FORMS += mainwindow.ui \ workarea.ui \ profileform.ui \ @@ -26,6 +26,7 @@ FORMS += mainwindow.ui \ configuratorprinting.ui \ configuratorsharing.ui \ messagebox.ui \ + helpdialog.ui \ profile.ui SOURCES += main.cpp \ @@ -53,6 +54,7 @@ SOURCES += main.cpp \ x2goclientconfig.cpp \ x2goclientconfigdetail.cpp \ x2gosettings.cpp \ + helpdialog.cpp \ profile.cpp HEADERS += mainwindow.h \ @@ -79,6 +81,7 @@ HEADERS += mainwindow.h \ x2goclientconfig.h \ x2goclientconfigdetail.h \ x2gosettings.h \ + helpdialog.h \ profile.h LIBS += -lssh diff --git a/x2goclientconfig.cpp b/x2goclientconfig.cpp index 1f68995..ca399da 100644 --- a/x2goclientconfig.cpp +++ b/x2goclientconfig.cpp @@ -28,6 +28,9 @@ X2GoClientConfig::X2GoClientConfig() { + initDetail(&showHelp, (bool)false, "--help", QString::null, tr("show help and exit")); + initDetail(&showHelpPack, (bool)false,"--help-pack",QString::null,tr("show available pack methods and exit")); + initDetail(&printShowDialog, (bool)true, QString::null, "printing.General.showdialog", tr("Display printing dialog")); initDetail(&printPDFView, (bool)false, QString::null, "printing.General.pdfview", tr("View PDF instead of printing")); initDetail(&printCustomCommand, (bool)false, QString::null, "printing.print.startcmd", tr("Use custom printer command")); @@ -55,10 +58,8 @@ X2GoClientConfig::X2GoClientConfig() initDetail(&windowPosition, QPoint(800,600), QString::null, "sizes.mainwindow.pos", tr("Position of main window")); initDetail(&windowShowMaximized, (bool)false, "--maximize", "sizes.mainwindow.maximized", tr("Maximize main window")); - initDetail(&showHelp, (bool)false, "--help", QString::null, tr("show help and exit")); - initDetail(&showHelpPack, (bool)false,"--help-pack",QString::null,tr("show available pack methods and exit")); initDetail(&portableMode, (bool)false, "--portable", QString::null, tr("start in \"portable\" mode")); - initDetail(&cleanFilesOnExit, (bool)false, "--clean-all-files", QString::null, tr("")); + initDetail(&cleanFilesOnExit, (bool)false, "--clean-all-files", QString::null, tr("clean files in .ssh directory (portable mode)")); initDetail(&hideMenu, (bool)false, "--no-menu", QString::null, tr("hide menu bar")); initDetail(&defaultXinerama, (bool)false, "--xinerama", QString::null, tr("use Xinerama by default")); initDetail(&thinClientMode, (bool)false, "--thinclient", QString::null, tr("run without window manager")); diff --git a/x2goclientconfig.h b/x2goclientconfig.h index 37ee80d..3b750c9 100644 --- a/x2goclientconfig.h +++ b/x2goclientconfig.h @@ -103,6 +103,8 @@ class X2GoClientConfig: public QObject X2GO_RO_PROPERTY(X2GoClientConfigDetail, homeDirectory) X2GO_RO_PROPERTY(X2GoClientConfigDetail, readExportsFrom) + + X2GO_PROPERTY_GETTER(QList<X2GoClientConfigDetail*>, configDetails) public: X2GoClientConfig(); bool parseCommandLineArguments(QStringList arguments); hooks/post-receive -- x2goclient2.git (X2Go Client 2 (rewrite of x2goclient.git)) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "x2goclient2.git" (X2Go Client 2 (rewrite of x2goclient.git)).