-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
100 lines (84 loc) · 2.32 KB
/
mainwindow.cpp
File metadata and controls
100 lines (84 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//
// Created by axel on 26/12/2025.
//
#include "mainwindow.h"
#include "mainwindow.h"
#include "fileexplorer.h"
#include "navigationpanel.h"
#include <QToolBar>
#include <QAction>
#include <QDockWidget>
#include <QSystemTrayIcon>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
setWindowTitle("CExplorer");
setWindowIcon(QIcon(":/images/images/icon.png"));
resize(900, 600);
setupUI();
createActions();
createToolbar();
connectSignals();
}
MainWindow::~MainWindow()
{
// Qt gère automatiquement la suppression des enfants
}
void MainWindow::setupUI()
{
// Créer l'explorateur de fichiers (widget central)
fileExplorer = new FileExplorer(this);
setCentralWidget(fileExplorer);
// Créer le panneau de navigation (dock)
navPanel = new NavigationPanel(this);
QDockWidget *dock = new QDockWidget("Navigation", this);
dock->setWidget(navPanel);
addDockWidget(Qt::LeftDockWidgetArea, dock);
}
void MainWindow::createActions()
{
refreshAction = new QAction("Rafraîchir", this);
rootAction = new QAction("Racine", this);
}
void MainWindow::createToolbar()
{
toolbar = addToolBar("TopBar");
toolbar->addAction(rootAction);
toolbar->addAction(refreshAction);
}
void MainWindow::connectSignals()
{
// Navigation panel -> File explorer
connect(navPanel, &NavigationPanel::locationSelected,
this, &MainWindow::onNavigate);
// Actions toolbar
connect(refreshAction, &QAction::triggered,
this, &MainWindow::onRefresh);
connect(rootAction, &QAction::triggered,
this, &MainWindow::onGoToRoot);
// File explorer -> MainWindow (pour notifications)
connect(fileExplorer, &FileExplorer::fileDeleted,
this, &MainWindow::onFileDeleted);
}
void MainWindow::onNavigate(const QString &path)
{
fileExplorer->navigateToPath(path);
}
void MainWindow::onRefresh()
{
fileExplorer->refresh();
}
void MainWindow::onGoToRoot()
{
fileExplorer->goToRoot();
}
void MainWindow::onFileDeleted(const QString &path)
{
// Afficher une notification
QSystemTrayIcon trayIcon(this);
trayIcon.show();
trayIcon.showMessage("Élément supprimé",
path + " a été supprimé !",
QSystemTrayIcon::Information,
5000);
}