本文整理汇总了C++中CmdLineArgs::help方法的典型用法代码示例。如果您正苦于以下问题:C++ CmdLineArgs::help方法的具体用法?C++ CmdLineArgs::help怎么用?C++ CmdLineArgs::help使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CmdLineArgs
的用法示例。
在下文中一共展示了CmdLineArgs::help方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
#ifdef Q_WS_WIN
// Make sure Windows doesn't load DLLs from the current working directory
SetDllDirectoryA("");
SetSearchPathMode(BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE);
#endif
setlocale(LC_CTYPE, "");
#if defined(Q_WS_X11) && defined(AUTOTYPE)
QApplication* app = new KeepassApplication(argc,argv);
#else
QApplication* app = new QApplication(argc,argv);
#endif
EventListener* eventListener = new EventListener();
app->installEventFilter(eventListener);
QApplication::setQuitOnLastWindowClosed(false);
AppDir = QApplication::applicationFilePath();
AppDir.truncate(AppDir.lastIndexOf("/"));
#if defined(Q_WS_X11)
DataDir = AppDir+"/../share/keepassx";
if (!QFile::exists(DataDir) && QFile::exists(AppDir+"/share"))
DataDir = AppDir+"/share";
const char* env = getenv("XDG_CONFIG_HOME");
if (!env) {
HomeDir = QDir::homePath() + "/.config";
}
else {
QString qenv = QTextCodec::codecForLocale()->toUnicode(env);
if (qenv[0] == '/')
HomeDir = qenv;
else
HomeDir = QDir::homePath() + '/' + qenv;
}
HomeDir += "/keepassx";
#elif defined(Q_WS_MAC)
HomeDir = QDir::homePath()+"/.keepassx";
DataDir = AppDir+"/../Resources/keepassx";
#else //Q_WS_WIN
HomeDir = qtWindowsConfigPath(CSIDL_APPDATA);
if(!HomeDir.isEmpty() && QFile::exists(HomeDir))
HomeDir = QDir::fromNativeSeparators(HomeDir)+"/KeePassX";
else
HomeDir = QDir::homePath()+"/KeePassX";
DataDir = AppDir+"/share";
#endif
DataDir = QDir::cleanPath(DataDir);
CmdLineArgs args;
if ( !args.parse(QApplication::arguments()) ){
qCritical("%s\n", CSTR( args.error() ));
args.printHelp();
return 1;
}
if (args.help()){
args.printHelp();
return 1;
}
//Load Config
QString IniFilename;
if(args.configLocation().isEmpty()){
if(!QDir(HomeDir).exists()){
QDir conf(QDir::homePath());
if(!QDir().mkpath(HomeDir))
qWarning("Warning: Could not create directory '%s'", CSTR(HomeDir));
}
IniFilename=HomeDir+"/config.ini";
}
else
IniFilename=args.configLocation();
#ifdef Q_WS_X11
{
QString OldHomeDir = QDir::homePath()+"/.keepassx";
if (args.configLocation().isEmpty() && QFile::exists(OldHomeDir+"/config") && !QFile::exists(HomeDir+"/config")) {
QFile::rename(OldHomeDir+"/config", HomeDir+"/config.ini");
if (QDir(OldHomeDir).entryList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::Hidden|QDir::System).count()==0)
QDir().rmdir(OldHomeDir);
}
}
#else
if (args.configLocation().isEmpty() && QFile::exists(HomeDir+"/config") && !QFile::exists(HomeDir+"/config.ini"))
QFile::rename(HomeDir+"/config", HomeDir+"/config.ini");
#endif
config = new KpxConfig(IniFilename);
fileDlgHistory.load();
// PlugIns
/*
#ifdef Q_WS_X11
if(config->integrPlugin()!=KpxConfig::NoIntegr){
QString LibName="libkeepassx-";
if(config->integrPlugin()==KpxConfig::KDE)
LibName+="kde.so";
else if(config->integrPlugin()==KpxConfig::Gnome)
//.........这里部分代码省略.........