зеркало из https://github.com/nextcloud/desktop.git
Added --help option with output
This commit is contained in:
Родитель
c90eb1cca6
Коммит
9901d3a736
|
@ -20,6 +20,8 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
Mirall::Application app(argc, argv);
|
Mirall::Application app(argc, argv);
|
||||||
|
|
||||||
return app.exec();
|
if( ! app.giveHelp() )
|
||||||
|
return app.exec();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LOG_TO_CALLBACK // FIXME: This should be in csync.
|
#define LOG_TO_CALLBACK // FIXME: This should be in csync.
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "mirall/application.h"
|
#include "mirall/application.h"
|
||||||
#include "mirall/folder.h"
|
#include "mirall/folder.h"
|
||||||
|
@ -70,7 +71,8 @@ Application::Application(int &argc, char **argv) :
|
||||||
#endif
|
#endif
|
||||||
_contextMenu(0),
|
_contextMenu(0),
|
||||||
_ocInfo(0),
|
_ocInfo(0),
|
||||||
_updateDetector(0)
|
_updateDetector(0),
|
||||||
|
_helpOnly(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef OWNCLOUD_CLIENT
|
#ifdef OWNCLOUD_CLIENT
|
||||||
|
@ -81,9 +83,11 @@ Application::Application(int &argc, char **argv) :
|
||||||
setApplicationName( _theme->appName() );
|
setApplicationName( _theme->appName() );
|
||||||
setWindowIcon( _theme->applicationIcon() );
|
setWindowIcon( _theme->applicationIcon() );
|
||||||
|
|
||||||
processEvents();
|
if( arguments().contains("--help")) {
|
||||||
|
showHelp();
|
||||||
|
}
|
||||||
setupLogBrowser();
|
setupLogBrowser();
|
||||||
|
processEvents();
|
||||||
|
|
||||||
QTranslator *qtTranslator = new QTranslator;
|
QTranslator *qtTranslator = new QTranslator;
|
||||||
qtTranslator->load("qt_" + QLocale::system().name(),
|
qtTranslator->load("qt_" + QLocale::system().name(),
|
||||||
|
@ -717,5 +721,23 @@ void Application::computeOverallSyncStatus()
|
||||||
_tray->setToolTip(trayMessage);
|
_tray->setToolTip(trayMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::showHelp()
|
||||||
|
{
|
||||||
|
std::cout << _theme->appName().toLatin1().constData() << " version " <<
|
||||||
|
_theme->version().toLatin1().constData() << std::endl << std::endl;
|
||||||
|
std::cout << "File synchronisation desktop utility." << std::endl << std::endl;
|
||||||
|
std::cout << "Options:" << std::endl;
|
||||||
|
std::cout << " --logwindow : open a window to show log output." << std::endl;
|
||||||
|
std::cout << " --logfile <filename> : write log output to file <filename>." << std::endl;
|
||||||
|
std::cout << " --flushlog : flush the log file after every write." << std::endl;
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << "For more information, see http://www.owncloud.org" << std::endl;
|
||||||
|
_helpOnly = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Application::giveHelp()
|
||||||
|
{
|
||||||
|
return _helpOnly;
|
||||||
|
}
|
||||||
} // namespace Mirall
|
} // namespace Mirall
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,9 @@ class Application : public QApplication
|
||||||
public:
|
public:
|
||||||
explicit Application(int &argc, char **argv);
|
explicit Application(int &argc, char **argv);
|
||||||
~Application();
|
~Application();
|
||||||
|
|
||||||
|
bool giveHelp();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
@ -81,6 +84,8 @@ protected slots:
|
||||||
void slotStartUpdateDetector();
|
void slotStartUpdateDetector();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void showHelp();
|
||||||
|
|
||||||
// configuration file -> folder
|
// configuration file -> folder
|
||||||
QSystemTrayIcon *_tray;
|
QSystemTrayIcon *_tray;
|
||||||
QAction *_actionQuit;
|
QAction *_actionQuit;
|
||||||
|
@ -107,6 +112,7 @@ private:
|
||||||
UpdateDetector *_updateDetector;
|
UpdateDetector *_updateDetector;
|
||||||
QMap<Folder*, QString> _overallStatusStrings;
|
QMap<Folder*, QString> _overallStatusStrings;
|
||||||
LogBrowser *_logBrowser;
|
LogBrowser *_logBrowser;
|
||||||
|
bool _helpOnly;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Mirall
|
} // namespace Mirall
|
||||||
|
|
|
@ -48,6 +48,7 @@ void UpdateDetector::versionCheck( Theme *theme )
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
platform = QLatin1String( "macos" );
|
platform = QLatin1String( "macos" );
|
||||||
#endif
|
#endif
|
||||||
|
qDebug() << "00 client update check to " << url.toString();
|
||||||
|
|
||||||
QString sysInfo = getSystemInfo();
|
QString sysInfo = getSystemInfo();
|
||||||
if( !sysInfo.isEmpty() ) {
|
if( !sysInfo.isEmpty() ) {
|
||||||
|
@ -56,8 +57,6 @@ void UpdateDetector::versionCheck( Theme *theme )
|
||||||
url.addQueryItem( "version", ver );
|
url.addQueryItem( "version", ver );
|
||||||
url.addQueryItem( "platform", platform );
|
url.addQueryItem( "platform", platform );
|
||||||
|
|
||||||
qDebug() << "00 client update check to " << url.toString();
|
|
||||||
|
|
||||||
_accessManager->get( QNetworkRequest( url ));
|
_accessManager->get( QNetworkRequest( url ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче