commit 4af0f09a4b4df28ceed9b87a6ef0e3f657f720f8 Author: chatlanin Date: Fri Nov 13 20:07:10 2026 +0300 base commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b2a562 --- /dev/null +++ b/.gitignore @@ -0,0 +1,97 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash +**/.qmlls.ini + +# qtcreator generated files +*.pro.user* +*.qbs.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + +# Directories with generated files +.moc/ +.obj/ +.pch/ +.rcc/ +.uic/ +/build*/ +/.qtcreator/ + +# Локальные кэши и файлы инструментов +/.cache/ +/compile_commands.json +/packaging/ +/*.md +/*.sh +.qmllint.json +.qmlls.ini +/imported* +!README.md +!**/README.md +/TMP diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..47daa50 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.16) + +project(archpack VERSION 0.1 LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(Qt6 REQUIRED COMPONENTS Quick) + +qt_standard_project_setup(REQUIRES 6.10) + +# Content of downloaded design from Figma to Qt or similar +if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/importedcontent/CMakeLists.txt") + add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/importedcontent) +endif() + +qt_add_executable(apparchpack + main.cpp +) + +qt_add_qml_module(apparchpack + URI archpack + QML_FILES + Main.qml +) + +# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. +# If you are developing for iOS or macOS you should consider setting an +# explicit, fixed bundle identifier manually though. +set_target_properties(apparchpack PROPERTIES +# MACOSX_BUNDLE_GUI_IDENTIFIER com.example.apparchpack + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + MACOSX_BUNDLE TRUE + WIN32_EXECUTABLE TRUE +) + +target_link_libraries(apparchpack + PRIVATE Qt6::Quick +) + +install(TARGETS apparchpack + BUNDLE DESTINATION . + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..eaa9950 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 chatlanin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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 OR COPYRIGHT HOLDERS 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. diff --git a/Main.qml b/Main.qml new file mode 100644 index 0000000..b7e3968 --- /dev/null +++ b/Main.qml @@ -0,0 +1,89 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls.Basic + + +ApplicationWindow { + id: window + width: 640 + height: 480 + minimumWidth: 200 + minimumHeight: 250 + visible: true + title: qsTr("Hello World") + property bool lightMode: Application.styleHints.colorScheme === Qt.Light + property color reallyDark: "#1f1f1f" + property color dark: "#262626" + property color reallyLight: "#e7e7e7" + property color light: "#e0e0e0" + + GridLayout { + id: grid + columns: width < 400 ? 1 : 2 + rowSpacing: 0 + columnSpacing: 0 + anchors.fill: parent + + Rectangle { + id: rectangle1 + color: window.lightMode ? window.reallyLight : window.reallyDark + Layout.fillHeight: true + Layout.fillWidth: true + + ColumnLayout { + anchors.fill: parent + Layout.alignment: Qt.AlignHCenter | Qt.AlignTop + + Label { + id: text1 + color: window.lightMode ? window.dark : window.light + font.pixelSize: 120 + fontSizeMode: Text.Fit + text: qsTr("Hello World") + Layout.fillWidth: true + Layout.fillHeight: true + Layout.margins: 16 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + } + } + + Rectangle { + id: rectangle2 + color: window.lightMode ? window.light : window.dark + Layout.fillHeight: true + Layout.fillWidth: true + + ColumnLayout { + anchors.fill: parent + Layout.alignment: Qt.AlignHCenter | Qt.AlignTop + + Button { + id: button1 + text: window.lightMode ? qsTr("\u263D Dark mode") + : qsTr("\u263C Light mode") + Layout.bottomMargin: 16 + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + + contentItem: Text { + text: button1.text + color: window.lightMode ? window.light : window.dark + font: button1.font + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + + background: Rectangle { + implicitWidth: 120 + implicitHeight: 36 + radius: 8 + color: window.lightMode ? window.dark : window.light + } + + onClicked: window.lightMode = !window.lightMode + } + } + } + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..55f5fc5 --- /dev/null +++ b/README.md @@ -0,0 +1,84 @@ +# archpack + +Графический менеджер пакетов и обновлений для Arch Linux: проверяет +обновления, обновляет систему через `pacman` или `yay`, ищет и ставит пакеты — +без терминала. + +Написан на C++ и Qt 6 Quick (QML, Qt Quick Controls Basic). + +## Возможности + +- **Проверка обновлений** — через `checkupdates` из `pacman-contrib`: список + пакетов с версиями «было → стало» и прогрессом скачивания и установки. +- **Обновление системы** — `pacman -Syu` или `yay -Syu`; способ выбирается в + меню (≡) в правом верхнем углу. +- **Поиск и установка** — `yay -Ss` / `pacman -Ss`, до 100 результатов; + установка выбранного пакета одной кнопкой. +- **Пароль sudo** — вводится в диалоге и не сохраняется: для `sudo -A` + создаётся временный askpass-скрипт в приватном каталоге (`0700`), который + удаляется после операции. +- **Тёмная тема** в цветах Catppuccin Mocha, интерфейс на русском. + +## Требования + +- Arch Linux (приложение рассчитано на pacman и на других дистрибутивах не + работает); +- Qt 6.10 или новее (в репозиториях Arch — Qt 6.12); +- `pacman-contrib` — для `checkupdates`; +- `sudo` — для обновления и установки; +- `yay` — необязательно: без него поиск и установка идут через `pacman`, но + AUR-пакеты недоступны. + +## Установка + +Из AUR: + +```bash +yay -S archpack +``` + +Запуск: `apparchpack` или «Archpack» в меню приложений. + +> Пакет ставит бинарник `apparchpack` — так называется target в +> `CMakeLists.txt`, хотя сам пакет называется `archpack`. + +## Сборка из исходников + +```bash +sudo pacman -S --needed base-devel cmake qt6-declarative pacman-contrib + +cmake -B build-release -S . -DCMAKE_BUILD_TYPE=Release +cmake --build build-release +./build-release/apparchpack +``` + +Проект открывается в Qt Creator как обычный CMake-проект. + +## Как это работает + +Приложение не работает с pacman API напрямую: оно запускает штатные утилиты +через `QProcess` и разбирает их вывод. + +| Действие | Команда | +|---|---| +| Проверка обновлений | `checkupdates` | +| Обновление через pacman | `sudo -A env LC_ALL=C COLUMNS=300 pacman -Syu --noconfirm` | +| Обновление через yay | `yay --noconfirm -Syu` | +| Поиск | `yay -Ss` или `pacman -Ss` | +| Установка | `yay -S <пакет>` или `pacman -S <пакет>` | + +Команды в таблице упрощены: в коде дополнительно выставляются `--answerclean`, +`--answerdiff`, `--answeredit` и `--answerupgrade` в `None` для yay, а также +переменные окружения `LC_ALL=C` и `COLUMNS=300` — чтобы разбирать стабильный +англоязычный вывод. Пароль передаётся только через временный `SUDO_ASKPASS`. + +## Ограничения + +- Только Arch Linux и производные с pacman. +- Вкладка «Удаление» пока заглушка — удаление пакетов не реализовано. +- Своей базы пакетов и проверки подписей нет: всё делает pacman. +- Интерфейс на русском, тёмная тема без переключателя. + +## Лицензия + +MIT — см. [LICENSE](LICENSE). diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..31588fb --- /dev/null +++ b/main.cpp @@ -0,0 +1,13 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + QObject::connect( &engine, &QQmlApplicationEngine::objectCreationFailed, &app, []() { QCoreApplication::exit(-1); }, Qt::QueuedConnection); + engine.loadFromModule("archpack", "Main"); + + return QGuiApplication::exec(); +}