Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • akiraohgaki/ocs-manager
  • dfn2/ocs-manager
  • azubieta/ocs-manager
  • rws77/ocs-manager
4 results
Show changes
Showing
with 476 additions and 268 deletions
#pragma once
#include <QObject>
#include <QJsonObject>
class ConfigHandler;
#ifdef APP_DESKTOP
class AppImageUpdater;
#endif
class UpdateHandler : public QObject
{
Q_OBJECT
public:
explicit UpdateHandler(ConfigHandler *configHandler, QObject *parent = nullptr);
signals:
void checkAllStarted(bool status);
void checkAllFinished(bool status);
void updateStarted(QString itemKey, bool status);
void updateFinished(QString itemKey, bool status);
void updateProgress(QString itemKey, double progress);
public slots:
void checkAll();
void update(const QString &itemKey);
private slots:
#ifdef APP_DESKTOP
void appImageUpdaterFinished(AppImageUpdater *updater);
#endif
private:
#ifdef APP_DESKTOP
void updateAppImage(const QString &itemKey);
#endif
ConfigHandler *configHandler_;
QJsonObject metadataSet_;
};
......@@ -16,6 +16,9 @@ int main(int argc, char *argv[])
// Init
QGuiApplication app(argc, argv); // This is backend program, but need GUI module
auto envPath = QString::fromLocal8Bit(qgetenv("PATH").constData()) + ":" + app.applicationDirPath();
qputenv("PATH", envPath.toUtf8().constData());
auto *configHandler = new ConfigHandler(&app);
auto appConfigApplication = configHandler->getAppConfigApplication();
......@@ -44,14 +47,14 @@ int main(int argc, char *argv[])
clParser.process(app);
auto port = clParser.value(clOptionPort).toInt();
auto port = clParser.value(clOptionPort).toUShort();
// Setup websocket server
auto *wsServer = new WebSocketServer(configHandler, appConfigApplication["id"].toString(), port, &app);
QObject::connect(wsServer, &WebSocketServer::stopped, &app, &QGuiApplication::quit);
if (wsServer->start()) {
qDebug() << "Websocket server started at:" << wsServer->serverUrl().toString();
qInfo() << "Websocket server started at:" << wsServer->serverUrl().toString();
}
else {
qCritical() << "Failed to start websocket server:" << wsServer->errorString();
......
#include "appimageupdater.h"
#include <QTimer>
#include "appimage/update.h"
AppImageUpdater::AppImageUpdater(const QString &id, const QString &path, QObject *parent)
: QObject(parent), id_(id), path_(path)
{
isFinishedWithNoError_ = false;
errorString_ = "";
updater_ = new appimage::update::Updater(path_.toStdString(), false);
}
AppImageUpdater::~AppImageUpdater()
{
delete updater_;
}
QString AppImageUpdater::id() const
{
return id_;
}
QString AppImageUpdater::path() const
{
return path_;
}
bool AppImageUpdater::isFinishedWithNoError() const
{
return isFinishedWithNoError_;
}
QString AppImageUpdater::errorString() const
{
return errorString_;
}
QString AppImageUpdater::describeAppImage() const
{
std::string description;
if (updater_->describeAppImage(description)) {
return QString::fromStdString(description);
}
return QString();
}
bool AppImageUpdater::checkForChanges() const
{
bool updateAvailable;
if (updater_->checkForChanges(updateAvailable)) {
return updateAvailable;
}
return false;
}
void AppImageUpdater::start()
{
isFinishedWithNoError_ = false;
errorString_ = "";
if (!updater_->start()) {
emit finished(this);
return;
}
auto timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, &AppImageUpdater::checkProgress);
connect(this, &AppImageUpdater::finished, timer, &QTimer::stop);
timer->start(100);
}
void AppImageUpdater::checkProgress()
{
if (!updater_->isDone()) {
double progress;
if (updater_->progress(progress)) {
emit updateProgress(id_, progress);
}
return;
}
if (updater_->hasError()) {
std::string message;
while (updater_->nextStatusMessage(message)) {
errorString_ += QString::fromStdString(message) + "\n";
}
emit finished(this);
return;
}
isFinishedWithNoError_ = true;
emit finished(this);
}
#pragma once
#include <QObject>
namespace appimage {
namespace update {
class Updater;
}
}
class AppImageUpdater : public QObject
{
Q_OBJECT
public:
explicit AppImageUpdater(const QString &id, const QString &path, QObject *parent = nullptr);
~AppImageUpdater();
QString id() const;
QString path() const;
bool isFinishedWithNoError() const;
QString errorString() const;
QString describeAppImage() const;
bool checkForChanges() const;
void start();
signals:
void finished(AppImageUpdater *updater);
void updateProgress(QString id, double progress);
private slots:
void checkProgress();
private:
QString id_;
QString path_;
bool isFinishedWithNoError_;
QString errorString_;
appimage::update::Updater *updater_;
};
......@@ -4,13 +4,13 @@
#include <QWebSocketServer>
#include <QWebSocket>
#include "qtlib_json.h"
#include "qtil_json.h"
#include "handlers/confighandler.h"
#include "handlers/systemhandler.h"
#include "handlers/ocsapihandler.h"
#include "handlers/itemhandler.h"
#include "handlers/appimagehandler.h"
#include "handlers/updatehandler.h"
#include "handlers/desktopthemehandler.h"
WebSocketServer::WebSocketServer(ConfigHandler *configHandler, const QString &serverName, quint16 serverPort, QObject *parent)
......@@ -25,19 +25,25 @@ WebSocketServer::WebSocketServer(ConfigHandler *configHandler, const QString &se
systemHandler_ = new SystemHandler(this);
ocsApiHandler_ = new OcsApiHandler(configHandler_, this);
itemHandler_ = new ItemHandler(configHandler_, this);
appImageHandler_ = new AppImageHandler(configHandler_, this);
updateHandler_ = new UpdateHandler(configHandler_, this);
desktopThemeHandler_ = new DesktopThemeHandler(this);
connect(itemHandler_, &ItemHandler::metadataSetChanged, this, &WebSocketServer::itemMetadataSetChanged);
connect(itemHandler_, &ItemHandler::downloadStarted, this, &WebSocketServer::itemDownloadStarted);
connect(itemHandler_, &ItemHandler::downloadFinished, this, &WebSocketServer::itemDownloadFinished);
connect(itemHandler_, &ItemHandler::downloadProgress, this, &WebSocketServer::itemDownloadProgress);
connect(itemHandler_, &ItemHandler::saveStarted, this, &WebSocketServer::itemSaveStarted);
connect(itemHandler_, &ItemHandler::saveFinished, this, &WebSocketServer::itemSaveFinished);
connect(itemHandler_, &ItemHandler::installStarted, this, &WebSocketServer::itemInstallStarted);
connect(itemHandler_, &ItemHandler::installFinished, this, &WebSocketServer::itemInstallFinished);
connect(itemHandler_, &ItemHandler::uninstallStarted, this, &WebSocketServer::itemUninstallStarted);
connect(itemHandler_, &ItemHandler::uninstallFinished, this, &WebSocketServer::itemUninstallFinished);
connect(itemHandler_, &ItemHandler::metadataSetChanged, this, &WebSocketServer::itemHandlerMetadataSetChanged);
connect(itemHandler_, &ItemHandler::downloadStarted, this, &WebSocketServer::itemHandlerDownloadStarted);
connect(itemHandler_, &ItemHandler::downloadFinished, this, &WebSocketServer::itemHandlerDownloadFinished);
connect(itemHandler_, &ItemHandler::downloadProgress, this, &WebSocketServer::itemHandlerDownloadProgress);
connect(itemHandler_, &ItemHandler::saveStarted, this, &WebSocketServer::itemHandlerSaveStarted);
connect(itemHandler_, &ItemHandler::saveFinished, this, &WebSocketServer::itemHandlerSaveFinished);
connect(itemHandler_, &ItemHandler::installStarted, this, &WebSocketServer::itemHandlerInstallStarted);
connect(itemHandler_, &ItemHandler::installFinished, this, &WebSocketServer::itemHandlerInstallFinished);
connect(itemHandler_, &ItemHandler::uninstallStarted, this, &WebSocketServer::itemHandlerUninstallStarted);
connect(itemHandler_, &ItemHandler::uninstallFinished, this, &WebSocketServer::itemHandlerUninstallFinished);
connect(updateHandler_, &UpdateHandler::checkAllStarted, this, &WebSocketServer::updateHandlerCheckAllStarted);
connect(updateHandler_, &UpdateHandler::checkAllFinished, this, &WebSocketServer::updateHandlerCheckAllFinished);
connect(updateHandler_, &UpdateHandler::updateStarted, this, &WebSocketServer::updateHandlerUpdateStarted);
connect(updateHandler_, &UpdateHandler::updateFinished, this, &WebSocketServer::updateHandlerUpdateFinished);
connect(updateHandler_, &UpdateHandler::updateProgress, this, &WebSocketServer::updateHandlerUpdateProgress);
}
WebSocketServer::~WebSocketServer()
......@@ -49,6 +55,10 @@ WebSocketServer::~WebSocketServer()
bool WebSocketServer::start()
{
if (wsServer_->listen(QHostAddress::Any, serverPort_)) {
auto application = configHandler_->getUsrConfigApplication();
application["websocket_url"] = serverUrl().toString();
configHandler_->setUsrConfigApplication(application);
emit started();
return true;
}
......@@ -57,6 +67,10 @@ bool WebSocketServer::start()
void WebSocketServer::stop()
{
auto application = configHandler_->getUsrConfigApplication();
application["websocket_url"] = QString("");
configHandler_->setUsrConfigApplication(application);
wsServer_->close();
}
......@@ -102,7 +116,7 @@ void WebSocketServer::wsTextMessageReceived(const QString &message)
{
auto *wsClient = qobject_cast<QWebSocket *>(sender());
if (wsClient) {
qtlib::Json json(message.toUtf8());
Qtil::Json json(message.toUtf8());
if (json.isObject()) {
auto object = json.toObject();
receiveMessage(object["id"].toString(), object["func"].toString(), object["data"].toArray());
......@@ -114,7 +128,7 @@ void WebSocketServer::wsBinaryMessageReceived(const QByteArray &message)
{
auto *wsClient = qobject_cast<QWebSocket *>(sender());
if (wsClient) {
qtlib::Json json(message);
Qtil::Json json(message);
if (json.isObject()) {
auto object = json.toObject();
receiveMessage(object["id"].toString(), object["func"].toString(), object["data"].toArray());
......@@ -122,27 +136,27 @@ void WebSocketServer::wsBinaryMessageReceived(const QByteArray &message)
}
}
void WebSocketServer::itemMetadataSetChanged()
void WebSocketServer::itemHandlerMetadataSetChanged()
{
QJsonArray data;
sendMessage("", "ItemHandler::metadataSetChanged", data);
}
void WebSocketServer::itemDownloadStarted(QJsonObject result)
void WebSocketServer::itemHandlerDownloadStarted(QJsonObject result)
{
QJsonArray data;
data.append(result);
sendMessage("", "ItemHandler::downloadStarted", data);
}
void WebSocketServer::itemDownloadFinished(QJsonObject result)
void WebSocketServer::itemHandlerDownloadFinished(QJsonObject result)
{
QJsonArray data;
data.append(result);
sendMessage("", "ItemHandler::downloadFinished", data);
}
void WebSocketServer::itemDownloadProgress(QString id, qint64 bytesReceived, qint64 bytesTotal)
void WebSocketServer::itemHandlerDownloadProgress(QString id, qint64 bytesReceived, qint64 bytesTotal)
{
QJsonArray data;
data.append(id);
......@@ -151,48 +165,86 @@ void WebSocketServer::itemDownloadProgress(QString id, qint64 bytesReceived, qin
sendMessage("", "ItemHandler::downloadProgress", data);
}
void WebSocketServer::itemSaveStarted(QJsonObject result)
void WebSocketServer::itemHandlerSaveStarted(QJsonObject result)
{
QJsonArray data;
data.append(result);
sendMessage("", "ItemHandler::saveStarted", data);
}
void WebSocketServer::itemSaveFinished(QJsonObject result)
void WebSocketServer::itemHandlerSaveFinished(QJsonObject result)
{
QJsonArray data;
data.append(result);
sendMessage("", "ItemHandler::saveFinished", data);
}
void WebSocketServer::itemInstallStarted(QJsonObject result)
void WebSocketServer::itemHandlerInstallStarted(QJsonObject result)
{
QJsonArray data;
data.append(result);
sendMessage("", "ItemHandler::installStarted", data);
}
void WebSocketServer::itemInstallFinished(QJsonObject result)
void WebSocketServer::itemHandlerInstallFinished(QJsonObject result)
{
QJsonArray data;
data.append(result);
sendMessage("", "ItemHandler::installFinished", data);
}
void WebSocketServer::itemUninstallStarted(QJsonObject result)
void WebSocketServer::itemHandlerUninstallStarted(QJsonObject result)
{
QJsonArray data;
data.append(result);
sendMessage("", "ItemHandler::uninstallStarted", data);
}
void WebSocketServer::itemUninstallFinished(QJsonObject result)
void WebSocketServer::itemHandlerUninstallFinished(QJsonObject result)
{
QJsonArray data;
data.append(result);
sendMessage("", "ItemHandler::uninstallFinished", data);
}
void WebSocketServer::updateHandlerCheckAllStarted(bool status)
{
QJsonArray data;
data.append(status);
sendMessage("", "UpdateHandler::checkAllStarted", data);
}
void WebSocketServer::updateHandlerCheckAllFinished(bool status)
{
QJsonArray data;
data.append(status);
sendMessage("", "UpdateHandler::checkAllFinished", data);
}
void WebSocketServer::updateHandlerUpdateStarted(QString itemKey, bool status)
{
QJsonArray data;
data.append(itemKey);
data.append(status);
sendMessage("", "UpdateHandler::updateStarted", data);
}
void WebSocketServer::updateHandlerUpdateFinished(QString itemKey, bool status)
{
QJsonArray data;
data.append(itemKey);
data.append(status);
sendMessage("", "UpdateHandler::updateFinished", data);
}
void WebSocketServer::updateHandlerUpdateProgress(QString itemKey, double progress)
{
QJsonArray data;
data.append(itemKey);
data.append(progress);
sendMessage("", "UpdateHandler::updateProgress", data);
}
void WebSocketServer::receiveMessage(const QString &id, const QString &func, const QJsonArray &data)
{
/* message object format
......@@ -249,6 +301,12 @@ void WebSocketServer::receiveMessage(const QString &id, const QString &func, con
else if (func == "ConfigHandler::setUsrConfigInstalledItems") {
resultData.append(configHandler_->setUsrConfigInstalledItems(data.at(0).toObject()));
}
else if (func == "ConfigHandler::getUsrConfigUpdateAvailableItems") {
resultData.append(configHandler_->getUsrConfigUpdateAvailableItems());
}
else if (func == "ConfigHandler::setUsrConfigUpdateAvailableItems") {
resultData.append(configHandler_->setUsrConfigUpdateAvailableItems(data.at(0).toObject()));
}
else if (func == "ConfigHandler::setUsrConfigProvidersProvider") {
resultData.append(configHandler_->setUsrConfigProvidersProvider(data.at(0).toString(), data.at(1).toObject()));
}
......@@ -270,10 +328,13 @@ void WebSocketServer::receiveMessage(const QString &id, const QString &func, con
else if (func == "ConfigHandler::removeUsrConfigInstalledItemsItem") {
resultData.append(configHandler_->removeUsrConfigInstalledItemsItem(data.at(0).toString()));
}
// SystemHandler
else if (func == "SystemHandler::isUnix") {
resultData.append(systemHandler_->isUnix());
else if (func == "ConfigHandler::setUsrConfigUpdateAvailableItemsItem") {
resultData.append(configHandler_->setUsrConfigUpdateAvailableItemsItem(data.at(0).toString(), data.at(1).toObject()));
}
else if (func == "ConfigHandler::removeUsrConfigUpdateAvailableItemsItem") {
resultData.append(configHandler_->removeUsrConfigUpdateAvailableItemsItem(data.at(0).toString()));
}
// SystemHandler
else if (func == "SystemHandler::isMobileDevice") {
resultData.append(systemHandler_->isMobileDevice());
}
......@@ -315,16 +376,12 @@ void WebSocketServer::receiveMessage(const QString &id, const QString &func, con
else if (func == "ItemHandler::uninstall") {
itemHandler_->uninstall(data.at(0).toString());
}
// AppImageHandler
else if (func == "AppImageHandler::isUpdateAvailable") {
resultData.append(appImageHandler_->isUpdateAvailable(data.at(0).toString()));
// UpdateHandler
else if (func == "UpdateHandler::checkAll") {
updateHandler_->checkAll();
}
else if (func == "AppImageHandler::updateAppImage") {
#ifdef QTLIB_UNIX
resultData.append(appImageHandler_->updateAppImage(data.at(0).toString()));
#else
resultData.append(false);
#endif
else if (func == "UpdateHandler::update") {
updateHandler_->update(data.at(0).toString());
}
// DesktopThemeHandler
else if (func == "DesktopThemeHandler::desktopEnvironment") {
......@@ -334,11 +391,7 @@ void WebSocketServer::receiveMessage(const QString &id, const QString &func, con
resultData.append(desktopThemeHandler_->isApplicableType(data.at(0).toString()));
}
else if (func == "DesktopThemeHandler::applyTheme") {
#ifdef QTLIB_UNIX
resultData.append(desktopThemeHandler_->applyTheme(data.at(0).toString(), data.at(1).toString()));
#else
resultData.append(false);
#endif
}
// Not supported
else {
......@@ -363,7 +416,7 @@ void WebSocketServer::sendMessage(const QString &id, const QString &func, const
object["func"] = func;
object["data"] = data;
auto binaryMessage = qtlib::Json(object).toJson();
auto binaryMessage = Qtil::Json(object).toJson();
auto textMessage = QString::fromUtf8(binaryMessage);
for (auto *wsClient : wsClients_) {
......
......@@ -12,7 +12,7 @@ class ConfigHandler;
class SystemHandler;
class OcsApiHandler;
class ItemHandler;
class AppImageHandler;
class UpdateHandler;
class DesktopThemeHandler;
class WebSocketServer : public QObject
......@@ -40,16 +40,22 @@ private slots:
void wsTextMessageReceived(const QString &message);
void wsBinaryMessageReceived(const QByteArray &message);
void itemMetadataSetChanged();
void itemDownloadStarted(QJsonObject result);
void itemDownloadFinished(QJsonObject result);
void itemDownloadProgress(QString id, qint64 bytesReceived, qint64 bytesTotal);
void itemSaveStarted(QJsonObject result);
void itemSaveFinished(QJsonObject result);
void itemInstallStarted(QJsonObject result);
void itemInstallFinished(QJsonObject result);
void itemUninstallStarted(QJsonObject result);
void itemUninstallFinished(QJsonObject result);
void itemHandlerMetadataSetChanged();
void itemHandlerDownloadStarted(QJsonObject result);
void itemHandlerDownloadFinished(QJsonObject result);
void itemHandlerDownloadProgress(QString id, qint64 bytesReceived, qint64 bytesTotal);
void itemHandlerSaveStarted(QJsonObject result);
void itemHandlerSaveFinished(QJsonObject result);
void itemHandlerInstallStarted(QJsonObject result);
void itemHandlerInstallFinished(QJsonObject result);
void itemHandlerUninstallStarted(QJsonObject result);
void itemHandlerUninstallFinished(QJsonObject result);
void updateHandlerCheckAllStarted(bool status);
void updateHandlerCheckAllFinished(bool status);
void updateHandlerUpdateStarted(QString itemKey, bool status);
void updateHandlerUpdateFinished(QString itemKey, bool status);
void updateHandlerUpdateProgress(QString itemKey, double progress);
private:
void receiveMessage(const QString &id, const QString &func, const QJsonArray &data);
......@@ -59,7 +65,7 @@ private:
SystemHandler *systemHandler_;
OcsApiHandler *ocsApiHandler_;
ItemHandler *itemHandler_;
AppImageHandler *appImageHandler_;
UpdateHandler *updateHandler_;
DesktopThemeHandler *desktopThemeHandler_;
QString serverName_;
......
unix:!ios:!android {
contains(DEFINES, APP_DESKTOP) {
isEmpty(PREFIX) {
PREFIX = /usr/local
}
......
......@@ -6,3 +6,4 @@ Type=Application
Terminal=true
NoDisplay=true
Categories=Network;Utility;
X-AppImage-Integrate=false
......@@ -4,107 +4,112 @@
<context>
<name>ItemHandler</name>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="55"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="53"/>
<source>The item already installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="62"/>
<source>The file already downloading</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="69"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="76"/>
<source>Downloading</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="119"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="125"/>
<source>Invalid OCS-URL</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="128"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="136"/>
<source>The item not installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="142"/>
<source>Uninstalling</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="197"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="212"/>
<source>Uninstalled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="222"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="237"/>
<source>Downloaded</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="252"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="291"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="267"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="311"/>
<source>Saving</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="264"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="306"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="284"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="328"/>
<source>Failed to save data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="271"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="314"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="291"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="336"/>
<source>Saved</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="319"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="341"/>
<source>Installing</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="330"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="352"/>
<source>The file has been installed as program</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="335"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="357"/>
<source>The plasmoid has been installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="340"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="362"/>
<source>The plasma look and feel has been installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="345"/>
<source>The plasma desktop theme has been installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="350"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="372"/>
<source>The KWin effect has been installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="355"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="377"/>
<source>The KWin script has been installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="360"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="382"/>
<source>The KWin window switcher has been installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="363"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="385"/>
<source>The archive file has been extracted</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="366"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="380"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="388"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="402"/>
<source>The file has been installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="370"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="384"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="392"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="406"/>
<source>Failed to installation</source>
<translation type="unfinished"></translation>
</message>
......
......@@ -4,107 +4,112 @@
<context>
<name>ItemHandler</name>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="55"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="53"/>
<source>The item already installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="62"/>
<source>The file already downloading</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="69"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="76"/>
<source>Downloading</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="119"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="125"/>
<source>Invalid OCS-URL</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="128"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="136"/>
<source>The item not installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="142"/>
<source>Uninstalling</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="197"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="212"/>
<source>Uninstalled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="222"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="237"/>
<source>Downloaded</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="252"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="291"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="267"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="311"/>
<source>Saving</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="264"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="306"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="284"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="328"/>
<source>Failed to save data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="271"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="314"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="291"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="336"/>
<source>Saved</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="319"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="341"/>
<source>Installing</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="330"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="352"/>
<source>The file has been installed as program</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="335"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="357"/>
<source>The plasmoid has been installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="340"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="362"/>
<source>The plasma look and feel has been installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="345"/>
<source>The plasma desktop theme has been installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="350"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="372"/>
<source>The KWin effect has been installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="355"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="377"/>
<source>The KWin script has been installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="360"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="382"/>
<source>The KWin window switcher has been installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="363"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="385"/>
<source>The archive file has been extracted</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="366"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="380"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="388"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="402"/>
<source>The file has been installed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/src/handlers/itemhandler.cpp" line="370"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="384"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="392"/>
<location filename="../app/src/handlers/itemhandler.cpp" line="406"/>
<source>Failed to installation</source>
<translation type="unfinished"></translation>
</message>
......
include($${PWD}/qtlib/qtlib.pri)
include($${PWD}/qtil/qtil.pri)
unix:!ios:!android {
contains(DEFINES, APP_DESKTOP) {
INCLUDEPATH += $${PWD}/AppImageUpdate/include
DEPENDPATH += $${PWD}/AppImageUpdate/include
......@@ -8,18 +8,22 @@ unix:!ios:!android {
LIBS += \
-L$${PWD}/AppImageUpdate-prebuilt/src/ -lappimageupdate \
-L$${PWD}/AppImageUpdate-prebuilt/lib/zsync2/src/ -lzsync2 \
$${PWD}/AppImageUpdate-prebuilt/lib/zsync2/lib/hashlib/hashlib.a \
-L$${PWD}/AppImageUpdate-prebuilt/lib/ -lcpr \
-L$${PWD}/AppImageUpdate-prebuilt/lib/zsync2/lib/libzsync/ -lzsync \
-L$${PWD}/AppImageUpdate-prebuilt/lib/zsync2/lib/librcksum/ -lrcksum \
-L$${PWD}/AppImageUpdate-prebuilt/lib/zsync2/lib/zlib/ -lz \
-L$${PWD}/AppImageUpdate-prebuilt/lib/ -lcpr
-L$${PWD}/AppImageUpdate-prebuilt/lib/zsync2/lib/zlib/ -lzsync2_libz \
-L$${PWD}/AppImageUpdate-prebuilt/lib/libappimage/src/libappimage_shared/ -lappimage_shared
PRE_TARGETDEPS += \
$${PWD}/AppImageUpdate-prebuilt/src/libappimageupdate.a \
$${PWD}/AppImageUpdate-prebuilt/lib/zsync2/src/libzsync2.a \
$${PWD}/AppImageUpdate-prebuilt/lib/zsync2/lib/hashlib/hashlib.a \
$${PWD}/AppImageUpdate-prebuilt/lib/libcpr.a \
$${PWD}/AppImageUpdate-prebuilt/lib/zsync2/lib/libzsync/libzsync.a \
$${PWD}/AppImageUpdate-prebuilt/lib/zsync2/lib/librcksum/librcksum.a \
$${PWD}/AppImageUpdate-prebuilt/lib/zsync2/lib/zlib/libz.a \
$${PWD}/AppImageUpdate-prebuilt/lib/libcpr.a
$${PWD}/AppImageUpdate-prebuilt/lib/zsync2/lib/zlib/libzsync2_libz.a \
$${PWD}/AppImageUpdate-prebuilt/lib/libappimage/src/libappimage_shared/libappimage_shared.a
LIBS += -lcurl
}
ios|android|!isEmpty(APP_MOBILE) {
DEFINES += APP_MOBILE
} else {
} else:unix:!macx {
DEFINES += APP_DESKTOP
}
......
#!/bin/sh
PKGNAME='ocs-manager'
PKGVER='0.4.4'
PKGREL='1'
curl -L -o linuxdeployqt "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
chmod 755 linuxdeployqt
./linuxdeployqt --appimage-extract
sh scripts/import.sh
qmake PREFIX="/usr"
make
make INSTALL_ROOT="${PKGNAME}.AppDir" install
./squashfs-root/AppRun ${PKGNAME}.AppDir/usr/share/applications/${PKGNAME}.desktop -bundle-non-qt-libs -no-translations
install -D -m 755 /lib/x86_64-linux-gnu/libssl.so.1.0.0 ${PKGNAME}.AppDir/usr/lib/libssl.so.1.0.0
install -D -m 755 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 ${PKGNAME}.AppDir/usr/lib/libcrypto.so.1.0.0
install -D -m 755 /lib/x86_64-linux-gnu/libz.so.1 ${PKGNAME}.AppDir/usr/lib/libz.so.1
./squashfs-root/AppRun ${PKGNAME}.AppDir/usr/share/applications/${PKGNAME}.desktop -appimage
mv *.AppImage ${PKGNAME}-${PKGVER}-${PKGREL}-x86_64.AppImage
#!/bin/bash
PKGNAME='ocs-manager'
PKGVER='0.8.1'
PKGREL='1'
#UPDINFO='zsync|http://***/ocs-manager-x86_64.AppImage.zsync'
APPDIR="${PKGNAME}.AppDir"
./scripts/prepare
qmake PREFIX=/usr
make
make INSTALL_ROOT=${APPDIR} install
curl -fsSL -o linuxdeployqt https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
chmod 755 linuxdeployqt
./linuxdeployqt --appimage-extract
./squashfs-root/AppRun ${APPDIR}/usr/share/applications/${PKGNAME}.desktop -bundle-non-qt-libs -no-translations
install -D -m 755 /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 ${APPDIR}/usr/lib/libfontconfig.so.1
install -D -m 755 /usr/lib/x86_64-linux-gnu/libfreetype.so.6 ${APPDIR}/usr/lib/libfreetype.so.6
install -D -m 755 /lib/x86_64-linux-gnu/libssl.so.1.0.0 ${APPDIR}/usr/lib/libssl.so.1.0.0
install -D -m 755 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 ${APPDIR}/usr/lib/libcrypto.so.1.0.0
install -D -m 755 /lib/x86_64-linux-gnu/libz.so.1 ${APPDIR}/usr/lib/libz.so.1
install -D -m 755 /usr/bin/unzip ${APPDIR}/usr/bin/unzip
install -D -m 755 /usr/lib/p7zip/7zr ${APPDIR}/usr/bin/7zr
install -D -m 755 /usr/bin/unar ${APPDIR}/usr/bin/unar
./squashfs-root/AppRun ${APPDIR}/usr/share/applications/${PKGNAME}.desktop -appimage
mv *-x86_64.AppImage ../${PKGNAME}-${PKGVER}-${PKGREL}-x86_64.AppImage
DISTFILES += $${PWD}/appimage/appimage.sh
DISTFILES += $${PWD}/appimage/appimagebuild
#!/bin/bash
PKGNAME='ocs-manager'
PKGUSER='pkgbuilder'
BUILDTYPE=''
if [ "${1}" ]; then
BUILDTYPE="${1}"
fi
PROJDIR="$(cd "$(dirname "${0}")/../" && pwd)"
BUILDSCRIPT="${PROJDIR}/scripts/build.sh"
TRANSFERLOG="${PROJDIR}/transfer.log"
transfer_file() {
filepath="${1}"
if [ -f "${filepath}" ]; then
filename="$(basename "${filepath}")"
echo "Uploading ${filename}" >> "${TRANSFERLOG}"
curl -T "${filepath}" "https://transfer.sh/${filename}" >> "${TRANSFERLOG}"
echo "" >> "${TRANSFERLOG}"
fi
}
build_snap() {
echo 'Not implemented yet'
}
build_flatpak() {
echo 'Not implemented yet'
}
build_appimage() {
# docker-image: ubuntu:17.10
apt update -qq
apt -y install build-essential qt5-default libqt5websockets5-dev
apt -y install cmake libssl-dev libcurl4-gnutls-dev libxpm-dev
apt -y install libssl1.0.0 zlib1g
apt -y install git
apt -y install curl
useradd -m ${PKGUSER}
export HOME="/home/${PKGUSER}"
chown -R ${PKGUSER}:${PKGUSER} "${PROJDIR}"
su -c "sh "${BUILDSCRIPT}" ${BUILDTYPE}" ${PKGUSER}
transfer_file "$(find "${PROJDIR}/build_"*${BUILDTYPE} -type f -name "${PKGNAME}*.AppImage")"
}
if [ "${BUILDTYPE}" = 'snap' ]; then
build_snap
elif [ "${BUILDTYPE}" = 'flatpak' ]; then
build_flatpak
elif [ "${BUILDTYPE}" = 'appimage' ]; then
build_appimage
else
echo "sh $(basename "${0}") [snap|flatpak|appimage]"
exit 1
fi
#!/bin/bash
PKGNAME='ocs-manager'
BUILDTYPE=''
if [ "${1}" ]; then
BUILDTYPE="${1}"
fi
PROJDIR="$(cd "$(dirname "${0}")/../" && pwd)"
BUILDVER="$(cd "${PROJDIR}" && git describe --always)"
BUILDDIR="${PROJDIR}/build_${PKGNAME}_${BUILDVER}_${BUILDTYPE}"
SRCARCHIVE="${BUILDDIR}/${PKGNAME}.tar.gz"
export_srcarchive() {
filepath="${1}"
$(cd "${PROJDIR}" && git archive --prefix="${PKGNAME}/" --output="${filepath}" HEAD)
}
build_snap() {
echo 'Not implemented yet'
}
build_flatpak() {
echo 'Not implemented yet'
}
build_appimage() {
cd "${PROJDIR}"
mkdir -p "${BUILDDIR}"
export_srcarchive "${SRCARCHIVE}"
tar -xzvf "${SRCARCHIVE}" -C "${BUILDDIR}"
cp "${PROJDIR}/pkg/appimage/appimage.sh" "${BUILDDIR}/${PKGNAME}"
cd "${BUILDDIR}/${PKGNAME}"
sh appimage.sh
}
if [ "${BUILDTYPE}" = 'snap' ]; then
build_snap
elif [ "${BUILDTYPE}" = 'flatpak' ]; then
build_flatpak
elif [ "${BUILDTYPE}" = 'appimage' ]; then
build_appimage
else
echo "sh $(basename "${0}") [snap|flatpak|appimage]"
exit 1
fi
#!/bin/bash
PKGNAME='ocs-manager'
PKGUSER='pkgbuilder'
PKGSCRIPT="${0}"
PROJDIR="$(cd "$(dirname "${0}")/../" && pwd)"
BUILDDIR="${PROJDIR}/build_${PKGNAME}"
appimage() { # docker-image: ubuntu:14.04
install_build_deps_appimage
add_pkguser
su -c "export HOME=/home/${PKGUSER} && source /opt/qt59/bin/qt59-env.sh && "${PKGSCRIPT}" build_appimage" ${PKGUSER}
}
install_build_deps_appimage() {
apt update -qq
apt -y install curl git
#apt -y install build-essential qt5-default libqt5websockets5-dev
#apt -y install cmake automake libtool pkg-config wget desktop-file-utils libglib2.0-dev libcairo2-dev libssl-dev libcurl3 libcurl4-openssl-dev libxpm-dev
apt -y install libfontconfig1 libfreetype6 libssl1.0.0 zlib1g unzip p7zip unar
apt -y install software-properties-common
add-apt-repository -y ppa:beineri/opt-qt597-trusty
echo 'deb http://download.opensuse.org/repositories/home:/TheAssassin:/AppImageLibraries/xUbuntu_14.04/ /' > /etc/apt/sources.list.d/curl-httponly.list
curl -fsSL https://download.opensuse.org/repositories/home:TheAssassin:AppImageLibraries/xUbuntu_14.04/Release.key | apt-key add -
apt update -qq
apt -y install build-essential mesa-common-dev libglu1-mesa-dev qt59base qt59websockets
curl -fsSL https://github.com/Kitware/CMake/releases/download/v3.13.3/cmake-3.13.3-Linux-x86_64.tar.gz | tar -xz --strip-components=1 -C /
apt -y install automake libtool pkg-config wget desktop-file-utils libglib2.0-dev libcairo2-dev libssl-dev libcurl3 libcurl4-openssl-dev libxpm-dev
}
build_appimage() {
rm -rf "${BUILDDIR}"
mkdir -p "${BUILDDIR}"
export_srcarchive "${BUILDDIR}/${PKGNAME}.tar.gz"
tar -xzf "${BUILDDIR}/${PKGNAME}.tar.gz" -C "${BUILDDIR}"
cp "${PROJDIR}/pkg/appimage/appimagebuild" "${BUILDDIR}/${PKGNAME}"
cd "${BUILDDIR}/${PKGNAME}"
./appimagebuild
}
add_pkguser() {
useradd -m ${PKGUSER}
chown -R ${PKGUSER} "${PROJDIR}"
}
export_srcarchive() {
if [ "${1}" ]; then
(cd "${PROJDIR}" && git archive --prefix="${PKGNAME}/" --output="${1}" HEAD)
fi
}
if [ "${1}" ]; then
${1}
fi
......@@ -2,8 +2,8 @@
PROJDIR="$(cd "$(dirname "${0}")/../" && pwd)"
if [ ! -d "${PROJDIR}/lib/qtlib" ]; then
git clone https://github.com/akiraohgaki/qtlib.git -b release-0.2.1 --single-branch --depth=1 "${PROJDIR}/lib/qtlib"
if [ ! -d "${PROJDIR}/lib/qtil" ]; then
git clone https://github.com/akiraohgaki/qtil.git -b release-0.4.0 --single-branch --depth=1 "${PROJDIR}/lib/qtil"
fi
if [ ! -d "${PROJDIR}/lib/AppImageUpdate" ]; then
......@@ -14,6 +14,6 @@ fi
if [ ! -d "${PROJDIR}/lib/AppImageUpdate-prebuilt" ]; then
mkdir "${PROJDIR}/lib/AppImageUpdate-prebuilt"
cd "${PROJDIR}/lib/AppImageUpdate-prebuilt"
cmake "${PROJDIR}/lib/AppImageUpdate" -DUSE_SYSTEM_CURL=ON -DBUILD_CPR_TESTS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo
make libappimageupdate
cmake "${PROJDIR}/lib/AppImageUpdate" -DBUILD_QT_UI=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo
make libappimageupdate_static
fi
DISTFILES += \
$${PWD}/build-docker.sh \
$${PWD}/build.sh \
$${PWD}/import.sh
$${PWD}/package \
$${PWD}/prepare