~daker/webbrowser-app/fix.1212980

« back to all changes in this revision

Viewing changes to src/app/commandline-parser.cpp

  • Committer: Alexandre Abreu
  • Date: 2013-09-13 22:56:39 UTC
  • mfrom: (304 trunk)
  • mto: This revision was merged to the branch mainline in revision 305.
  • Revision ID: alexandre.abreu@canonical.com-20130913225639-jkovdi9uw98xmn9g
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
CommandLineParser::CommandLineParser(QStringList arguments, QObject* parent)
33
33
    : QObject(parent)
34
34
    , m_help(false)
35
 
    , m_chromeless(false)
36
35
    , m_fullscreen(false)
37
36
    , m_url(DEFAULT_HOMEPAGE)
38
37
    , m_remoteInspector(false)
39
38
    , m_webapp(false)
 
39
    , m_chromeFlags(0U)
40
40
{
41
41
    QStringList args = arguments;
42
42
    args.removeFirst();
49
49
            if (argument.startsWith("-")) {
50
50
                args.removeAt(i);
51
51
                if (argument == "--chromeless") {
52
 
                    m_chromeless = true;
 
52
                    m_chromeFlags |= CHROMELESS;
53
53
                } else if (argument == "--fullscreen") {
54
54
                    m_fullscreen = true;
55
55
                } else if (argument == "--inspector") {
67
67
                            }
68
68
                        }
69
69
                    }
 
70
                } else if (argument == "--enable-back-forward") {
 
71
                    m_chromeFlags |= BACK_FORWARD_BUTTONS;
 
72
                } else if (argument == "--enable-activity") {
 
73
                    m_chromeFlags |= ACTIVITY_BUTTON | ADDRESS_BAR;
 
74
                } else if (argument == "--enable-addressbar") {
 
75
                    m_chromeFlags |= ADDRESS_BAR;
70
76
                } else if (argument.startsWith("--webapp")) {
71
77
                    // We use the name as a reference instead of the URL with a
72
78
                    // subsequent step to match it with a webapp.
122
128
    QString command = QFileInfo(QCoreApplication::applicationFilePath()).fileName();
123
129
    out << "Usage: " << command << " [-h|--help] [--chromeless] [--fullscreen] [--homepage=URL] [URL]" << endl;
124
130
    out << "Options:" << endl;
125
 
    out << "  -h, --help                        display this help message and exit" << endl;
126
 
    out << "  --chromeless                      do not display any chrome (web application mode)" << endl;
127
 
    out << "  --fullscreen                      display full screen" << endl;
128
 
    out << "  --homepage=URL                    override any URL passed as an argument" << endl;
129
 
    out << "  --inspector                       run a remote inspector on port " << REMOTE_INSPECTOR_PORT << endl;
130
 
    out << "  --webapp[=name]                   launch the browser as a webapp trying to match it by name with an installed webapp integration script (if any)" << endl;
131
 
    out << "  --app-id=APP_ID                   run the application with a specific APP_ID" << endl;
 
131
    out << "  -h, --help             display this help message and exit" << endl;
 
132
    out << "  --fullscreen           display full screen" << endl;
 
133
    out << "  --homepage=URL         override any URL passed as an argument" << endl;
 
134
    out << "  --inspector            run a remote inspector on port " << REMOTE_INSPECTOR_PORT << endl;
 
135
    out << "  --webapp[=name]        launch the browser as a webapp trying to match it by name with an installed webapp integration script (if any)" << endl;
 
136
    out << "  --app-id=APP_ID        run the application with a specific APP_ID" << endl;
132
137
    out << "  --webappUrlPatterns=url-patterns  when running as a webapp (see --webapp), list of ',' separated url patterns (wildcard based) that the webapp can navigate to" << endl;
 
138
    out << "Chrome options (if none specified, the whole chrome is enabled by default):" << endl;
 
139
    out << "  --chromeless           do not display any chrome (web application mode), if set it overrides the other chrome options" << endl;
 
140
    out << "  --enable-back-forward  enable the display of the back and forward buttons" << endl;
 
141
    out << "  --enable-activity      enable the display of the activity button, the address bar is also displayed" << endl;
 
142
    out << "  --enable-addressbar    enable the display of the address bar" << endl;
 
143
}
 
144
 
 
145
CommandLineParser::ChromeElementFlags CommandLineParser::chromeFlags() const
 
146
{
 
147
    return m_chromeFlags;
133
148
}
134
149
 
135
150
QString CommandLineParser::appId() const
144
159
 
145
160
bool CommandLineParser::chromeless() const
146
161
{
147
 
    return m_chromeless;
 
162
    return m_chromeFlags & CHROMELESS;
148
163
}
149
164
 
150
165
bool CommandLineParser::fullscreen() const