Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ qt_add_executable(unibackpack
src/main.cpp
src/Downloader.cpp
src/MainWindow.cpp
resources/Utilities/ConfigChecker.cpp

# Header files
include/MainWindow.hpp
include/Downloader.hpp
src/Utilities/ConfigChecker.hpp

# UI
ui/MainWindow.ui
Expand All @@ -29,7 +31,7 @@ qt_add_executable(unibackpack
resources/resources.qrc
)

target_include_directories(unibackpack PRIVATE include)
target_include_directories(unibackpack PRIVATE include resources/Utilities src/Utilities)

target_link_libraries(unibackpack PRIVATE
Qt6::Core
Expand Down
42 changes: 42 additions & 0 deletions resources/Utilities/ConfigChecker.cpp

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

	const QString title = tr("UniBackpack");
	const QString message = found
		? tr("academicConfig.json was detected at:\n%1").arg(path)
		: tr("Paixtike malakia na kses \n%1").arg(path);

Not quite what I expected from a debug message, let's try and avoid it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

void ConfigChecker::scanAndNotify() {
	const QString path = expectedConfigPath();
	const bool found = findConfigFile();

	const QString title = tr("UniBackpack");
	const QString message = found
		? tr("academicConfig.json was detected at:\n%1").arg(path)
		: tr("Paixtike malakia na kses \n%1").arg(path);

	if (QSystemTrayIcon::isSystemTrayAvailable()) {
		static QSystemTrayIcon trayIcon;
		trayIcon.setIcon(QIcon(":/icons/unibackpack.png"));
		trayIcon.show();
		trayIcon.showMessage(title, message,
			found ? QSystemTrayIcon::Information : QSystemTrayIcon::Warning, 5000);
	} else {
		// No tray support on this desktop environment - fall back to the console.
		qInfo().noquote() << title <<

We don't support a system tray icon and it's needed to complete this issue, let's remove that

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Author: <your name here>
#include "ConfigChecker.hpp"

#include <QDir>
#include <QFileInfo>
#include <QSystemTrayIcon>
#include <QIcon>
#include <QDebug>

ConfigChecker::ConfigChecker(QObject *parent) : QObject(parent) {}

QString ConfigChecker::expectedConfigPath() {
return QDir::homePath() + "/.unios/academicConfig.json";
}

bool ConfigChecker::findConfigFile() const {
QFileInfo candidate(expectedConfigPath());
return candidate.exists() && candidate.isFile();
}

void ConfigChecker::scanAndNotify() {
const QString path = expectedConfigPath();
const bool found = findConfigFile();

const QString title = tr("UniBackpack");
const QString message = found
? tr("academicConfig.json was detected at:\n%1").arg(path)
: tr("Paixtike malakia na kses \n%1").arg(path);

if (QSystemTrayIcon::isSystemTrayAvailable()) {
static QSystemTrayIcon trayIcon;
trayIcon.setIcon(QIcon(":/icons/unibackpack.png"));
trayIcon.show();
trayIcon.showMessage(title, message,
found ? QSystemTrayIcon::Information : QSystemTrayIcon::Warning, 5000);
} else {
// No tray support on this desktop environment - fall back to the console.
qInfo().noquote() << title << ":" << message;
}

emit scanFinished(found, path);
}
9 changes: 9 additions & 0 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "ui_MainWindow.h"
#include "MainWindow.hpp"
#include "Downloader.hpp"
#include "Utilities/ConfigChecker.hpp"

#include <QCoreApplication>
#include <QSettings>
Expand Down Expand Up @@ -88,6 +89,14 @@ MainWindow::MainWindow(QWidget *parent)
});

retranslate();

QMenu *toolsMenu = menuBar()->addMenu(tr("Tools"));
QAction *checkConfigAction = toolsMenu->addAction(tr("Check for AcademicConfig.json"));
connect(checkConfigAction, &QAction::triggered, this, [=]() {
ConfigChecker *checker = new ConfigChecker(this);
checker->scanAndNotify();
checker->deleteLater();
});
}

MainWindow::~MainWindow() {
Expand Down
32 changes: 32 additions & 0 deletions src/Utilities/ConfigChecker.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Author: Vagellis Sotiropoulos 2026 <vagellis.sotiropoulos@unios.com>
#ifndef CONFIGCHECKER_HPP
#define CONFIGCHECKER_HPP

#include <QObject>
#include <QString>
#include <QStringList>

//edw na kses psaxnei kai an ta vrei to leei ksa mou
class ConfigChecker : public QObject
{
Q_OBJECT

public:
explicit ConfigChecker(QObject *parent = nullptr);

// Absolute path to the expected config file: ~/.unios/academicConfig.json
static QString expectedConfigPath();

// Checks for the file and shows a system notification reporting
// whether it was found. Emits scanFinished() afterwards.
void scanAndNotify();

// Performs the check only, with no UI side effects. Returns true
// if the file exists at expectedConfigPath().
bool findConfigFile() const;

signals:
void scanFinished(bool found, const QString &path);
};

#endif // CONFIGCHECKER_HPP
5 changes: 4 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Author: Apostolos Chalis 2026 <achalis@csd.auth.gr>
#include <QApplication>
#include "MainWindow.hpp"
#include "Utilities/ConfigChecker.hpp"
#include <QTranslator>
#include <QSettings>
#include <QLocale>
Expand All @@ -18,7 +19,9 @@ int main(int argc, char *argv[]){
QString lang = settings.value("language", QLocale::system().name()).toString();
applyTranslator(lang);


ConfigChecker *startupConfigChecker = new ConfigChecker(&uni_backpack_app);
startupConfigChecker->scanAndNotify();

MainWindow main_window;
main_window.show();

Expand Down
Loading