Update MainWindow.cpp

This commit is contained in:
souchikjoardar201 2025-02-28 19:42:35 +00:00 committed by GitHub
parent eab5f159b8
commit 9f78718275
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,6 +8,9 @@
#include <QInputDialog>
#include <QMessageBox>
#include <QCheckBox>
#include <QFile>
#include <QDir>
#include <QStandardPaths>
#include "constants.h"
#include "dialog/AddressCheckerIndexDialog.h"
@ -35,6 +38,7 @@
#include "utils/Icons.h"
#include "utils/TorManager.h"
#include "utils/WebsocketNotifier.h"
#include "utils/Utils.h"
#include "wallet/wallet_errors.h"
@ -79,7 +83,7 @@ MainWindow::MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *pa
this->onOfflineMode(conf()->get(Config::offlineMode).toBool());
conf()->set(Config::restartRequired, false);
// Websocket notifier
#ifdef CHECK_UPDATES
connect(websocketNotifier(), &WebsocketNotifier::UpdatesReceived, m_updater.data(), &Updater::wsUpdatesReceived);
@ -127,6 +131,20 @@ MainWindow::MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *pa
connect(&m_checkUserActivity, &QTimer::timeout, this, &MainWindow::checkUserActivity);
m_checkUserActivity.setInterval(5000);
m_checkUserActivity.start();
// Call the setupIcon function during initialization
this->setupIcon();
}
void MainWindow::setupIcon() {
#ifdef Q_OS_LINUX
QString iconSource = ":/assets/images/appicons/appicon.svg";
QString iconDestination = Utils::getDefaultIconPath();
if (!Utils::copyIconToUserFolder(iconSource, iconDestination)) {
QMessageBox::warning(this, tr("Icon Setup Failed"), tr("Failed to copy the application icon to the user folder."));
}
#endif
}
void MainWindow::initStatusBar() {
@ -1991,4 +2009,4 @@ int MainWindow::findTab(const QString &title) {
MainWindow::~MainWindow() {
qDebug() << "~MainWindow" << QThread::currentThreadId();
}
}