Created simple base gui #1
This commit is contained in:
+29
-3
@@ -29,9 +29,35 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Find includes in corresponding build directories
|
||||||
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
# Instruct CMake to run moc automatically when needed
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
# Create code from a list of Qt designer ui files
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
|
||||||
|
|
||||||
|
find_package(Qt5Widgets CONFIG REQUIRED)
|
||||||
|
|
||||||
add_subdirectory(cpr)
|
add_subdirectory(cpr)
|
||||||
|
|
||||||
add_executable(icd src/Main.cpp src/Managers/FileManager.h src/Managers/FileManager.cpp src/Syncers/Upload.h src/Syncers/Upload.cpp
|
set(SOURCES
|
||||||
src/Syncers/Download.h src/Syncers/Download.cpp src/Models/Song.h)
|
src/Main.cpp
|
||||||
target_link_libraries(icd ${CPR_LIBRARIES})
|
src/Managers/FileManager.cpp
|
||||||
|
src/Syncers/Download.cpp
|
||||||
|
src/Syncers/Upload.cpp
|
||||||
|
src/UI/MainWindow.cpp
|
||||||
|
)
|
||||||
|
set(HEADERS
|
||||||
|
src/Managers/FileManager.h
|
||||||
|
src/Models/Song.h
|
||||||
|
src/Syncers/Download.h
|
||||||
|
src/Syncers/Upload.h
|
||||||
|
src/UI/CommonWindow.h
|
||||||
|
src/UI/MainWindow.h
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(icd ${SOURCES} ${HEADERS})
|
||||||
|
|
||||||
|
target_link_libraries(icd ${CPR_LIBRARIES} Qt5::Widgets)
|
||||||
include_directories(${CPR_INCLUDE_DIRS} ${JSON_INCLUDE_DIRS} src/)
|
include_directories(${CPR_INCLUDE_DIRS} ${JSON_INCLUDE_DIRS} src/)
|
||||||
|
|||||||
+9
-19
@@ -1,20 +1,18 @@
|
|||||||
#include<iostream>
|
#include<iostream>
|
||||||
#include<string>
|
#include<string>
|
||||||
|
|
||||||
#include"Syncers/Download.h"
|
#include<QApplication>
|
||||||
#include"Syncers/Upload.h"
|
|
||||||
#include"Managers/FileManager.h"
|
#include"UI/MainWindow.h"
|
||||||
|
|
||||||
using std::cin;
|
using std::cin;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
using Managers::FileManager;
|
using UI::MainWindow;
|
||||||
using Syncers::Download;
|
|
||||||
using Syncers::Upload;
|
|
||||||
|
|
||||||
string songPath;
|
string songPath{};
|
||||||
string newSongPath;
|
string newSongPath;
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
@@ -36,19 +34,11 @@ int main(int argc, char** argv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cout<<"Song path: "<<songPath<<endl;
|
QApplication app{argc, argv};
|
||||||
/**
|
|
||||||
FileManager fm{songPath};
|
|
||||||
fm.saveFile(newSongPath);
|
|
||||||
|
|
||||||
Upload upS{songPath};
|
MainWindow icarusMgr{};
|
||||||
upS.uploadSong();
|
icarusMgr.show();
|
||||||
*/
|
|
||||||
|
|
||||||
Download df{newSongPath};
|
|
||||||
df.downloadSong(1);
|
|
||||||
|
|
||||||
|
|
||||||
|
return app.exec();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#ifndef COMMONWINDOW_H_
|
||||||
|
#define COMMONWINDOW_H_
|
||||||
|
|
||||||
|
#include<memory>
|
||||||
|
|
||||||
|
#include<QDialog>
|
||||||
|
#include<QHBoxLayout>
|
||||||
|
#include<QVBoxLayout>
|
||||||
|
#include<QComboBox>
|
||||||
|
#include<QPushButton>
|
||||||
|
|
||||||
|
|
||||||
|
class CommonWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CommonWindow() = default;
|
||||||
|
~CommonWindow() = default;
|
||||||
|
protected:
|
||||||
|
virtual void connections()=0;
|
||||||
|
std::unique_ptr<QComboBox> selectionBoxQt;
|
||||||
|
std::unique_ptr<QPushButton> actionButtonQt;
|
||||||
|
std::unique_ptr<QVBoxLayout> mainLayoutQt;
|
||||||
|
std::unique_ptr<QHBoxLayout> subLayoutOneQt;
|
||||||
|
std::unique_ptr<QHBoxLayout> subLayoutTwoQt;
|
||||||
|
int windowHeight, windowWidth;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
#include"MainWindow.h"
|
||||||
|
|
||||||
|
using std::unique_ptr;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
MainWindow::MainWindow()
|
||||||
|
{
|
||||||
|
|
||||||
|
setupMainWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::configureDownloadSection()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void MainWindow::configureUploadSection()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void MainWindow::configureWindowDimensions()
|
||||||
|
{
|
||||||
|
windowWidth = 600;
|
||||||
|
windowHeight = 600;
|
||||||
|
}
|
||||||
|
void MainWindow::configureWindowProperties()
|
||||||
|
{
|
||||||
|
setWindowTitle("IcarusDownloadManager");
|
||||||
|
setFixedHeight(windowHeight);
|
||||||
|
setFixedWidth(windowWidth);
|
||||||
|
}
|
||||||
|
void MainWindow::connections()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void MainWindow::createMenus()
|
||||||
|
{
|
||||||
|
fileMenuQt = unique_ptr<QMenu>{menuBar()->addMenu(tr("File"))};
|
||||||
|
editMenuQt = unique_ptr<QMenu>{menuBar()->addMenu(tr("Edit"))};
|
||||||
|
|
||||||
|
closeApplicationQt = unique_ptr<QAction>{new QAction(new QObject(nullptr))};
|
||||||
|
closeApplicationQt.get()->setText("Exit Application");
|
||||||
|
|
||||||
|
/**
|
||||||
|
keyEdit = unique_ptr<QAction>{new QAction(new QObject(nullptr))};
|
||||||
|
keyEdit.get()->setText("Key Management");
|
||||||
|
passwordManage = unique_ptr<QAction>{new QAction{new QObject{nullptr}}};
|
||||||
|
passwordManage.get()->setText("PasswordManagement");
|
||||||
|
|
||||||
|
fileMenu.get()->addAction(closeApplication.get());
|
||||||
|
editMenu.get()->addAction(keyEdit.get());
|
||||||
|
editMenu.get()->addAction(passwordManage.get());
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
void MainWindow::setupMainWindow()
|
||||||
|
{
|
||||||
|
configureWindowDimensions();
|
||||||
|
actionButtonQt = unique_ptr<QPushButton>{new QPushButton(tr("upload"))};
|
||||||
|
selectionBoxQt = unique_ptr<QComboBox>{new QComboBox{}};
|
||||||
|
|
||||||
|
buttonLayoutQt = unique_ptr<QVBoxLayout>{new QVBoxLayout};
|
||||||
|
buttonWidgetQt = unique_ptr<QWidget>{new QWidget};
|
||||||
|
buttonDockWidgetQt = unique_ptr<QDockWidget>{new QDockWidget};
|
||||||
|
buttonDockWidgetQt.get()->setWindowTitle(tr("Music Manager"));
|
||||||
|
buttonLayoutQt.get()->addWidget(selectionBoxQt.get());
|
||||||
|
buttonLayoutQt.get()->addWidget(actionButtonQt.get());
|
||||||
|
buttonWidgetQt.get()->setLayout(buttonLayoutQt.get());
|
||||||
|
buttonDockWidgetQt.get()->setWidget(buttonWidgetQt.get());
|
||||||
|
buttonDockWidgetQt.get()->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||||
|
setCentralWidget(buttonDockWidgetQt.get());
|
||||||
|
|
||||||
|
cryptionAreaQt = unique_ptr<QDockWidget>{new QDockWidget(tr("Cryption"))};
|
||||||
|
cryptionAreaQt.get()->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||||
|
addDockWidget(Qt::LeftDockWidgetArea, cryptionAreaQt.get());
|
||||||
|
|
||||||
|
createMenus();
|
||||||
|
|
||||||
|
|
||||||
|
configureWindowProperties();
|
||||||
|
actionButtonQt.get()->setEnabled(false);
|
||||||
|
|
||||||
|
connections();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
#ifndef MAINWINDOW_H_
|
||||||
|
#define MAINWINDOW_H_
|
||||||
|
|
||||||
|
#include<iostream>
|
||||||
|
#include<memory>
|
||||||
|
|
||||||
|
#include<QAction>
|
||||||
|
#include<QDialog>
|
||||||
|
#include<QDockWidget>
|
||||||
|
#include<QLabel>
|
||||||
|
#include<QMenu>
|
||||||
|
#include<QMenuBar>
|
||||||
|
#include<QMainWindow>
|
||||||
|
#include<QTextEdit>
|
||||||
|
#include<QWidget>
|
||||||
|
|
||||||
|
#include"UI/CommonWindow.h"
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
class MainWindow: public QMainWindow, public CommonWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
MainWindow();
|
||||||
|
~MainWindow() = default;
|
||||||
|
private:
|
||||||
|
void configureDownloadSection();
|
||||||
|
void configureUploadSection();
|
||||||
|
void configureWindowDimensions();
|
||||||
|
void configureWindowProperties();
|
||||||
|
void connections();
|
||||||
|
void createMenus();
|
||||||
|
void setupMainWindow();
|
||||||
|
|
||||||
|
std::unique_ptr<QVBoxLayout> buttonLayoutQt;
|
||||||
|
|
||||||
|
std::unique_ptr<QWidget> buttonWidgetQt;
|
||||||
|
|
||||||
|
std::unique_ptr<QDockWidget> buttonDockWidgetQt;
|
||||||
|
std::unique_ptr<QDockWidget> cryptionAreaQt;
|
||||||
|
|
||||||
|
std::unique_ptr<QTextEdit> sourceFilePathQt;
|
||||||
|
|
||||||
|
std::unique_ptr<QMenu> fileMenuQt;
|
||||||
|
std::unique_ptr<QMenu> editMenuQt;
|
||||||
|
std::unique_ptr<QAction> closeApplicationQt;
|
||||||
|
signals:
|
||||||
|
private slots:
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user