@@ -39,14 +39,6 @@ namespace Ui
39
39
void setupUi (Nickvision::Miniera::Qt::Views::MainWindow* parent)
40
40
{
41
41
// Actions
42
- actionOpenFolder = new QAction (parent);
43
- actionOpenFolder->setText (_ (" Open Folder" ));
44
- actionOpenFolder->setIcon (QLEMENTINE_ICON (File_FolderOpen));
45
- actionOpenFolder->setShortcut (Qt::CTRL | Qt::Key_O);
46
- actionCloseFolder = new QAction (parent);
47
- actionCloseFolder->setText (_ (" Close Folder" ));
48
- actionCloseFolder->setIcon (QLEMENTINE_ICON (File_Folder));
49
- actionCloseFolder->setShortcut (Qt::CTRL | Qt::Key_W);
50
42
actionExit = new QAction (parent);
51
43
actionExit->setText (_ (" Exit" ));
52
44
actionExit->setIcon (QLEMENTINE_ICON (Action_Close));
@@ -77,9 +69,6 @@ namespace Ui
77
69
// MenuBar
78
70
QMenu* menuFile{ new QMenu (parent) };
79
71
menuFile->setTitle (_ (" File" ));
80
- menuFile->addAction (actionOpenFolder);
81
- menuFile->addAction (actionCloseFolder);
82
- menuFile->addSeparator ();
83
72
menuFile->addAction (actionExit);
84
73
QMenu* menuEdit{ new QMenu (parent) };
85
74
menuEdit->setTitle (_ (" Edit" ));
@@ -96,29 +85,9 @@ namespace Ui
96
85
parent->menuBar ()->addMenu (menuFile);
97
86
parent->menuBar ()->addMenu (menuEdit);
98
87
parent->menuBar ()->addMenu (menuHelp);
99
- // ToolBar
100
- QToolBar* toolBar{ new QToolBar (parent) };
101
- toolBar->setAllowedAreas (::Qt::ToolBarArea::TopToolBarArea);
102
- toolBar->setMovable (false );
103
- toolBar->setFloatable (false );
104
- toolBar->addAction (actionOpenFolder);
105
- toolBar->addAction (actionCloseFolder);
106
- parent->addToolBar (toolBar);
107
- // Files View
108
- listFiles = new QListWidget (parent);
109
- listFiles->setSelectionMode (QAbstractItemView::SelectionMode::SingleSelection);
110
- lblFiles = new QLabel (parent);
111
- lblFiles->setAlignment (::Qt::AlignmentFlag::AlignCenter);
112
- lblFiles->setText (_ (" No Folder Opened" ));
113
88
// Main Layout
114
89
QWidget* centralWidget{ new QWidget (parent) };
115
- QHBoxLayout* layoutMain{ new QHBoxLayout (parent) };
116
- QScrollArea* scrollFiles{ new QScrollArea (parent) };
117
- scrollFiles->setMaximumWidth (300 );
118
- scrollFiles->setWidgetResizable (true );
119
- scrollFiles->setWidget (listFiles);
120
- layoutMain->addWidget (scrollFiles);
121
- layoutMain->addWidget (lblFiles);
90
+ QVBoxLayout* layoutMain{ new QVBoxLayout (parent) };
122
91
centralWidget->setLayout (layoutMain);
123
92
parent->setCentralWidget (centralWidget);
124
93
}
@@ -133,8 +102,6 @@ namespace Ui
133
102
QAction* actionDiscussions;
134
103
QAction* actionAbout;
135
104
Nickvision::Miniera::Qt::Controls::InfoBar* infoBar;
136
- QListWidget* listFiles;
137
- QLabel* lblFiles;
138
105
};
139
106
}
140
107
@@ -148,14 +115,12 @@ namespace Nickvision::Miniera::Qt::Views
148
115
{
149
116
// Window Settings
150
117
bool stable{ m_controller->getAppInfo ().getVersion ().getVersionType () == VersionType::Stable };
151
- setWindowTitle (stable ? _ (" Application " ) : _ (" Application (Preview)" ));
118
+ setWindowTitle (stable ? _ (" Miniera " ) : _ (" Miniera (Preview)" ));
152
119
setWindowIcon (QIcon (" :/icon.svg" ));
153
120
setAcceptDrops (true );
154
121
// Load Ui
155
122
m_ui->setupUi (this );
156
123
// Signals
157
- connect (m_ui->actionOpenFolder , &QAction::triggered, this , &MainWindow::openFolder);
158
- connect (m_ui->actionCloseFolder , &QAction::triggered, this , &MainWindow::closeFolder);
159
124
connect (m_ui->actionExit , &QAction::triggered, this , &MainWindow::close);
160
125
connect (m_ui->actionSettings , &QAction::triggered, this , &MainWindow::settings);
161
126
connect (m_ui->actionCheckForUpdates , &QAction::triggered, this , &MainWindow::checkForUpdates);
@@ -165,7 +130,6 @@ namespace Nickvision::Miniera::Qt::Views
165
130
connect (m_ui->actionAbout , &QAction::triggered, this , &MainWindow::about);
166
131
m_controller->notificationSent () += [&](const NotificationSentEventArgs& args) { QtHelpers::dispatchToMainThread ([this , args]() { onNotificationSent (args); }); };
167
132
m_controller->shellNotificationSent () += [&](const ShellNotificationSentEventArgs& args) { onShellNotificationSent (args); };
168
- m_controller->folderChanged () += [&](const EventArgs& args) { onFolderChanged (args); };
169
133
}
170
134
171
135
MainWindow::~MainWindow ()
@@ -200,33 +164,6 @@ namespace Nickvision::Miniera::Qt::Views
200
164
event->accept ();
201
165
}
202
166
203
- void MainWindow::dragEnterEvent (QDragEnterEvent* event)
204
- {
205
- if (event->mimeData ()->hasUrls ())
206
- {
207
- event->acceptProposedAction ();
208
- }
209
- }
210
-
211
- void MainWindow::dropEvent (QDropEvent* event)
212
- {
213
- if (event->mimeData ()->hasUrls ())
214
- {
215
- m_controller->openFolder (event->mimeData ()->urls ()[0 ].toLocalFile ().toStdString ());
216
- }
217
- }
218
-
219
- void MainWindow::openFolder ()
220
- {
221
- QString path{ QFileDialog::getExistingDirectory (this , _ (" Open Folder" ), {}, QFileDialog::ShowDirsOnly) };
222
- m_controller->openFolder (path.toStdString ());
223
- }
224
-
225
- void MainWindow::closeFolder ()
226
- {
227
- m_controller->closeFolder ();
228
- }
229
-
230
167
void MainWindow::settings ()
231
168
{
232
169
SettingsDialog dialog{ m_controller->createPreferencesViewController (), m_themeManager, this };
@@ -272,13 +209,8 @@ namespace Nickvision::Miniera::Qt::Views
272
209
{
273
210
QString actionText;
274
211
std::function<void ()> actionCallback;
275
- if (args.getAction () == " close" )
276
- {
277
- actionText = _ (" Close" );
278
- actionCallback = [this ]() { closeFolder (); };
279
- }
280
212
#ifdef _WIN32
281
- else if (args.getAction () == " update" )
213
+ if (args.getAction () == " update" )
282
214
{
283
215
actionText = _ (" Update" );
284
216
actionCallback = [this ]() { windowsUpdate (); };
@@ -297,21 +229,4 @@ namespace Nickvision::Miniera::Qt::Views
297
229
ShellNotification::send (args);
298
230
#endif
299
231
}
300
-
301
- void MainWindow::onFolderChanged (const EventArgs& args)
302
- {
303
- if (m_controller->isFolderOpened ())
304
- {
305
- m_ui->lblFiles ->setText (QString::fromStdString (std::vformat (_n (" There is {} file in the folder." , " There are {} files in the folder." , m_controller->getFiles ().size ()), std::make_format_args (CodeHelpers::unmove (m_controller->getFiles ().size ())))));
306
- for (const std::filesystem::path& file : m_controller->getFiles ())
307
- {
308
- m_ui->listFiles ->addItem (QString::fromStdString (file.filename ().string ()));
309
- }
310
- }
311
- else
312
- {
313
- m_ui->listFiles ->clear ();
314
- m_ui->lblFiles ->setText (_ (" No Folder Opened" ));
315
- }
316
- }
317
232
}
0 commit comments