add base updatemanager
This commit is contained in:
@@ -37,9 +37,12 @@ qt_add_qml_module(apparchpack
|
||||
SOURCES
|
||||
cpp/utils/utils.hpp
|
||||
cpp/utils/utils.cpp
|
||||
cpp/updatemanager/updatemanager.hpp
|
||||
cpp/updatemanager/updatemanager.cpp
|
||||
)
|
||||
|
||||
target_include_directories(apparchpack PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/cpp/utils)
|
||||
target_include_directories(apparchpack PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/cpp/updatemanager)
|
||||
|
||||
target_link_libraries(apparchpack PRIVATE Qt6::Quick)
|
||||
|
||||
|
||||
13
Main.qml
13
Main.qml
@@ -25,6 +25,7 @@ ApplicationWindow {
|
||||
id: mainLayout
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.baseMargins
|
||||
anchors.bottomMargin: Theme.baseMargins + consoleBar.height
|
||||
spacing: Theme.baseSpacing
|
||||
|
||||
RowLayout {
|
||||
@@ -68,11 +69,6 @@ ApplicationWindow {
|
||||
id: pgDelete
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: plug
|
||||
implicitHeight: 20
|
||||
}
|
||||
}
|
||||
|
||||
readonly property string consoleTitle: tabs.currentIndex === 0 ? "Консоль обновления" : tabs.currentIndex === 1 ? "Консоль установки" : "Консоль удаления"
|
||||
@@ -83,6 +79,11 @@ ApplicationWindow {
|
||||
// ? (UpdateManager.isInstalling ? "установка..." : "")
|
||||
// : (UpdateManager.isRemoving ? "удаление..." : "")
|
||||
|
||||
readonly property var consoleLog: ""
|
||||
// readonly property var consoleLog: tabs.currentIndex === 0 ? UpdateManager.updateLog
|
||||
// : tabs.currentIndex === 1 ? UpdateManager.installLog
|
||||
// : UpdateManager.removalLog
|
||||
|
||||
Components.ConsoleBar {
|
||||
id: consoleBar
|
||||
title: root.consoleTitle
|
||||
@@ -96,5 +97,7 @@ ApplicationWindow {
|
||||
anchors.bottom: consoleBar.top
|
||||
consoleOpen: root.consoleOpen
|
||||
status: root.consoleStatus
|
||||
title: root.consoleTitle
|
||||
consoleLogData: root.consoleLogData
|
||||
}
|
||||
}
|
||||
|
||||
16
cpp/updatemanager/updatemanager.cpp
Normal file
16
cpp/updatemanager/updatemanager.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "updatemanager.hpp"
|
||||
|
||||
UpdateManager::UpdateManager(QObject* parent) : QObject{parent}
|
||||
{
|
||||
}
|
||||
|
||||
bool UpdateManager::isChecking() const
|
||||
{
|
||||
return m_isChecking;
|
||||
}
|
||||
|
||||
int UpdateManager::packageCount() const
|
||||
{
|
||||
int count = 0;
|
||||
return count;
|
||||
}
|
||||
39
cpp/updatemanager/updatemanager.hpp
Normal file
39
cpp/updatemanager/updatemanager.hpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QQmlEngine>
|
||||
#include <QStringList>
|
||||
#include <QTemporaryDir>
|
||||
#include <QTimer>
|
||||
#include <QVariantList>
|
||||
|
||||
class UpdateManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_SINGLETON
|
||||
|
||||
Q_PROPERTY(bool isChecking READ isChecking NOTIFY isCheckingChanged)
|
||||
Q_PROPERTY(int packageCount READ packageCount NOTIFY packageCountChanged)
|
||||
|
||||
public:
|
||||
explicit UpdateManager(QObject* parent = nullptr);
|
||||
|
||||
public:
|
||||
bool isChecking() const;
|
||||
int packageCount() const;
|
||||
|
||||
signals:
|
||||
void isCheckingChanged();
|
||||
void packageCountChanged();
|
||||
|
||||
private:
|
||||
QProcess m_process;
|
||||
|
||||
private:
|
||||
bool m_isChecking = false;
|
||||
bool m_isUpdating = false;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import "../components" as Components
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
@@ -14,6 +16,7 @@ Rectangle {
|
||||
|
||||
property string title: ""
|
||||
property string status: ""
|
||||
property var consoleLogData: ""
|
||||
property int consoleHeight: 320
|
||||
property bool consoleOpen: false
|
||||
|
||||
@@ -66,6 +69,37 @@ Rectangle {
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
// ListView {
|
||||
// id: logView
|
||||
// clip: true
|
||||
// spacing: 2
|
||||
// model: root.consoleLogData
|
||||
// onModelChanged: positionViewAtEnd()
|
||||
// onCountChanged: positionViewAtEnd()
|
||||
//
|
||||
// ScrollBar.vertical: ScrollBar {
|
||||
// policy: ScrollBar.AsNeeded
|
||||
// width: 6
|
||||
// }
|
||||
//
|
||||
// delegate: Text {
|
||||
// width: logView.width
|
||||
// text: modelData
|
||||
// color: "#a6adc8"
|
||||
// font.family: "monospace"
|
||||
// font.pixelSize: 11
|
||||
// wrapMode: Text.WrapAnywhere
|
||||
// }
|
||||
// }
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "Логи отсутствуют"
|
||||
color: "#585b70"
|
||||
font.pixelSize: 12
|
||||
visible: root.consoleLogData.length === 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user