Debian Codegraph @

gui/src/qnapicli.h

raw symbols SCIP
1 /*****************************************************************************
2 ** QNapi
3 ** Copyright (C) 2008-2017 Piotr KrzemiƄski <[email protected]>
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12 **
13 *****************************************************************************/
14
15 #ifndef __QNAPICLI__H__
16 #define __QNAPICLI__H__
17
18 #include "config/qnapiconfig.h"
19
20 #include <QCoreApplication>
21 #include <QFileInfo>
22 #include <QString>
23 #include <QStringList>
24 #include <iostream>
25 #include "qnapi.h"
26
27 class QNapiCli : public QCoreApplication {
28 Q_OBJECT
29
30 public:
31 QNapiCli(int argc, char **argv, const QNapiConfig &config,
32 const QString &uiLanguage);
33
34 static bool isCliCall(int argc, char **argv);
35 int exec();
36
37 private:
38 QStringList movieList;
39 QNapiConfig config;
40 const QString uiLanguage;
41
42 enum CliExitCode {
43 EC_CMD_LINE_ARG_PARSING_ERROR = -1,
44 EC_OK = 0,
45 EC_NON_CLI_MODE = 1,
46 EC_P7ZIP_UNAVAILABLE = 2,
47 EC_CANNOT_WRITE_TMP_DIR = 3,
48 EC_UNSUPPORTED_ENGINE = 4,
49 EC_NO_WRITE_PERMISSIONS = 5,
50 EC_SUBTITLES_NOT_FOUND = 6,
51 EC_COULD_NOT_DOWNLOAD = 7,
52 EC_COULD_NOT_UNARCHIVE = 8,
53 EC_COULD_NOT_MATCH = 9,
54 EC_MOVIE_FILE_NOT_FOUND = 10
55 };
56
57 enum CliMode { CM_UNSET, CM_HELP, CM_HELP_LANGUAGES, CM_CONSOLE, CM_QUIET };
58
59 enum ShowListPolicy { SLP_SHOW, SLP_USE_CONFIG, SLP_NEVER_SHOW };
60
61 CliMode mode;
62 ShowListPolicy showPolicy;
63
64 QString lang;
65 QString langBackup;
66 bool langBackupPassed;
67 QStringList args;
68
69 bool analyze(const QStringList &args);
70 void printHeader();
71 void printHelp(const QString &binaryFileName);
72 void printHelpLanguages();
73 void printCli(const QString &string = "");
74 };
75
76 #endif