Created about window. #5

This commit is contained in:
amazing-username
2019-04-21 16:35:54 -04:00
parent f19dd5e003
commit bab490f714
7 changed files with 113 additions and 15 deletions
+2
View File
@@ -47,6 +47,7 @@ set(SOURCES
src/Syncers/Download.cpp src/Syncers/Download.cpp
src/Syncers/Upload.cpp src/Syncers/Upload.cpp
src/UI/MainWindow.cpp src/UI/MainWindow.cpp
src/UI/AboutWindow.cpp
) )
set(HEADERS set(HEADERS
src/Managers/FileManager.h src/Managers/FileManager.h
@@ -56,6 +57,7 @@ set(HEADERS
src/Syncers/Upload.h src/Syncers/Upload.h
src/UI/CommonWindow.h src/UI/CommonWindow.h
src/UI/MainWindow.h src/UI/MainWindow.h
src/UI/AboutWindow.h
) )
add_executable(icd ${SOURCES} ${HEADERS}) add_executable(icd ${SOURCES} ${HEADERS})
-1
View File
@@ -17,7 +17,6 @@ string newSongPath;
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
cout<<"Argument size: "<<argc<<endl;
switch(argc) switch(argc)
{ {
case 0: case 0:
+47
View File
@@ -0,0 +1,47 @@
#include"AboutWindow.h"
using std::unique_ptr;
namespace UI
{
AboutWindow::AboutWindow(QWidget* parent): QDialog(parent)
{
setupWindow();
}
void AboutWindow::setupWindow()
{
windowWidth = 250;
windowHeight = 300;
mainLayoutQt = unique_ptr<QVBoxLayout>{new QVBoxLayout};
appName = unique_ptr<QLabel>{new QLabel(tr("IcarusDownloadManager"))};
actionButtonQt = unique_ptr<QPushButton>{new QPushButton(tr("Close"))};
mainLayoutQt->addWidget(appName.get());
mainLayoutQt->addWidget(actionButtonQt.get());
setFixedWidth(windowWidth);
setFixedHeight(windowHeight);
setLayout(mainLayoutQt.get());
setWindowTitle("About");
connections();
}
void AboutWindow::connections()
{
QObject::connect(actionButtonQt.get(), SIGNAL(clicked()), this,
SLOT(closeWindow()));
}
void AboutWindow::closeWindow()
{
this->hide();
}
}
+34
View File
@@ -0,0 +1,34 @@
#ifndef ABOUTWINDOW_H_
#define ABOUTWINDOW_H_
#include<memory>
#include<QDialog>
#include<QDockWidget>
#include<QLabel>
#include<QPushButton>
#include<QWidget>
#include"UI/CommonWindow.h"
namespace UI
{
class AboutWindow: public QDialog, public CommonWindow
{
Q_OBJECT
public:
AboutWindow(QWidget* parent=0);
~AboutWindow() = default;
private:
void connections();
void setupWindow();
std::unique_ptr<QLabel> appName;
private slots:
void closeWindow();
};
}
#endif
+22 -9
View File
@@ -18,8 +18,8 @@ namespace UI
{ {
MainWindow::MainWindow() MainWindow::MainWindow()
{ {
setupMainWindow(); setupMainWindow();
aboutWindow = unique_ptr<AboutWindow>{new AboutWindow};
} }
@@ -51,8 +51,8 @@ namespace UI
} }
void MainWindow::configureWindowDimensions() void MainWindow::configureWindowDimensions()
{ {
windowWidth = 400; windowWidth = 450;
windowHeight = 400; windowHeight = 450;
} }
void MainWindow::configureWindowProperties() void MainWindow::configureWindowProperties()
{ {
@@ -63,20 +63,25 @@ namespace UI
void MainWindow::connections() void MainWindow::connections()
{ {
QObject::connect(uploadSongQt.get(), SIGNAL(clicked()), this, SLOT(uploadSong())); QObject::connect(uploadSongQt.get(), SIGNAL(clicked()), this, SLOT(uploadSong()));
QObject::connect(closeApplicationQt.get(), SIGNAL(triggered()), this,
SLOT(exitApplication()));
QObject::connect(aboutApplicationQt.get(), SIGNAL(triggered()), this,
SLOT(displaySoftwareInformation()));
} }
void MainWindow::createMenus() void MainWindow::createMenus()
{ {
fileMenuQt = unique_ptr<QMenu>{menuBar()->addMenu(tr("File"))}; fileMenuQt = unique_ptr<QMenu>{menuBar()->addMenu(tr("File"))};
editMenuQt = unique_ptr<QMenu>{menuBar()->addMenu(tr("Edit"))}; editMenuQt = unique_ptr<QMenu>{menuBar()->addMenu(tr("Edit"))};
helpMenuQt = unique_ptr<QMenu>{menuBar()->addMenu(tr("Help"))};
closeApplicationQt = unique_ptr<QAction>{new QAction(new QObject(nullptr))}; closeApplicationQt = unique_ptr<QAction>{new QAction(new QObject(nullptr))};
closeApplicationQt.get()->setText("Exit Application"); closeApplicationQt->setText("Exit Application");
/** aboutApplicationQt = unique_ptr<QAction>{new QAction(new QObject(nullptr))};
fileMenu.get()->addAction(closeApplication.get()); aboutApplicationQt->setText("About");
editMenu.get()->addAction(keyEdit.get());
editMenu.get()->addAction(passwordManage.get()); fileMenuQt->addAction(closeApplicationQt.get());
*/ helpMenuQt->addAction(aboutApplicationQt.get());
} }
void MainWindow::setupMainWindow() void MainWindow::setupMainWindow()
@@ -103,6 +108,14 @@ namespace UI
} }
void MainWindow::exitApplication()
{
exit(0);
}
void MainWindow::displaySoftwareInformation()
{
aboutWindow->show();
}
void MainWindow::uploadSong() void MainWindow::uploadSong()
{ {
uploadSongQt->setEnabled(false); uploadSongQt->setEnabled(false);
+8
View File
@@ -16,6 +16,7 @@
#include<QWidget> #include<QWidget>
#include"UI/CommonWindow.h" #include"UI/CommonWindow.h"
#include"UI/AboutWindow.h"
namespace UI namespace UI
{ {
@@ -52,10 +53,17 @@ namespace UI
std::unique_ptr<QMenu> fileMenuQt; std::unique_ptr<QMenu> fileMenuQt;
std::unique_ptr<QMenu> editMenuQt; std::unique_ptr<QMenu> editMenuQt;
std::unique_ptr<QMenu> helpMenuQt;
std::unique_ptr<QAction> closeApplicationQt; std::unique_ptr<QAction> closeApplicationQt;
std::unique_ptr<QAction> aboutApplicationQt;
std::unique_ptr<AboutWindow> aboutWindow;
signals: signals:
private slots: private slots:
void uploadSong(); void uploadSong();
void exitApplication();
void displaySoftwareInformation();
}; };
} }
-5
View File
@@ -1,5 +0,0 @@
#include"Upload.h"
Upload::Upload()
{
}