Created about window. #5
This commit is contained in:
@@ -47,6 +47,7 @@ set(SOURCES
|
||||
src/Syncers/Download.cpp
|
||||
src/Syncers/Upload.cpp
|
||||
src/UI/MainWindow.cpp
|
||||
src/UI/AboutWindow.cpp
|
||||
)
|
||||
set(HEADERS
|
||||
src/Managers/FileManager.h
|
||||
@@ -56,6 +57,7 @@ set(HEADERS
|
||||
src/Syncers/Upload.h
|
||||
src/UI/CommonWindow.h
|
||||
src/UI/MainWindow.h
|
||||
src/UI/AboutWindow.h
|
||||
)
|
||||
|
||||
add_executable(icd ${SOURCES} ${HEADERS})
|
||||
|
||||
@@ -17,7 +17,6 @@ string newSongPath;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
cout<<"Argument size: "<<argc<<endl;
|
||||
switch(argc)
|
||||
{
|
||||
case 0:
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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
@@ -18,8 +18,8 @@ namespace UI
|
||||
{
|
||||
MainWindow::MainWindow()
|
||||
{
|
||||
|
||||
setupMainWindow();
|
||||
aboutWindow = unique_ptr<AboutWindow>{new AboutWindow};
|
||||
}
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ namespace UI
|
||||
}
|
||||
void MainWindow::configureWindowDimensions()
|
||||
{
|
||||
windowWidth = 400;
|
||||
windowHeight = 400;
|
||||
windowWidth = 450;
|
||||
windowHeight = 450;
|
||||
}
|
||||
void MainWindow::configureWindowProperties()
|
||||
{
|
||||
@@ -63,20 +63,25 @@ namespace UI
|
||||
void MainWindow::connections()
|
||||
{
|
||||
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()
|
||||
{
|
||||
fileMenuQt = unique_ptr<QMenu>{menuBar()->addMenu(tr("File"))};
|
||||
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.get()->setText("Exit Application");
|
||||
closeApplicationQt->setText("Exit Application");
|
||||
|
||||
/**
|
||||
fileMenu.get()->addAction(closeApplication.get());
|
||||
editMenu.get()->addAction(keyEdit.get());
|
||||
editMenu.get()->addAction(passwordManage.get());
|
||||
*/
|
||||
aboutApplicationQt = unique_ptr<QAction>{new QAction(new QObject(nullptr))};
|
||||
aboutApplicationQt->setText("About");
|
||||
|
||||
fileMenuQt->addAction(closeApplicationQt.get());
|
||||
helpMenuQt->addAction(aboutApplicationQt.get());
|
||||
|
||||
}
|
||||
void MainWindow::setupMainWindow()
|
||||
@@ -103,6 +108,14 @@ namespace UI
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::exitApplication()
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
void MainWindow::displaySoftwareInformation()
|
||||
{
|
||||
aboutWindow->show();
|
||||
}
|
||||
void MainWindow::uploadSong()
|
||||
{
|
||||
uploadSongQt->setEnabled(false);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include<QWidget>
|
||||
|
||||
#include"UI/CommonWindow.h"
|
||||
#include"UI/AboutWindow.h"
|
||||
|
||||
namespace UI
|
||||
{
|
||||
@@ -52,10 +53,17 @@ namespace UI
|
||||
|
||||
std::unique_ptr<QMenu> fileMenuQt;
|
||||
std::unique_ptr<QMenu> editMenuQt;
|
||||
std::unique_ptr<QMenu> helpMenuQt;
|
||||
|
||||
std::unique_ptr<QAction> closeApplicationQt;
|
||||
std::unique_ptr<QAction> aboutApplicationQt;
|
||||
|
||||
std::unique_ptr<AboutWindow> aboutWindow;
|
||||
signals:
|
||||
private slots:
|
||||
void uploadSong();
|
||||
void exitApplication();
|
||||
void displaySoftwareInformation();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#include"Upload.h"
|
||||
|
||||
Upload::Upload()
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user