Project

General

Profile

0001-add-v-version-parameter-to-non-KDE-binaries.patch

dalbers, 02/17/2009 01:58 AM

View differences:

src/common/abstractcliparser.h
36 36
    addArgument(longName, CliParserArg(CliParserArg::CliArgOption, shortName, help, def));
37 37
  }
38 38
  virtual void usage() = 0;
39
#ifndef HAVE_KDE
40
  virtual void version() = 0;
41
#endif
39 42

  
40 43
  virtual ~AbstractCliParser() {};
41 44

  
src/common/cliparser.cpp
23 23
#include <QDebug>
24 24
#include <QString>
25 25
#include <QFileInfo>
26
#include <quassel.h>
26 27

  
27 28
CliParser::CliParser() : AbstractCliParser() {
28 29

  
......
148 149
}
149 150

  
150 151
void CliParser::usage() {
152
  const Quassel::BuildInfo buildInfo = Quassel::buildInfo();
153
  qWarning() << "Version:" << buildInfo.plainVersionString;
151 154
  qWarning() << "Usage:" << QFileInfo(argsRaw.at(0)).completeBaseName() << "[arguments]";
152 155

  
153 156
  // get size of longName field
......
219 222
  }
220 223
  return QString();
221 224
}
225

  
226
#ifndef HAVE_KDE
227
void CliParser::version() {
228
  const Quassel::BuildInfo buildInfo = Quassel::buildInfo();
229
  qWarning() << "Version:" << buildInfo.plainVersionString;
230
  qWarning() << "Build/Commit Date:" << QString("%1/%2").arg(buildInfo.buildDate).arg(buildInfo.commitDate);
231
  qWarning() << "Protocol Version:" << buildInfo.protocolVersion;
232
}
233
#endif
src/common/cliparser.h
35 35
  QString value(const QString &longName);
36 36
  bool isSet(const QString &longName);
37 37
  void usage();
38
#ifndef HAVE_KDE
39
  void version();
40
#endif
38 41

  
39 42
private:
40 43
  void addArgument(const QString &longName, const CliParserArg &arg);
src/common/main.cpp
78 78
  // put shared client&core arguments here
79 79
  cliParser->addSwitch("debug",'d', "Enable debug output");
80 80
  cliParser->addSwitch("help",'h', "Display this help and exit");
81
#ifndef HAVE_KDE /* FIXME switch gets added even if HAVE_KDE was set, due to undef HAVE_KDE at the top */
82
  cliParser->addSwitch("version",'v', "Display the version string");
83
#endif
81 84

  
82 85
#ifndef BUILD_CORE
83 86
  // put client-only arguments here
src/common/quassel.cpp
79 79
  Network::setDefaultCodecForEncoding("UTF-8");
80 80
  Network::setDefaultCodecForDecoding("ISO-8859-15");
81 81

  
82
#ifndef HAVE_KDE
83
  if(isOptionSet("version")) {
84
    cliParser()->version();
85
    return false;
86
  }
87
#endif
88

  
82 89
  if(isOptionSet("help")) {
83 90
    cliParser()->usage();
84 91
    return false;
85
-