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
|
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version
2 of the License, or (at your option) any later version.
*/
#include <QApplication>
#include <QTabWidget>
#include <QVBoxLayout>
#include <QAction>
#include <QMenuBar>
#include <QMenu>
#include <QDebug>
#include "shemov.h"
#include "filesystemwidget.h"
#include "fileview.h"
SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags) {
mFSWidget = new FilesystemWidget;
mTab = new QTabWidget;
mTab->addTab(mFSWidget, tr("Filemanager"));
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(mTab);
createActions();
createMenus();
QWidget *centralWidget = new QWidget;
centralWidget->setLayout(mainLayout);
setCentralWidget(centralWidget);
show();
}
void SheMov::createActions(){
qDebug() << "Creating Actions";
mQuitA = new QAction(tr("Quit"), this);
mQuitA->setShortcut(tr("CTRL+q"));
connect(mQuitA, SIGNAL(triggered()), qApp, SLOT(quit()));
mMarkFilesA = new QAction(tr("Mark files"), this);
mMarkFilesA->setShortcut(tr("CTRL++"));
connect(mMarkFilesA, SIGNAL(triggered()), mFSWidget->fileView(), SLOT(markFiles()));
mUnmarkFilesA = new QAction(tr("Unmark all files"), this);
mUnmarkFilesA->setShortcut(tr("CTRL+-"));
connect(mUnmarkFilesA, SIGNAL(triggered()), mFSWidget->fileView(), SLOT(unmarkFiles()));
}
void SheMov::createMenus(){
QMenu *fileMenu = new QMenu(tr("&File"), this);
fileMenu->addAction(mQuitA);
QMenu *editMenu = new QMenu(tr("&Edit"), this);
editMenu->addAction(mMarkFilesA);
editMenu->addAction(mUnmarkFilesA);
menuBar()->addMenu(fileMenu);
menuBar()->addMenu(editMenu);
}
|