[-]
[+]
|
Changed |
_service:tar_git:harbour-maira.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-maira.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -6,7 +6,7 @@
<service name="tar_git">
<param name="url">https://github.com/kimmoli/maira.git</param>
<param name="branch">master</param>
- <param name="revision">aa051486bc1db7302d086e3c2d745acb78df8a45</param>
+ <param name="revision">289da880a1b89b8f5984680837f88de48140a611</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-maira-0.1.5.tar.bz2/maira.pro
^
|
@@ -86,12 +86,14 @@
src/fileuploader.cpp \
src/notifications.cpp \
src/dbusAdaptor.cpp \
- src/dbus.cpp
+ src/dbus.cpp \
+ src/consolemodel.cpp
HEADERS += \
src/filedownloader.h \
src/fileuploader.h \
src/notifications.h \
src/dbusAdaptor.h \
- src/dbus.h
+ src/dbus.h \
+ src/consolemodel.h
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-maira-0.1.5.tar.bz2/qml/pages/About.qml
^
|
@@ -9,11 +9,23 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
+import harbour.maira.ConsoleModel 1.0
Page
{
id: page
+ onStatusChanged:
+ {
+ if (status === PageStatus.Activating)
+ consoleModel.executeCommand("rpm", [ "-q", "--changelog", "harbour-maira" ])
+ }
+
+ ConsoleModel
+ {
+ id: consoleModel
+ }
+
SilicaFlickable
{
anchors.fill: parent
@@ -89,6 +101,32 @@
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
}
+ SectionHeader
+ {
+ text: "Changelog"
+ }
+ Column
+ {
+ width: parent.width - Theme.horizontalPageMargin
+ x: Theme.horizontalPageMargin
+ spacing: -Theme.fontSizeExtraSmall
+ Repeater
+ {
+ width: parent.width
+ model: consoleModel
+ delegate: Text
+ {
+ width: parent.width
+ text: modelData
+ textFormat: Text.PlainText
+ color: Theme.secondaryColor
+ wrapMode: Text.Wrap
+ font.pixelSize: Theme.fontSizeExtraSmall
+ font.bold: text.charAt(0) == "*"
+ visible: text.length > 1
+ }
+ }
+ }
}
}
}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-maira-0.1.5.tar.bz2/src/consolemodel.cpp
^
|
@@ -0,0 +1,144 @@
+/*
+
+ConsoleModel is courtesy of Harbour FileBrowser
+https://github.com/karip/harbour-file-browser
+
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org>
+*/
+
+#include "consolemodel.h"
+
+enum {
+ ModelDataRole = Qt::UserRole + 1
+};
+
+ConsoleModel::ConsoleModel(QObject *parent) :
+ QAbstractListModel(parent), m_process(0)
+{
+}
+
+ConsoleModel::~ConsoleModel()
+{
+}
+
+int ConsoleModel::rowCount(const QModelIndex &parent) const
+{
+ Q_UNUSED(parent);
+ return m_lines.count();
+}
+
+QVariant ConsoleModel::data(const QModelIndex &index, int role) const
+{
+ Q_UNUSED(role);
+ if (!index.isValid() || index.row() > m_lines.count()-1)
+ return QVariant();
+
+ QString line = m_lines.at(index.row());
+ return line;
+}
+
+QHash<int, QByteArray> ConsoleModel::roleNames() const
+{
+ QHash<int, QByteArray> roles = QAbstractListModel::roleNames();
+ roles.insert(ModelDataRole, QByteArray("modelData"));
+ return roles;
+}
+
+void ConsoleModel::setLines(QStringList lines)
+{
+ if (m_lines == lines)
+ return;
+
+ beginResetModel();
+ m_lines = lines;
+ endResetModel();
+
+ emit linesChanged();
+}
+
+void ConsoleModel::setLines(QString lines)
+{
+ beginResetModel();
+ m_lines = lines.split(QRegExp("[\n\r]"));
+ endResetModel();
+ emit linesChanged();
+}
+
+void ConsoleModel::appendLine(QString line)
+{
+ beginInsertRows(QModelIndex(), m_lines.count(), m_lines.count());
+ m_lines.append(line);
+ endInsertRows();
+}
+
+bool ConsoleModel::executeCommand(QString command, QStringList arguments)
+{
+ // don't execute the command if an old command is still running
+ if (m_process && m_process->state() != QProcess::NotRunning) {
+ // if the old process doesn't stop in 1/2 secs, then don't run the new command
+ if (!m_process->waitForFinished(500))
+ return false;
+ }
+ setLines(QStringList());
+ m_process = new QProcess(this);
+ m_process->setReadChannel(QProcess::StandardOutput);
+ m_process->setProcessChannelMode(QProcess::MergedChannels); // merged stderr channel with stdout channel
+ connect(m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(readProcessChannels()));
+ connect(m_process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(handleProcessFinish(int, QProcess::ExitStatus)));
+ connect(m_process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(handleProcessError(QProcess::ProcessError)));
+ m_process->start(command, arguments);
+ // the process is killed when ConsoleModel is destroyed (usually when Page is closed)
+ // should we run the process in bg thread to allow the command to finish(?)
+
+ return true;
+}
+
+void ConsoleModel::readProcessChannels()
+{
+ while (m_process->canReadLine()) {
+ QString line = m_process->readLine();
+ appendLine(line);
+ }
+}
+
+void ConsoleModel::handleProcessFinish(int exitCode, QProcess::ExitStatus status)
+{
+ if (status == QProcess::CrashExit) { // if it crashed, then use some error exit code
+ exitCode = -99999;
+ appendLine("** crashed");
+
+ } else if (exitCode != 0) {
+ appendLine(QString("** error: %1").arg(exitCode));
+ }
+ emit processExited(exitCode);
+}
+
+void ConsoleModel::handleProcessError(QProcess::ProcessError error)
+{
+ Q_UNUSED(error);
+ emit processExited(-88888); // if error, then use some error exit code
+ appendLine("** error");
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-maira-0.1.5.tar.bz2/src/consolemodel.h
^
|
@@ -0,0 +1,79 @@
+/*
+
+ConsoleModel is courtesy of Harbour FileBrowser
+https://github.com/karip/harbour-file-browser
+
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org>
+*/
+
+#ifndef CONSOLEMODEL_H
+#define CONSOLEMODEL_H
+
+#include <QAbstractListModel>
+#include <QStringList>
+#include <QProcess>
+
+/**
+ * @brief The ConsoleModel class holds a list of strings for a QML list model.
+ */
+class ConsoleModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(QStringList lines READ lines() WRITE setLines(QString) NOTIFY linesChanged())
+
+public:
+ explicit ConsoleModel(QObject *parent = 0);
+ ~ConsoleModel();
+
+ // methods needed by ListView
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QHash<int, QByteArray> roleNames() const;
+
+ // property accessors
+ QStringList lines() const { return m_lines; }
+ void setLines(QStringList lines);
+ void setLines(QString lines);
+
+ void appendLine(QString line);
+
+ Q_INVOKABLE bool executeCommand(QString command, QStringList arguments);
+
+signals:
+ void linesChanged();
+ void processExited(int exitCode);
+
+private slots:
+ void readProcessChannels();
+ void handleProcessFinish(int exitCode, QProcess::ExitStatus status);
+ void handleProcessError(QProcess::ProcessError error);
+
+private:
+ QProcess *m_process;
+ QStringList m_lines;
+};
+
+#endif // CONSOLEMODEL_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-maira-0.1.5.tar.bz2/src/main.cpp
^
|
@@ -20,6 +20,7 @@
#include "fileuploader.h"
#include "notifications.h"
#include "dbus.h"
+#include "consolemodel.h"
class MyNetworkCookieJar : public QNetworkCookieJar
{
@@ -97,6 +98,8 @@
int main(int argc, char *argv[])
{
+ qmlRegisterType<ConsoleModel>("harbour.maira.ConsoleModel", 1, 0, "ConsoleModel");
+
QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
app->setApplicationName(APPNAME);
|