completely moved on CPP #26
6
.gitignore
vendored
|
@ -1,6 +0,0 @@
|
||||||
venv
|
|
||||||
.idea
|
|
||||||
__pycache__
|
|
||||||
*.tar.*
|
|
||||||
parch-welcome-bin
|
|
||||||
.vscode
|
|
|
@ -4,7 +4,7 @@ Parch dorood (/do-rood/, درود, pronunciation) which is Persian word for "Gre
|
||||||
- Showing Parch Linux pages on social media
|
- Showing Parch Linux pages on social media
|
||||||
- Running the installer program
|
- Running the installer program
|
||||||
- Updating Parch repositories
|
- Updating Parch repositories
|
||||||
This program is still on alpha stages and it is not completely ready to use.
|
This program is still on beta stages and it is semi complete and ready to use.
|
||||||
|
|
||||||
## Build the package on Arch machines
|
## Build the package on Arch machines
|
||||||
|
|
||||||
|
@ -18,10 +18,3 @@ makepkg -f
|
||||||
cd build
|
cd build
|
||||||
sudo pacman -U ./parch-welcome*
|
sudo pacman -U ./parch-welcome*
|
||||||
```
|
```
|
||||||
|
|
||||||
## Generate Qt Resources (if edited)
|
|
||||||
if you made a changes in src you can update the `qrc` by running this command:
|
|
||||||
```shell
|
|
||||||
cd src
|
|
||||||
python QrcGenerate.py
|
|
||||||
```
|
|
|
@ -6,22 +6,19 @@ pkgdesc='Parch dorood (/do-rood/, درود, pronunciation) which is Persian word
|
||||||
url="https://github.com/parchlinux/${pkgname}"
|
url="https://github.com/parchlinux/${pkgname}"
|
||||||
license=('GPL')
|
license=('GPL')
|
||||||
makedepends=("git")
|
makedepends=("git")
|
||||||
depends=("qt6-base" "python" "python-pyqt6")
|
depends=("qt6-base" "qt6-declarative" "build-base")
|
||||||
conflicts=("${pkgname}")
|
conflicts=("${pkgname}")
|
||||||
provides=("${pkgname}")
|
provides=("${pkgname}")
|
||||||
source=("${pkgname}::git+${url}")
|
source=("${pkgname}::git+${url}")
|
||||||
#source=("${pkgname}.tar.gz")
|
#source=("${pkgname}.tar.gz")
|
||||||
md5sums=('SKIP')
|
md5sums=('SKIP')
|
||||||
build(){
|
build(){
|
||||||
_src="${srcdir}/${pkgname}/src"
|
_workdir="${srcdir}/${pkgname}/"
|
||||||
_ui="${_src}/UI"
|
mkdir ${_workdir}/bin
|
||||||
|
cd ${_workdir}/bin
|
||||||
rcc -g python "${_ui}/res.qrc" -o "${_src}/Res.py"
|
qmake6 ..
|
||||||
sed -i 's/PySide2/PyQt6/g' "${_src}/Res.py"
|
make -j$(nproc)
|
||||||
|
cp ./parch-welcome ../
|
||||||
_welcome="${_src}/../${pkgname}-bin"
|
|
||||||
echo "#!/usr/bin/python" > $_welcome && cat "${_src}/Res.py" >> $_welcome && cat "${_src}/Welcome.py" >> $_welcome
|
|
||||||
sed -i 's/import Res//g' $_welcome
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pkgver() {
|
pkgver() {
|
||||||
|
@ -43,7 +40,7 @@ package() {
|
||||||
install -Dm644 "${srcdir}/${pkgname}/resources/logo.png" "${pkgdir}/usr/share/icons/${pkgname}.png"
|
install -Dm644 "${srcdir}/${pkgname}/resources/logo.png" "${pkgdir}/usr/share/icons/${pkgname}.png"
|
||||||
|
|
||||||
# copy welcome binfile into /bin
|
# copy welcome binfile into /bin
|
||||||
install -Dm755 "${srcdir}/${pkgname}/${pkgname}-bin" "${pkgdir}/usr/bin/${pkgname}"
|
install -Dm755 "${srcdir}/${pkgname}/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
|
||||||
|
|
||||||
# copy autostart desktop file into autostart dir
|
# copy autostart desktop file into autostart dir
|
||||||
install -Dm644 "${srcdir}/${pkgname}/resources/autostart.desktop" "${pkgdir}/etc/xdg/autostart/${pkgname}.desktop"
|
install -Dm644 "${srcdir}/${pkgname}/resources/autostart.desktop" "${pkgdir}/etc/xdg/autostart/${pkgname}.desktop"
|
||||||
|
|
11
parch-welcome.pro
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
QT += core widgets gui qml quickcontrols2
|
||||||
|
|
||||||
|
CONFIG += release
|
||||||
|
TARGET = parch-welcome
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
SOURCES += src/main.cpp src/processhandler.cpp
|
||||||
|
|
||||||
|
HEADERS += src/processhandler.h
|
||||||
|
|
||||||
|
RESOURCES += src/assets/res.qrc
|
|
@ -1 +0,0 @@
|
||||||
PyQt6
|
|
|
@ -1,20 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
import os, subprocess
|
|
||||||
|
|
||||||
# Create Qrc file
|
|
||||||
listrc = os.listdir("UI")
|
|
||||||
listrc.remove("res.qrc")
|
|
||||||
f = open("UI/res.qrc", "w")
|
|
||||||
f.write("""<RCC><qresource prefix="/">""")
|
|
||||||
for i in listrc:
|
|
||||||
f.write(f"<file>{i}</file>")
|
|
||||||
f.write("""</qresource></RCC>""")
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
# Compile Qrc & Create onefile script & run it
|
|
||||||
subprocess.run(
|
|
||||||
"""rcc -g python UI/res.qrc -o Res.py && sed -i 's/PySide2/PyQt6/g' Res.py && echo "#!/usr/bin/python" > Welcome && cat Res.py >> Welcome && cat Welcome.py >> Welcome && chmod +x Welcome && sed -i 's/import Res//g' Welcome && mv Welcome ../build/parch-welcome/usr/bin""",
|
|
||||||
shell=True,
|
|
||||||
)
|
|
1208
src/Res.py
|
@ -1 +0,0 @@
|
||||||
<RCC><qresource prefix="/"><file>discord.svg</file><file>x-lg.svg</file><file>tele.svg</file><file>cafe.svg</file><file>book.svg</file><file>github.svg</file><file>masto.svg</file><file>ParchLinux.qml</file><file>tw.svg</file><file>install.svg</file><file>ParchLogo.svg</file><file>website.svg</file></qresource></RCC>
|
|
126
src/Welcome.py
|
@ -1,126 +0,0 @@
|
||||||
# Import I/O
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
|
|
||||||
# Import PyQt6 Framework libraries
|
|
||||||
from PyQt6.QtCore import *
|
|
||||||
from PyQt6.QtGui import *
|
|
||||||
from PyQt6.QtQml import *
|
|
||||||
|
|
||||||
# Import Resources of Qt
|
|
||||||
import Res
|
|
||||||
|
|
||||||
# Simple Qt Quick class for loading QML files
|
|
||||||
|
|
||||||
|
|
||||||
class Quick(QQmlApplicationEngine):
|
|
||||||
# DO: Set property of object
|
|
||||||
def setProperty(self, name, value):
|
|
||||||
self.rootObjects()[0].setProperty(name, value)
|
|
||||||
|
|
||||||
# DO: Get property of object
|
|
||||||
def property(self, name):
|
|
||||||
return self.rootObjects()[0].property(name)
|
|
||||||
|
|
||||||
# DO: find a object
|
|
||||||
def findChild(self, name, **kwargs):
|
|
||||||
return self.rootObjects()[0].findChild(QObject, name)
|
|
||||||
|
|
||||||
# DO: Close the loader
|
|
||||||
def close(self):
|
|
||||||
self.rootObjects()[0].close()
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
super(Quick, self).__init__()
|
|
||||||
|
|
||||||
|
|
||||||
# Main Class of Parch Welcome Project
|
|
||||||
class Main(Quick):
|
|
||||||
# DO: Button 1 loading link: https://github.com/parchlinux
|
|
||||||
def b1_(self):
|
|
||||||
self.link("https://github.com/parchlinux")
|
|
||||||
|
|
||||||
# DO: Button 2 loading link: https://twitter.com/bssfoss
|
|
||||||
def b2_(self):
|
|
||||||
self.link("https://twitter.com/bssfoss")
|
|
||||||
|
|
||||||
# DO: Button 3 loading link: https://t.me/parchlinux
|
|
||||||
def b3_(self):
|
|
||||||
self.link("https://t.me/parchlinux")
|
|
||||||
|
|
||||||
# DO: Button 4 loading link: https://discord.gg/9RW5cRByAM
|
|
||||||
def b4_(self):
|
|
||||||
self.link("https://discord.gg/9RW5cRByAM")
|
|
||||||
|
|
||||||
# DO: Button 5 loading link: https://mas.to/@bssfoss
|
|
||||||
def b5_(self):
|
|
||||||
self.link("https://mas.to/@bssfoss")
|
|
||||||
|
|
||||||
# DO: Button 6 loading link: https://coffeete.ir/parchlinux
|
|
||||||
def b6_(self):
|
|
||||||
self.link("https://coffeete.ir/parchlinux")
|
|
||||||
|
|
||||||
# DO: Button 7 loading link: https://parchlinux.ir
|
|
||||||
def b7_(self):
|
|
||||||
self.link("https://parchlinux.ir")
|
|
||||||
|
|
||||||
# DO: Button 8 loading link: https://parchlinux.ir/parchwiki/
|
|
||||||
def b8_(self):
|
|
||||||
self.link("https://parchlinux.ir/parchwiki/")
|
|
||||||
|
|
||||||
# DO: Run Calamares Installer
|
|
||||||
def install_(self):
|
|
||||||
self.close()
|
|
||||||
subprocess.Popen("sudo sh /etc/calamares/launch.sh", shell=True)
|
|
||||||
|
|
||||||
# DO: Loading link in `xdg-open` function
|
|
||||||
async def link(self, url):
|
|
||||||
self.close()
|
|
||||||
await subprocess.Popen(f"xdg-open {url}", shell=True)
|
|
||||||
|
|
||||||
# DO: Init Function
|
|
||||||
def __init__(self):
|
|
||||||
super(Main, self).__init__()
|
|
||||||
|
|
||||||
# Load Main QML file
|
|
||||||
self.load(":/ParchLinux.qml")
|
|
||||||
|
|
||||||
self.b1 = self.findChild("b1") # Find Button 1
|
|
||||||
self.b1.clicked.connect(self.b1_) # Action: Connect Button 1 action to b1_
|
|
||||||
|
|
||||||
self.b2 = self.findChild("b2") # Find Button 2
|
|
||||||
self.b2.clicked.connect(self.b2_) # Action: Connect Button 2 action to b2_
|
|
||||||
|
|
||||||
self.b3 = self.findChild("b3") # Find Button 3
|
|
||||||
self.b3.clicked.connect(self.b3_) # Action: Connect Button 3 action to b3_
|
|
||||||
|
|
||||||
self.b4 = self.findChild("b4") # Find Button 4
|
|
||||||
self.b4.clicked.connect(self.b4_) # Action: Connect Button 4 action to b4_
|
|
||||||
|
|
||||||
self.b5 = self.findChild("b5") # Find Button 5
|
|
||||||
self.b5.clicked.connect(self.b5_) # Action: Connect Button 5 action to b5_
|
|
||||||
|
|
||||||
self.b6 = self.findChild("b6") # Find Button 6
|
|
||||||
self.b6.clicked.connect(self.b6_) # Action: Connect Button 6 action to b6_
|
|
||||||
|
|
||||||
self.b7 = self.findChild("b7") # Find Button 7
|
|
||||||
self.b7.clicked.connect(self.b7_) # Action: Connect Button 7 action to b7_
|
|
||||||
|
|
||||||
self.b8 = self.findChild("b8") # Find Button 8
|
|
||||||
self.b8.clicked.connect(self.b8_) # Action: Connect Button 8 action to b8_
|
|
||||||
|
|
||||||
self.install = self.findChild("install") # Find Install Button
|
|
||||||
self.install.clicked.connect(
|
|
||||||
self.install_
|
|
||||||
) # Action: Connect to install_ function
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
# Start Qt Qui Application loop
|
|
||||||
app = QGuiApplication([])
|
|
||||||
# Set Qt Window Icon
|
|
||||||
app.setWindowIcon(QIcon(":/ParchLogo.svg"))
|
|
||||||
# Loading Main Class
|
|
||||||
m = Main()
|
|
||||||
# Set loop exec
|
|
||||||
app.exec()
|
|
|
@ -1,42 +1,34 @@
|
||||||
import QtQuick
|
import QtQuick 6.0
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls 6.0
|
||||||
import QtQuick.Controls.Material
|
import QtQuick.Controls.Material 6.0
|
||||||
|
import com.parch 1.0
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
width: 900
|
width: 900
|
||||||
height: 500
|
height: 500
|
||||||
// flags: Qt.FramelessWindowHint
|
flags: Qt.FramelessWindowHint
|
||||||
visible: true
|
visible: true
|
||||||
id: parch
|
id: parch
|
||||||
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
function link(url) {
|
||||||
|
Qt.openUrlExternally(url);
|
||||||
|
}
|
||||||
|
ProcessHandler {
|
||||||
|
id: processHandler
|
||||||
|
|
||||||
/* MouseArea {
|
onProcessFinished: {
|
||||||
anchors.fill: parent
|
// console.log("Process finished with exit code:", exitCode, "Exit status:", exitStatus);
|
||||||
drag{ target: parent; axis: Drag.XandYAxis}
|
parch.close()
|
||||||
|
|
||||||
onMouseXChanged: {
|
|
||||||
if(drag.active){
|
|
||||||
print(parent.x)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMouseYChanged: {
|
|
||||||
if(drag.active)
|
|
||||||
{
|
|
||||||
print(parent.y)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: 900
|
width: 900
|
||||||
height: 500
|
height: 500
|
||||||
// radius: 20
|
radius: 20
|
||||||
color: "#DD010409"
|
color: "#DD010409"
|
||||||
|
|
||||||
/* Row {
|
Row {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
|
||||||
|
@ -47,10 +39,8 @@ ApplicationWindow {
|
||||||
parch.close()
|
parch.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
Column {
|
Column {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
@ -80,7 +70,7 @@ ApplicationWindow {
|
||||||
Text {
|
Text {
|
||||||
text: "<strong><font color='#3b82f6'>Parch Linux</font></strong> is an open-source, Arch-based Linux distribution,"
|
text: "<strong><font color='#3b82f6'>Parch Linux</font></strong> is an open-source, Arch-based Linux distribution,"
|
||||||
color: "white"
|
color: "white"
|
||||||
verticalAlignment: Text.AlignCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
font.family: "Ubuntu Light"
|
font.family: "Ubuntu Light"
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
@ -88,7 +78,7 @@ ApplicationWindow {
|
||||||
Text {
|
Text {
|
||||||
color: "white"
|
color: "white"
|
||||||
text: "that tried to be pretty, easy to use, light, fast and stable."
|
text: "that tried to be pretty, easy to use, light, fast and stable."
|
||||||
verticalAlignment: Text.AlignCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
font.family: "Ubuntu Light"
|
font.family: "Ubuntu Light"
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
@ -104,41 +94,66 @@ ApplicationWindow {
|
||||||
icon.color: "white"
|
icon.color: "white"
|
||||||
icon.source: "github.svg"
|
icon.source: "github.svg"
|
||||||
objectName: "b1"
|
objectName: "b1"
|
||||||
|
onClicked: {
|
||||||
|
link("https://github.com/parchlinux")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ToolButton {
|
ToolButton {
|
||||||
icon.color: "white"
|
icon.color: "white"
|
||||||
icon.source: "tw.svg"
|
icon.source: "tw.svg"
|
||||||
objectName: "b2"
|
objectName: "b2"
|
||||||
|
onClicked: {
|
||||||
|
link("https://twitter.com/bssfoss")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ToolButton {
|
ToolButton {
|
||||||
icon.color: "white"
|
icon.color: "white"
|
||||||
icon.source: "tele.svg"
|
icon.source: "tele.svg"
|
||||||
objectName: "b3"
|
objectName: "b3"
|
||||||
|
onClicked: {
|
||||||
|
link("https://t.me/parchlinux")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ToolButton {
|
ToolButton {
|
||||||
icon.color: "white"
|
icon.color: "white"
|
||||||
icon.source: "discord.svg"
|
icon.source: "discord.svg"
|
||||||
objectName: "b4"
|
objectName: "b4"
|
||||||
|
onClicked: {
|
||||||
|
link("https://discord.gg/9RW5cRByAM")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ToolButton {
|
ToolButton {
|
||||||
icon.color: "white"
|
icon.color: "white"
|
||||||
icon.source: "masto.svg"
|
icon.source: "masto.svg"
|
||||||
objectName: "b5"
|
objectName: "b5"
|
||||||
|
onClicked: {
|
||||||
|
link("https://mas.to/@bssfoss")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ToolButton {
|
ToolButton {
|
||||||
icon.color: "white"
|
icon.color: "white"
|
||||||
icon.source: "cafe.svg"
|
icon.source: "cafe.svg"
|
||||||
objectName: "b6"
|
objectName: "b6"
|
||||||
|
// Replace with Daramet platform due to Coffeete platform is unavailable
|
||||||
|
onClicked: {
|
||||||
|
link("https://daramet.com/parchlinux")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ToolButton {
|
ToolButton {
|
||||||
icon.color: "white"
|
icon.color: "white"
|
||||||
icon.source: "website.svg"
|
icon.source: "website.svg"
|
||||||
objectName: "b7"
|
objectName: "b7"
|
||||||
|
onClicked: {
|
||||||
|
link("https://parchlinux.ir")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ToolButton {
|
ToolButton {
|
||||||
icon.color: "white"
|
icon.color: "white"
|
||||||
icon.source: "book.svg"
|
icon.source: "book.svg"
|
||||||
objectName: "b8"
|
objectName: "b8"
|
||||||
|
onClicked: {
|
||||||
|
link("https://parchlinux.ir/parchwiki/")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -152,10 +167,14 @@ ApplicationWindow {
|
||||||
height: 40
|
height: 40
|
||||||
radius: 15
|
radius: 15
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
ToolButton {
|
ToolButton {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
objectName: "install"
|
objectName: "install"
|
||||||
|
id: installBtn
|
||||||
|
onClicked: {
|
||||||
|
// Start the process through the ProcessHandler object
|
||||||
|
processHandler.startProcess();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
@ -174,6 +193,7 @@ ApplicationWindow {
|
||||||
text: "Install Parch"
|
text: "Install Parch"
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
id: installBtnText
|
||||||
}
|
}
|
||||||
ToolButton {
|
ToolButton {
|
||||||
width: 40
|
width: 40
|
||||||
|
@ -181,6 +201,10 @@ ApplicationWindow {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
icon.color: "white"
|
icon.color: "white"
|
||||||
icon.source: "install.svg"
|
icon.source: "install.svg"
|
||||||
|
onClicked: {
|
||||||
|
// Start the process through the ProcessHandler object
|
||||||
|
processHandler.startProcess();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 783 B After Width: | Height: | Size: 783 B |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 736 B After Width: | Height: | Size: 736 B |
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 311 B |
Before Width: | Height: | Size: 1,000 B After Width: | Height: | Size: 1,000 B |
16
src/assets/res.qrc
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>discord.svg</file>
|
||||||
|
<file>x-lg.svg</file>
|
||||||
|
<file>tele.svg</file>
|
||||||
|
<file>cafe.svg</file>
|
||||||
|
<file>book.svg</file>
|
||||||
|
<file>github.svg</file>
|
||||||
|
<file>masto.svg</file>
|
||||||
|
<file>ParchLinux.qml</file>
|
||||||
|
<file>tw.svg</file>
|
||||||
|
<file>install.svg</file>
|
||||||
|
<file>ParchLogo.svg</file>
|
||||||
|
<file>website.svg</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
Before Width: | Height: | Size: 793 B After Width: | Height: | Size: 793 B |
Before Width: | Height: | Size: 659 B After Width: | Height: | Size: 659 B |
Before Width: | Height: | Size: 724 B After Width: | Height: | Size: 724 B |
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 320 B |
30
src/main.cpp
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QQmlApplicationEngine>
|
||||||
|
#include <QResource>
|
||||||
|
#include <QQmlContext>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QQuickItem>
|
||||||
|
#include <QQuickView>
|
||||||
|
#include <QProcess>
|
||||||
|
#include "processhandler.h" // Include the ProcessHandler class header
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
|
QQmlApplicationEngine engine;
|
||||||
|
|
||||||
|
// Register the ProcessHandler class with the QML engine
|
||||||
|
qmlRegisterType<ProcessHandler>("com.parch", 1, 0, "ProcessHandler");
|
||||||
|
|
||||||
|
// Load the QML content from the resource
|
||||||
|
QResource::registerResource(":/resources.rcc");
|
||||||
|
|
||||||
|
// Load the QML file
|
||||||
|
engine.load(QUrl("qrc:/ParchLinux.qml"));
|
||||||
|
|
||||||
|
// Set App Icon
|
||||||
|
app.setWindowIcon(QIcon("icon.png"));
|
||||||
|
|
||||||
|
return app.exec();
|
||||||
|
}
|
14
src/processhandler.cpp
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#include "processhandler.h"
|
||||||
|
|
||||||
|
ProcessHandler::ProcessHandler(QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
connect(&m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||||
|
this, &ProcessHandler::processFinished);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProcessHandler::startProcess()
|
||||||
|
{
|
||||||
|
m_process.start("sudo", QStringList() << "sh" << "/etc/calamares/launch.sh");
|
||||||
|
m_process.waitForFinished();
|
||||||
|
emit processFinished(m_process.exitCode(), m_process.exitStatus());
|
||||||
|
}
|
23
src/processhandler.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef PROCESSHANDLER_H
|
||||||
|
#define PROCESSHANDLER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QProcess>
|
||||||
|
class ProcessHandler : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ProcessHandler(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void startProcess();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QProcess m_process;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PROCESSHANDLER_H
|