From 49ec5452223823f3027e99a1a1c4531bcd78fefc Mon Sep 17 00:00:00 2001 From: Aaron Rainbolt Date: Thu, 25 Jan 2024 21:17:29 -0600 Subject: [PATCH] Tons more improvements --- .gitignore | 1 + CMakeLists.txt | 77 +++++----- README.md | 32 +++- gen_ts.sh | 11 ++ aptmanager.cpp => src/aptmanager.cpp | 38 ++++- aptmanager.h => src/aptmanager.h | 5 +- .../conffilehandlerdialog.cpp | 0 .../conffilehandlerdialog.h | 0 .../conffilehandlerdialog.ui | 0 conffilewidget.cpp => src/conffilewidget.cpp | 2 - conffilewidget.h => src/conffilewidget.h | 0 conffilewidget.ui => src/conffilewidget.ui | 0 .../diffdisplaydialog.cpp | 0 .../diffdisplaydialog.h | 0 .../diffdisplaydialog.ui | 0 ipcfilewatcher.cpp => src/ipcfilewatcher.cpp | 0 ipcfilewatcher.h => src/ipcfilewatcher.h | 0 .../lubuntu-update-backend | 4 +- main.cpp => src/main.cpp | 2 +- mainwindow.cpp => src/mainwindow.cpp | 44 ++++-- mainwindow.h => src/mainwindow.h | 3 + mainwindow.ui => src/mainwindow.ui | 4 +- orchestrator.cpp => src/orchestrator.cpp | 9 +- orchestrator.h => src/orchestrator.h | 1 + {res => src/res}/images/update.svg | 0 resources.qrc => src/resources.qrc | 0 src/translations.qrc | 7 + src/translations/lubuntu-update_en_US.ts | 143 ++++++++++++++++++ src/translations/lubuntu-update_es_ES.ts | 143 ++++++++++++++++++ src/translations/lubuntu-update_zh_CN.ts | 143 ++++++++++++++++++ translations/lubuntu-update_en_US.ts | 3 - 31 files changed, 605 insertions(+), 67 deletions(-) create mode 100644 .gitignore create mode 100755 gen_ts.sh rename aptmanager.cpp => src/aptmanager.cpp (90%) rename aptmanager.h => src/aptmanager.h (89%) rename conffilehandlerdialog.cpp => src/conffilehandlerdialog.cpp (100%) rename conffilehandlerdialog.h => src/conffilehandlerdialog.h (100%) rename conffilehandlerdialog.ui => src/conffilehandlerdialog.ui (100%) rename conffilewidget.cpp => src/conffilewidget.cpp (98%) rename conffilewidget.h => src/conffilewidget.h (100%) rename conffilewidget.ui => src/conffilewidget.ui (100%) rename diffdisplaydialog.cpp => src/diffdisplaydialog.cpp (100%) rename diffdisplaydialog.h => src/diffdisplaydialog.h (100%) rename diffdisplaydialog.ui => src/diffdisplaydialog.ui (100%) rename ipcfilewatcher.cpp => src/ipcfilewatcher.cpp (100%) rename ipcfilewatcher.h => src/ipcfilewatcher.h (100%) rename lubuntu-update-backend => src/lubuntu-update-backend (94%) rename main.cpp => src/main.cpp (97%) rename mainwindow.cpp => src/mainwindow.cpp (71%) rename mainwindow.h => src/mainwindow.h (89%) rename mainwindow.ui => src/mainwindow.ui (96%) rename orchestrator.cpp => src/orchestrator.cpp (88%) rename orchestrator.h => src/orchestrator.h (93%) rename {res => src/res}/images/update.svg (100%) rename resources.qrc => src/resources.qrc (100%) create mode 100644 src/translations.qrc create mode 100644 src/translations/lubuntu-update_en_US.ts create mode 100644 src/translations/lubuntu-update_es_ES.ts create mode 100644 src/translations/lubuntu-update_zh_CN.ts delete mode 100644 translations/lubuntu-update_en_US.ts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..01e00f3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +CMakeLists.txt.user diff --git a/CMakeLists.txt b/CMakeLists.txt index 54c5f2f..82ba282 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,47 +12,50 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets LinguistTools) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools) -set(TS_FILES translations/lubuntu-update_en_US.ts) +set(TS_FILES + src/translations/lubuntu-update_en_US.ts + src/translations/lubuntu-update_es_ES.ts + src/translations/lubuntu-update_zh_CN.ts +) set(PROJECT_SOURCES - main.cpp - mainwindow.cpp - mainwindow.h - mainwindow.ui - orchestrator.h - orchestrator.cpp - aptmanager.h - aptmanager.cpp - conffilewidget.h - conffilewidget.cpp - conffilewidget.ui - diffdisplaydialog.h - diffdisplaydialog.cpp - diffdisplaydialog.ui - conffilehandlerdialog.h - conffilehandlerdialog.cpp - conffilehandlerdialog.ui - ipcfilewatcher.h - ipcfilewatcher.cpp + src/main.cpp + src/mainwindow.cpp + src/mainwindow.h + src/mainwindow.ui + src/orchestrator.h + src/orchestrator.cpp + src/aptmanager.h + src/aptmanager.cpp + src/conffilewidget.h + src/conffilewidget.cpp + src/conffilewidget.ui + src/diffdisplaydialog.h + src/diffdisplaydialog.cpp + src/diffdisplaydialog.ui + src/conffilehandlerdialog.h + src/conffilehandlerdialog.cpp + src/conffilehandlerdialog.ui + src/ipcfilewatcher.h + src/ipcfilewatcher.cpp ${TS_FILES} ) -if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) - qt_add_executable(lubuntu-update - MANUAL_FINALIZATION - ${PROJECT_SOURCES} - resources.qrc - ) +set(TRANSLATION_RESOURCES "src/translations.qrc") + +configure_file(${TRANSLATION_RESOURCES} translations.qrc COPYONLY) +qt5_add_translation(QM_FILES ${TS_FILES}) +qt5_add_resources(QM_RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc) - qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) -else() - add_executable(lubuntu-update - ${PROJECT_SOURCES} - resources.qrc - ) +add_custom_target(translations ALL DEPENDS ${QM_FILES}) + +add_executable(lubuntu-update + ${PROJECT_SOURCES} + ${QM_RESOURCES} + src/resources.qrc +) - qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) -endif() +add_dependencies(lubuntu-update translations) target_link_libraries(lubuntu-update PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) @@ -70,8 +73,6 @@ install(TARGETS lubuntu-update # has gotten into /usr/libexec you're compromised anyway, so not much to worry # about. Therefore we always, *always* install this script into /usr/libexec/, # no matter where the rest of the program goes. -install(FILES lubuntu-update-backend DESTINATION /usr/libexec/) +install(FILES src/lubuntu-update-backend DESTINATION /usr/libexec/) -if(QT_VERSION_MAJOR EQUAL 6) - qt_finalize_executable(lubuntu-update) -endif() +install(FILES lubuntu-update.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications/) diff --git a/README.md b/README.md index f3b8ead..9585b01 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,32 @@ Qt Creator is recommended for editing the code. It is present in Ubuntu's offici ## Missing features -* The Details button is hidden and does nothing. Eventually it should display a list of packages, the old version of them, the new version of them, and a link to their Launchpad page. +* Double-clicking on a package doesn't show detailed information for it yet. * There's no support for release upgrading. This is currently unnecessary as this updater is only going to be shipped in Noble and later, but it will become a big deal in the (potentially near) future. -* There's no support for doing an `apt update` for checking for recent updates. This seems rather important *now*. -* Most of the internal strings aren't translatable... -* ...and the bit of translation support there is, is totally untested and quite possibly not functioning properly. Borrow from what we did with lubuntu-installer-prompt to fix this. +* The translation support is mostly untested, though it should work. + +## Translations + +Run the `gen_ts.sh` script after making any code modifications to ensure that the translations files are up-to-date for translators to work on. + +To add a new language to be translated: + +* Open the `gen_ts.sh` script and add the locale code for the new language to the `langList` array. +* Run the script after doing this - a new template .ts file will be generated under `src/translations/`. +* Next, add the new template file to the `TS_FILES` list in `CMakeLists.txt` - it will be named `src/translations/lubuntu-update_locale_CODE.ts`, where `locale_CODE` is the locale code of the added language. +* Finally, add a line in the src/translations.qrc resource file to include the new translation file. The line should look like `lubuntu-update_locale_CODE.qm`, where `locale_CODE` is the locale code of the added language. This line should go inside the `` tag. + +For instance, if I were to add Chinese to the list of languages that could be translated into, I would do this: + + vim gen_ts.sh + # add this code to the langList array: + # 'zh_CN' + ./gen_ts.sh + vim CMakeLists.txt + # add this line to the TS_FILES list: + # src/translations/lubuntu-update_zh_CN.ts + vim src/translations.qrc + # add this line to the list of file resources: + # lubuntu-update_zh_CN.qm + +The program will now pick up the added language at build time. Any translations added to the newly created .ts file will be shown to program users who select the new language. diff --git a/gen_ts.sh b/gen_ts.sh new file mode 100755 index 0000000..f6d8d36 --- /dev/null +++ b/gen_ts.sh @@ -0,0 +1,11 @@ +#!/bin/bash +langList=('en_US' 'es_ES' 'zh_CN') +for i in ${langList[@]}; do + targetFile="translations/lubuntu-update_$i.ts" + if [ ! -e $targetFile ]; then + echo "" > $targetFile + echo "" >> $targetFile + echo "" >> $targetFile + fi +done +lupdate *.cpp *.h *.ui -ts translations/* diff --git a/aptmanager.cpp b/src/aptmanager.cpp similarity index 90% rename from aptmanager.cpp rename to src/aptmanager.cpp index 505dd98..5c2d9de 100644 --- a/aptmanager.cpp +++ b/src/aptmanager.cpp @@ -30,8 +30,19 @@ void AptManager::applyFullUpgrade() // Note that the lubuntu-update-backend script sets LC_ALL=C in it already, so we don't need to add that here. aptProcess->setArguments(QStringList() << "/usr/libexec/lubuntu-update-backend" << "doupdate"); aptProcess->setProcessChannelMode(QProcess::MergedChannels); - QObject::connect(aptProcess, &QProcess::readyRead, this, &AptManager::handleProcessBuffer); - QObject::connect(aptProcess, QOverload::of(&QProcess::finished), this, &AptManager::handleProcessBuffer); + QObject::connect(aptProcess, &QProcess::readyRead, this, &AptManager::handleUpdateProcessBuffer); + QObject::connect(aptProcess, QOverload::of(&QProcess::finished), this, &AptManager::handleUpdateProcessBuffer); + aptProcess->start(); +} + +void AptManager::checkForUpdates() +{ + aptProcess = new QProcess(); + aptProcess->setProgram("/usr/bin/lxqt-sudo"); + aptProcess->setArguments(QStringList() << "/usr/libexec/lubuntu-update-backend" << "checkupdate"); + aptProcess->setProcessChannelMode(QProcess::MergedChannels); + QObject::connect(aptProcess, &QProcess::readyRead, this, &AptManager::handleCheckUpdateProcessBuffer); + QObject::connect(aptProcess, QOverload::of(&QProcess::finished), this, &AptManager::handleCheckUpdateProcessBuffer); aptProcess->start(); } @@ -56,7 +67,7 @@ void AptManager::doneWithConffiles() aptProcess->closeWriteChannel(); } -void AptManager::handleProcessBuffer() +void AptManager::handleUpdateProcessBuffer() { int maxWaitTime = 20; while (!aptProcess->canReadLine() && maxWaitTime > 0) { @@ -149,6 +160,27 @@ void AptManager::handleProcessBuffer() } } +void AptManager::handleCheckUpdateProcessBuffer() +{ + /* + * We don't have the busy wait here because the apt output when doing + * `apt-get update` is somewhat ill-formed and difficult to fix, and + * busy-waiting was resulting in *awful* progress bar choppiness. + */ + + char lineBuf[2048]; + while(aptProcess->canReadLine()) { + aptProcess->readLine(lineBuf, 2048); + QString line = QString(lineBuf); + emit logLineReady(line); + } + + if (aptProcess->state() == QProcess::NotRunning) { + emit checkUpdatesComplete(); + aptProcess->deleteLater(); + } +} + QList AptManager::getUpdateInfo() { /* diff --git a/aptmanager.h b/src/aptmanager.h similarity index 89% rename from aptmanager.h rename to src/aptmanager.h index 19d16cb..49e0062 100644 --- a/aptmanager.h +++ b/src/aptmanager.h @@ -17,18 +17,21 @@ public: AptManager(QObject *parent = nullptr); static QList getUpdateInfo(); void applyFullUpgrade(); + void checkForUpdates(); void keepConffile(QString conffile); void replaceConffile(QString conffile); void doneWithConffiles(); signals: void updateComplete(); + void checkUpdatesComplete(); void progressUpdated(int progress); void logLineReady(QString logLine); void conffileListReady(QStringList conffileList); private slots: - void handleProcessBuffer(); + void handleUpdateProcessBuffer(); + void handleCheckUpdateProcessBuffer(); private: static void parseAptLine(QString line, bool *gettingInstallPackages, bool *gettingUpgradePackages, bool *gettingUninstallPackages, bool *gettingHeldPackages, bool *gettingPackageList); diff --git a/conffilehandlerdialog.cpp b/src/conffilehandlerdialog.cpp similarity index 100% rename from conffilehandlerdialog.cpp rename to src/conffilehandlerdialog.cpp diff --git a/conffilehandlerdialog.h b/src/conffilehandlerdialog.h similarity index 100% rename from conffilehandlerdialog.h rename to src/conffilehandlerdialog.h diff --git a/conffilehandlerdialog.ui b/src/conffilehandlerdialog.ui similarity index 100% rename from conffilehandlerdialog.ui rename to src/conffilehandlerdialog.ui diff --git a/conffilewidget.cpp b/src/conffilewidget.cpp similarity index 98% rename from conffilewidget.cpp rename to src/conffilewidget.cpp index c716a07..d0ed56a 100644 --- a/conffilewidget.cpp +++ b/src/conffilewidget.cpp @@ -4,8 +4,6 @@ #include -#include - ConffileWidget::ConffileWidget(QString filename, QWidget *parent) : QWidget(parent), ui(new Ui::ConffileWidget) diff --git a/conffilewidget.h b/src/conffilewidget.h similarity index 100% rename from conffilewidget.h rename to src/conffilewidget.h diff --git a/conffilewidget.ui b/src/conffilewidget.ui similarity index 100% rename from conffilewidget.ui rename to src/conffilewidget.ui diff --git a/diffdisplaydialog.cpp b/src/diffdisplaydialog.cpp similarity index 100% rename from diffdisplaydialog.cpp rename to src/diffdisplaydialog.cpp diff --git a/diffdisplaydialog.h b/src/diffdisplaydialog.h similarity index 100% rename from diffdisplaydialog.h rename to src/diffdisplaydialog.h diff --git a/diffdisplaydialog.ui b/src/diffdisplaydialog.ui similarity index 100% rename from diffdisplaydialog.ui rename to src/diffdisplaydialog.ui diff --git a/ipcfilewatcher.cpp b/src/ipcfilewatcher.cpp similarity index 100% rename from ipcfilewatcher.cpp rename to src/ipcfilewatcher.cpp diff --git a/ipcfilewatcher.h b/src/ipcfilewatcher.h similarity index 100% rename from ipcfilewatcher.h rename to src/ipcfilewatcher.h diff --git a/lubuntu-update-backend b/src/lubuntu-update-backend similarity index 94% rename from lubuntu-update-backend rename to src/lubuntu-update-backend index 1768a30..da4af65 100755 --- a/lubuntu-update-backend +++ b/src/lubuntu-update-backend @@ -8,7 +8,7 @@ if [ "$1" = 'pkgver' ]; then shift while [ "$1" != '' ]; do source="$(apt-cache show "$1" | grep 'Source:' | cut -d' ' -f2)" - version="$(apt-cache show lubuntu-default-settings | grep Version: | head -n1 | cut -d' ' -f2)" + version="$(apt-cache show "$1" | grep Version: | head -n1 | cut -d' ' -f2)" if [ "$source" = '' ]; then echo "$1" else @@ -17,6 +17,8 @@ if [ "$1" = 'pkgver' ]; then echo "$version" shift done +elif [ "$1" = 'checkupdate' ]; then + apt-get -o Apt::Color='0' -o Dpkg::Use-Pty='0' update elif [ "$1" = 'doupdate' ]; then # Prepare to be able to grep through the logs rm /run/lubuntu-update-apt-log || true diff --git a/main.cpp b/src/main.cpp similarity index 97% rename from main.cpp rename to src/main.cpp index 0d7ab0e..0eb42e1 100644 --- a/main.cpp +++ b/src/main.cpp @@ -16,7 +16,7 @@ int main(int argc, char *argv[]) QTranslator translator; const QStringList uiLanguages = QLocale::system().uiLanguages(); for (const QString &locale : uiLanguages) { - const QString baseName = "lubuntu-update_" + QLocale(locale).name(); + const QString baseName = QLocale(locale).name(); if (translator.load(":/i18n/" + baseName)) { a.installTranslator(&translator); break; diff --git a/mainwindow.cpp b/src/mainwindow.cpp similarity index 71% rename from mainwindow.cpp rename to src/mainwindow.cpp index b4a27b0..99168eb 100644 --- a/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -17,12 +17,11 @@ MainWindow::MainWindow(QWidget *parent) ui->progressBar->setVisible(false); ui->logView->setVisible(false); - // FIXME: Implement the Details screen and attach this button to it rather than disabling it. - ui->detailsButton->setVisible(false); - connect(ui->installButton, &QPushButton::clicked, this, &MainWindow::onInstallButtonClicked); + connect(ui->checkUpdatesButton, &QPushButton::clicked, this, &MainWindow::onCheckUpdatesButtonClicked); connect(ui->closeButton, &QPushButton::clicked, this, &MainWindow::onCloseButtonClicked); connect(aptManager, &AptManager::updateComplete, this, &MainWindow::onUpdateCompleted); + connect(aptManager, &AptManager::checkUpdatesComplete, this, &MainWindow::onCheckUpdatesCompleted); connect(aptManager, &AptManager::progressUpdated, this, &MainWindow::onProgressUpdate); connect(aptManager, &AptManager::logLineReady, this, &MainWindow::onLogLineReady); connect(aptManager, &AptManager::conffileListReady, this, &MainWindow::onConffileListReady); @@ -39,9 +38,9 @@ void MainWindow::setUpdateInfo(QList updateInfo) // The progress bar and log view are shown after the user chooses to begin installing updates ui->progressBar->setVisible(false); ui->logView->setVisible(false); - ui->detailsButton->setEnabled(true); ui->closeButton->setEnabled(true); ui->installButton->setEnabled(false); // Correct, it starts out false, we turn it to true if there are any updates. + ui->checkUpdatesButton->setEnabled(true); for (int i = 0;i < 4;i++) { if (updateInfo[i].count() > 0) { @@ -51,16 +50,16 @@ void MainWindow::setUpdateInfo(QList updateInfo) QTreeWidgetItem *installItem; switch (i) { case 0: - installItem = new QTreeWidgetItem(QStringList() << "To be installed"); + installItem = new QTreeWidgetItem(QStringList() << tr("To be installed")); break; case 1: - installItem = new QTreeWidgetItem(QStringList() << "To be upgraded"); + installItem = new QTreeWidgetItem(QStringList() << tr("To be upgraded")); break; case 2: - installItem = new QTreeWidgetItem(QStringList() << "To be removed"); + installItem = new QTreeWidgetItem(QStringList() << tr("To be removed")); break; case 3: - installItem = new QTreeWidgetItem(QStringList() << "Held back (usually temporarily)"); + installItem = new QTreeWidgetItem(QStringList() << tr("Held back (usually temporarily)")); break; } @@ -71,7 +70,7 @@ void MainWindow::setUpdateInfo(QList updateInfo) ui->packageView->addTopLevelItem(installItem); } - ui->statLabel->setText(QString("%1 package(s) will be updated. %2 of these updates are security-related.") + ui->statLabel->setText(tr("%1 package(s) will be updated. %2 of these updates are security-related.") .arg(QString::number(updateInfo[0].count() + updateInfo[1].count() + updateInfo[2].count()), QString::number(updateInfo[4].count()))); } @@ -102,14 +101,30 @@ void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::onInstallButtonClicked() { + ui->logView->clear(); ui->progressBar->setVisible(true); ui->logView->setVisible(true); ui->installButton->setEnabled(false); - ui->detailsButton->setEnabled(false); + ui->checkUpdatesButton->setEnabled(false); ui->closeButton->setEnabled(false); + ui->progressBar->setMinimum(0); + ui->progressBar->setMaximum(100); aptManager->applyFullUpgrade(); } +void MainWindow::onCheckUpdatesButtonClicked() +{ + ui->logView->clear(); + ui->progressBar->setVisible(true); + ui->logView->setVisible(true); + ui->installButton->setEnabled(false); + ui->checkUpdatesButton->setEnabled(false); + ui->closeButton->setEnabled(false); + ui->progressBar->setMinimum(0); + ui->progressBar->setMaximum(0); + aptManager->checkForUpdates(); +} + void MainWindow::onCloseButtonClicked() { hide(); @@ -118,12 +133,19 @@ void MainWindow::onCloseButtonClicked() void MainWindow::onUpdateCompleted() { ui->closeButton->setEnabled(true); + ui->checkUpdatesButton->setEnabled(true); ui->installButton->setEnabled(false); ui->progressBar->setVisible(false); - ui->statLabel->setText("Update installation complete."); + ui->statLabel->setText(tr("Update installation complete.")); emit updatesInstalled(); // this tells the orchestrator to hide the tray icon } +void MainWindow::onCheckUpdatesCompleted() +{ + ui->closeButton->setEnabled(true); // unlocks the updater so that the orchestrator actually can update things + emit updatesRefreshed(); // this tells the orchestrator to re-scan for updates +} + void MainWindow::onProgressUpdate(int progress) { ui->progressBar->setValue(progress); diff --git a/mainwindow.h b/src/mainwindow.h similarity index 89% rename from mainwindow.h rename to src/mainwindow.h index dc16cab..c5415e5 100644 --- a/mainwindow.h +++ b/src/mainwindow.h @@ -25,14 +25,17 @@ public: signals: void updatesInstalled(); + void updatesRefreshed(); protected slots: void closeEvent(QCloseEvent *event) override; private slots: void onInstallButtonClicked(); + void onCheckUpdatesButtonClicked(); void onCloseButtonClicked(); void onUpdateCompleted(); + void onCheckUpdatesCompleted(); void onProgressUpdate(int progress); void onLogLineReady(QString logLine); void onConffileListReady(QStringList conffileList); diff --git a/mainwindow.ui b/src/mainwindow.ui similarity index 96% rename from mainwindow.ui rename to src/mainwindow.ui index cb0935b..c80921f 100644 --- a/mainwindow.ui +++ b/src/mainwindow.ui @@ -86,9 +86,9 @@ font: 9pt "Monospace"; - + - Details + Check for Updates diff --git a/orchestrator.cpp b/src/orchestrator.cpp similarity index 88% rename from orchestrator.cpp rename to src/orchestrator.cpp index 36e4085..21e359f 100644 --- a/orchestrator.cpp +++ b/src/orchestrator.cpp @@ -15,6 +15,7 @@ Orchestrator::Orchestrator(QObject *parent) connect(checkTimer, &QTimer::timeout, this, &Orchestrator::checkForUpdates); connect(trayIcon, &QSystemTrayIcon::activated, this, &Orchestrator::displayUpdater); connect(&updaterWindow, &MainWindow::updatesInstalled, this, &Orchestrator::handleUpdatesInstalled); + connect(&updaterWindow, &MainWindow::updatesRefreshed, this, &Orchestrator::handleUpdatesRefreshed); checkTimer->start(21600000); // check four times a day, at least one of those times unattended-upgrades should have refreshed the apt database @@ -34,7 +35,7 @@ void Orchestrator::checkForUpdates() trayIcon->show(); // Yes, we do intentionally use updateInfo[1], then updateInfo[0], then updateInfo[2]. The updateInfo array is populated in a different order than the one we display in. trayIcon->showMessage("", - QString("Updates available!\n\n%1 to upgrade, %2 to install, and %3 to remove.\n\nClick the tray icon to install the updates.") + tr("Updates available!\n\n%1 to upgrade, %2 to install, and %3 to remove.\n\nClick the tray icon to install the updates.") .arg(QString::number(updateInfo[1].count()), QString::number(updateInfo[0].count()), QString::number(updateInfo[2].count()))); } } @@ -58,3 +59,9 @@ void Orchestrator::handleUpdatesInstalled() } trayIcon->hide(); } + +void Orchestrator::handleUpdatesRefreshed() +{ + checkForUpdates(); + displayUpdater(); +} diff --git a/orchestrator.h b/src/orchestrator.h similarity index 93% rename from orchestrator.h rename to src/orchestrator.h index 0e5cd45..e9eb690 100644 --- a/orchestrator.h +++ b/src/orchestrator.h @@ -21,6 +21,7 @@ public slots: private slots: void checkForUpdates(); void handleUpdatesInstalled(); + void handleUpdatesRefreshed(); private: QTimer *checkTimer; diff --git a/res/images/update.svg b/src/res/images/update.svg similarity index 100% rename from res/images/update.svg rename to src/res/images/update.svg diff --git a/resources.qrc b/src/resources.qrc similarity index 100% rename from resources.qrc rename to src/resources.qrc diff --git a/src/translations.qrc b/src/translations.qrc new file mode 100644 index 0000000..feb5e13 --- /dev/null +++ b/src/translations.qrc @@ -0,0 +1,7 @@ + + + lubuntu-update_en_US.qm + lubuntu-update_es_ES.qm + lubuntu-update_zh_CN.qm + + diff --git a/src/translations/lubuntu-update_en_US.ts b/src/translations/lubuntu-update_en_US.ts new file mode 100644 index 0000000..facb5e7 --- /dev/null +++ b/src/translations/lubuntu-update_en_US.ts @@ -0,0 +1,143 @@ + + + + + ConffileHandlerDialog + + + Configuration File Conflicts + + + + + <html><head/><body><p>Some of the newly installed updates have updated configuration files. </p><p>Please choose what to do with these files.</p></body></html> + + + + + Done + + + + + ConffileWidget + + + Form + + + + + Filename + + + + + Keep old + + + + + Replace with new + + + + + Show diff + + + + + DiffDisplayDialog + + + Dialog + + + + + <html><head/><body><p>Lines that start with a &quot;+&quot; only exist in the <span style=" font-weight:700;">new</span> file.</p><p>Lines that start with a &quot;-&quot; only exist in the <span style=" font-weight:700;">old</span> file.</p></body></html> + + + + + Done + + + + + MainWindow + + + Lubuntu Update + + + + + 0 package(s) will be updated. 0 of these updates are security-related. + + + + + Packages + + + + + Install Updates + + + + + Check for Updates + + + + + Close + + + + + To be installed + + + + + To be upgraded + + + + + To be removed + + + + + Held back (usually temporarily) + + + + + %1 package(s) will be updated. %2 of these updates are security-related. + + + + + Update installation complete. + + + + + Orchestrator + + + Updates available! + +%1 to upgrade, %2 to install, and %3 to remove. + +Click the tray icon to install the updates. + + + + diff --git a/src/translations/lubuntu-update_es_ES.ts b/src/translations/lubuntu-update_es_ES.ts new file mode 100644 index 0000000..84660c3 --- /dev/null +++ b/src/translations/lubuntu-update_es_ES.ts @@ -0,0 +1,143 @@ + + + + + ConffileHandlerDialog + + + Configuration File Conflicts + + + + + <html><head/><body><p>Some of the newly installed updates have updated configuration files. </p><p>Please choose what to do with these files.</p></body></html> + + + + + Done + + + + + ConffileWidget + + + Form + + + + + Filename + + + + + Keep old + + + + + Replace with new + + + + + Show diff + + + + + DiffDisplayDialog + + + Dialog + + + + + <html><head/><body><p>Lines that start with a &quot;+&quot; only exist in the <span style=" font-weight:700;">new</span> file.</p><p>Lines that start with a &quot;-&quot; only exist in the <span style=" font-weight:700;">old</span> file.</p></body></html> + + + + + Done + + + + + MainWindow + + + Lubuntu Update + + + + + 0 package(s) will be updated. 0 of these updates are security-related. + + + + + Packages + + + + + Install Updates + + + + + Check for Updates + + + + + Close + + + + + To be installed + + + + + To be upgraded + + + + + To be removed + + + + + Held back (usually temporarily) + + + + + %1 package(s) will be updated. %2 of these updates are security-related. + + + + + Update installation complete. + + + + + Orchestrator + + + Updates available! + +%1 to upgrade, %2 to install, and %3 to remove. + +Click the tray icon to install the updates. + + + + diff --git a/src/translations/lubuntu-update_zh_CN.ts b/src/translations/lubuntu-update_zh_CN.ts new file mode 100644 index 0000000..ccd2be6 --- /dev/null +++ b/src/translations/lubuntu-update_zh_CN.ts @@ -0,0 +1,143 @@ + + + + + ConffileHandlerDialog + + + Configuration File Conflicts + + + + + <html><head/><body><p>Some of the newly installed updates have updated configuration files. </p><p>Please choose what to do with these files.</p></body></html> + + + + + Done + + + + + ConffileWidget + + + Form + + + + + Filename + + + + + Keep old + + + + + Replace with new + + + + + Show diff + + + + + DiffDisplayDialog + + + Dialog + + + + + <html><head/><body><p>Lines that start with a &quot;+&quot; only exist in the <span style=" font-weight:700;">new</span> file.</p><p>Lines that start with a &quot;-&quot; only exist in the <span style=" font-weight:700;">old</span> file.</p></body></html> + + + + + Done + + + + + MainWindow + + + Lubuntu Update + + + + + 0 package(s) will be updated. 0 of these updates are security-related. + + + + + Packages + + + + + Install Updates + + + + + Check for Updates + + + + + Close + + + + + To be installed + + + + + To be upgraded + + + + + To be removed + + + + + Held back (usually temporarily) + + + + + %1 package(s) will be updated. %2 of these updates are security-related. + + + + + Update installation complete. + + + + + Orchestrator + + + Updates available! + +%1 to upgrade, %2 to install, and %3 to remove. + +Click the tray icon to install the updates. + + + + diff --git a/translations/lubuntu-update_en_US.ts b/translations/lubuntu-update_en_US.ts deleted file mode 100644 index edd0d34..0000000 --- a/translations/lubuntu-update_en_US.ts +++ /dev/null @@ -1,3 +0,0 @@ - - -