Songbook-Client  0.7
This application is a manager of customguitar songbooks
 All Classes Files Functions Variables Enumerations Enumerator Pages
make-songbook-process.hh
Go to the documentation of this file.
1 // Copyright (C) 2009-2011, Romain Goffe <romain.goffe@gmail.com>
2 // Copyright (C) 2009-2011, Alexandre Dupas <alexandre.dupas@gmail.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License as
6 // published by the Free Software Foundation; either version 2 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 // 02110-1301, USA.
18 //******************************************************************************
19 #ifndef __MAKE_SONGBOOK_PROCESS_HH__
20 #define __MAKE_SONGBOOK_PROCESS_HH__
21 
22 #include <QProcess>
23 #include <QString>
24 #include <QStringList>
25 #include <QUrl>
26 
44 class CMakeSongbookProcess : public QProcess
45 {
46  Q_OBJECT
47  Q_PROPERTY(QString command READ command WRITE setCommand)
48  Q_PROPERTY(QString program READ program WRITE setProgram)
49  Q_PROPERTY(QStringList arguments READ arguments WRITE setArguments)
50 
51  Q_PROPERTY(QString startMessage READ startMessage WRITE setStartMessage)
52  Q_PROPERTY(QString successMessage READ successMessage WRITE setSuccessMessage)
53  Q_PROPERTY(QString errorMessage READ errorMessage WRITE setErrorMessage)
54 
55  Q_PROPERTY(QUrl urlToOpen READ urlToOpen WRITE setUrlToOpen)
56 
57 public slots:
58 
64  void execute();
65 
71  void setCommand(const QString &command);
72 
78  void setStartMessage(const QString &message);
79 
85  void setSuccessMessage(const QString &message);
86 
92  void setErrorMessage(const QString &message);
93 
99  void setUrlToOpen(const QUrl &url);
100 
101 public:
103  CMakeSongbookProcess(QObject *parent = 0);
104 
106  virtual ~CMakeSongbookProcess();
107 
112  QString command() const;
113 
118  const QString & startMessage() const;
119 
123  const QString & successMessage() const;
124 
129  const QString & errorMessage() const;
130 
134  const QUrl & urlToOpen() const;
135 
136 signals:
141  void aboutToStart();
142 
147  void message(const QString &message, int timeout);
148 
153  void readOnStandardOutput(const QString &output);
154 
159  void readOnStandardError(const QString &error);
160 
161 private slots:
166  void readStandardOutput();
167 
172  void readStandardError();
173 
178  void onStarted();
179 
184  void onFinished(int exitCode, QProcess::ExitStatus exitStatus);
185 
186 private:
187 
192  const QString & program() const;
193 
199  void setProgram(const QString &program);
200 
206  const QStringList & arguments() const;
207 
213  void setArguments(const QStringList &arguments);
214 
215  QString m_program;
216  QStringList m_arguments;
217 
218  QString m_startMessage;
219  QString m_successMessage;
220  QString m_errorMessage;
221 
222  QUrl m_urlToOpen;
223 };
224 
225 #endif // __MAKE_SONGBOOK_PROCESS_HH__