UI: ProjectSettingsUI
ProjectSettingsUI for creation of new Projects + StartScreen design update
This commit is contained in:
@@ -16,3 +16,4 @@
|
||||
/bin/test/data/TestSettings.xml
|
||||
|
||||
.DS_Store
|
||||
.idea
|
||||
|
||||
+19
-1
@@ -35,7 +35,16 @@ project(${PROJECT_NAME})
|
||||
|
||||
# Clang ------------------------------------------------------------------------
|
||||
|
||||
find_package(LLVM REQUIRED PATHS "$ENV{CLANG_DIR}/build/share/llvm/cmake")
|
||||
if(UNIX AND NOT APPLE)
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
find_package(LLVM REQUIRED PATHS "$ENV{CLANG_DIR}/build_release/share/llvm/cmake")
|
||||
else()
|
||||
find_package(LLVM REQUIRED PATHS "$ENV{CLANG_DIR}/build_debug/share/llvm/cmake")
|
||||
endif()
|
||||
else()
|
||||
find_package(LLVM REQUIRED PATHS "$ENV{CLANG_DIR}/build/share/llvm/cmake")
|
||||
endif()
|
||||
|
||||
find_package(CLANG REQUIRED PATHS "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
add_definitions(${CLANG_DEFINITIONS})
|
||||
@@ -110,6 +119,15 @@ set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_PREFIX_PATH "$ENV{QT_DIR}/")
|
||||
|
||||
find_package(Qt5Widgets)
|
||||
|
||||
if(Qt5Widgets_FOUND)
|
||||
MESSAGE(STATUS "Found Qt ${Qt5Widgets_VERSION_STRING}")
|
||||
# FIX: Qt was built with -reduce-relocations
|
||||
if (Qt5_POSITION_INDEPENDENT_CODE)
|
||||
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(Qt5PrintSupport)
|
||||
if (WIN32)
|
||||
file(WRITE ${CMAKE_SOURCE_DIR}/build/Coati.rc
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
.QtDirectoryListBox {
|
||||
border: 1px solid lightgray;
|
||||
border-radius: 15px;
|
||||
background-color: rgba(255, 255, 255, 200);
|
||||
}
|
||||
|
||||
.QListWidget {
|
||||
border: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
#roundedButton {
|
||||
font-size: 15px;
|
||||
color: white;
|
||||
border-radius: 10px;
|
||||
background: dimgray;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
#roundedButton:hover {
|
||||
background: lightgray;
|
||||
}
|
||||
|
||||
#dropInfo {
|
||||
color: lightgray;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
QLineEdit {
|
||||
border-radius: 10px;
|
||||
border: 1px solid lightgrey;
|
||||
background-color: rgba(255, 255, 255, 200);
|
||||
}
|
||||
|
||||
#form {
|
||||
background-color: rgba(255, 255, 255, 200);
|
||||
border: none;
|
||||
}
|
||||
|
||||
#moreButton {
|
||||
font-size: 15px;
|
||||
margin-left: 10px;
|
||||
color: gray;
|
||||
border-radius: 10px;
|
||||
border: 1px solid lightgray;
|
||||
background: white;
|
||||
width: 40px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
#moreutton:hover {
|
||||
background: lightgray;
|
||||
}
|
||||
|
||||
#windowButton {
|
||||
margin-left: 10px;
|
||||
color: black;
|
||||
border-radius: 10px;
|
||||
border: 1px solid lightgray;
|
||||
background: white;
|
||||
width: 40px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
#windowButton:hover {
|
||||
background: lightgray;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
@@ -0,0 +1,28 @@
|
||||
#projectButton {
|
||||
font-size: 17pt;
|
||||
border: 1px solid lightgray;
|
||||
border-radius: 10px;
|
||||
background: white;
|
||||
}
|
||||
|
||||
#projectButton:hover {
|
||||
color: white;
|
||||
background: navy;
|
||||
}
|
||||
|
||||
#recentButton{
|
||||
font-size: 12pt;
|
||||
color: black;
|
||||
background: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#recentButton:hover{
|
||||
background: lightgray;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
#recentLabel {
|
||||
font-size: 16pt;
|
||||
color: black;
|
||||
}
|
||||
+36
-14
@@ -1,21 +1,43 @@
|
||||
execute_process(
|
||||
COMMAND $ENV{CLANG_DIR}/build/bin/llvm-config --cxxflags
|
||||
OUTPUT_VARIABLE CLANG_DEFINITIONS
|
||||
)
|
||||
if(UNIX AND NOT APPLE)
|
||||
|
||||
set(CLANG_INCLUDE_DIRS
|
||||
"$ENV{CLANG_DIR}/llvm/tools/clang/include"
|
||||
"$ENV{CLANG_DIR}/build/tools/clang/include"
|
||||
)
|
||||
execute_process(
|
||||
COMMAND $ENV{CLANG_DIR}/build_debug/bin/llvm-config --cxxflags
|
||||
OUTPUT_VARIABLE CLANG_DEFINITIONS
|
||||
)
|
||||
|
||||
|
||||
set(CLANG_LIBRARY_DIRS "$ENV{CLANG_DIR}/build/lib")
|
||||
if (UNIX)
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
set(CLANG_LIBRARY_DIRS "$ENV{CLANG_DIR}/build/Release+Asserts/lib")
|
||||
endif()
|
||||
endif ()
|
||||
set(CLANG_INCLUDE_DIRS
|
||||
"$ENV{CLANG_DIR}/llvm/tools/clang/include"
|
||||
"$ENV{CLANG_DIR}/build_debug/tools/clang/include"
|
||||
)
|
||||
|
||||
set(CLANG_LIBRARY_DIRS "$ENV{CLANG_DIR}/build_debug/lib")
|
||||
if (UNIX)
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
set(CLANG_LIBRARY_DIRS "$ENV{CLANG_DIR}/build_release/lib")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
else()
|
||||
|
||||
execute_process(
|
||||
COMMAND $ENV{CLANG_DIR}/build/bin/llvm-config --cxxflags
|
||||
OUTPUT_VARIABLE CLANG_DEFINITIONS
|
||||
)
|
||||
|
||||
set(CLANG_INCLUDE_DIRS
|
||||
"$ENV{CLANG_DIR}/llvm/tools/clang/include"
|
||||
"$ENV{CLANG_DIR}/build/tools/clang/include"
|
||||
)
|
||||
|
||||
set(CLANG_LIBRARY_DIRS "$ENV{CLANG_DIR}/build_debug/lib")
|
||||
if (UNIX)
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
set(CLANG_LIBRARY_DIRS "$ENV{CLANG_DIR}/build/Release+Asserts/lib")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
endif()
|
||||
|
||||
set(CLANG_LIBRARIES
|
||||
#clangApplyReplacements
|
||||
|
||||
@@ -15,12 +15,18 @@ add_files(
|
||||
qt/element/QtCodeFileList.h
|
||||
qt/element/QtCodeSnippet.cpp
|
||||
qt/element/QtCodeSnippet.h
|
||||
qt/element/QtDirectoryListBox.cpp
|
||||
qt/element/QtDirectoryListBox.h
|
||||
qt/element/QtMainWindow.cpp
|
||||
qt/element/QtMainWindow.h
|
||||
qt/element/QtProjectSetupScreen.cpp
|
||||
qt/element/QtProjectSetupScreen.h
|
||||
qt/element/QtRefreshBar.cpp
|
||||
qt/element/QtRefreshBar.h
|
||||
qt/element/QtSearchBar.cpp
|
||||
qt/element/QtSearchBar.h
|
||||
qt/element/QtSettingsWindow.cpp
|
||||
qt/element/QtSettingsWindow.h
|
||||
qt/element/QtSmartSearchBox.cpp
|
||||
qt/element/QtSmartSearchBox.h
|
||||
qt/element/QtSplashScreen.cpp
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
#include "qt/element/QtDirectoryListBox.h"
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include <QTreeView>
|
||||
#include <QFileDialog>
|
||||
#include <QLabel>
|
||||
#include <QMimeData>
|
||||
|
||||
#include "qt/utility/utilityQt.h"
|
||||
|
||||
QtDirectoryListBox::QtDirectoryListBox(QWidget *parent)
|
||||
:QFrame(parent)
|
||||
{
|
||||
setObjectName("QtListBox");
|
||||
setMinimumHeight(150);
|
||||
QBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setSpacing(0);
|
||||
layout->setContentsMargins(10, 10, 10, 10);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
m_list = new QListWidget(this);
|
||||
|
||||
setStyleSheet(utility::getStyleSheet("data/gui/settingwindows/listbox.css").c_str());
|
||||
layout->addWidget(m_list);
|
||||
|
||||
QWidget* buttonContainer = new QWidget(this);
|
||||
QBoxLayout* innerLayout = new QHBoxLayout();
|
||||
innerLayout->setContentsMargins(0,0,0,0);
|
||||
|
||||
m_addButton = new QPushButton("+",this);
|
||||
m_addButton->resize(20,20);
|
||||
m_addButton->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
m_addButton->setObjectName("roundedButton");
|
||||
innerLayout->addWidget(m_addButton);
|
||||
|
||||
m_removeButton = new QPushButton("-",this);
|
||||
m_removeButton->resize(20,20);
|
||||
m_removeButton->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
m_removeButton->setObjectName("roundedButton");
|
||||
innerLayout->addWidget(m_removeButton);
|
||||
|
||||
QLabel* dropInfoText = new QLabel("You can drop Folders here");
|
||||
dropInfoText->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||
dropInfoText->setObjectName("dropInfo");
|
||||
dropInfoText->setAlignment(Qt::AlignRight);
|
||||
innerLayout->addWidget(dropInfoText);
|
||||
buttonContainer->setLayout(innerLayout);
|
||||
layout->addWidget(buttonContainer);
|
||||
setLayout(layout);
|
||||
|
||||
connect(m_addButton, SIGNAL(clicked()), this, SLOT(addListBoxItem()));
|
||||
connect(m_removeButton, SIGNAL(clicked()), this, SLOT(removeListBoxItem()));
|
||||
|
||||
setAcceptDrops(true);
|
||||
}
|
||||
|
||||
void QtDirectoryListBox::dropEvent(QDropEvent *event)
|
||||
{
|
||||
QFileInfo fileInfo;
|
||||
foreach(QUrl url, event->mimeData()->urls())
|
||||
{
|
||||
fileInfo.setFile(url.toLocalFile());
|
||||
if(fileInfo.isDir())
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem(m_list);
|
||||
m_list->addItem(item);
|
||||
item->setText(url.toLocalFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<FilePath> QtDirectoryListBox::getList()
|
||||
{
|
||||
std::vector<FilePath> list;
|
||||
for( int i = 0; i < m_list->count(); ++i)
|
||||
{
|
||||
QListWidgetItem* item = m_list->item(i);
|
||||
list.push_back(item->text().toStdString());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void QtDirectoryListBox::addListBoxItem()
|
||||
{
|
||||
QFileDialog dialog(this);
|
||||
dialog.setFileMode(QFileDialog::DirectoryOnly);
|
||||
dialog.setOption(QFileDialog::ShowDirsOnly, true);
|
||||
dialog.setOption(QFileDialog::DontUseNativeDialog,true);
|
||||
|
||||
// enable multiselection of directories
|
||||
QListView *l = dialog.findChild<QListView*>("listView");
|
||||
if (l)
|
||||
{
|
||||
l->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||
}
|
||||
QTreeView *t = dialog.findChild<QTreeView*>();
|
||||
if (t)
|
||||
{
|
||||
t->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||
}
|
||||
|
||||
if(dialog.exec())
|
||||
{
|
||||
QStringList list = dialog.selectedFiles();
|
||||
for(int i = 0; i < list.size(); i++)
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem(m_list);
|
||||
m_list->addItem(item);
|
||||
item->setText(list.at(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QtDirectoryListBox::removeListBoxItem()
|
||||
{
|
||||
qDeleteAll(m_list->selectedItems());
|
||||
}
|
||||
|
||||
void QtDirectoryListBox::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
event->accept();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef QT_DIRECTORYLISTBOX_H
|
||||
#define QT_DIRECTORYLISTBOX_H
|
||||
|
||||
#include <QFrame>
|
||||
#include <QListWidget>
|
||||
#include <QPushButton>
|
||||
#include <QtGui/qevent.h>
|
||||
|
||||
#include "utility/file/FilePath.h"
|
||||
|
||||
class QtDirectoryListBox : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtDirectoryListBox(QWidget *parent);
|
||||
std::vector<FilePath> getList();
|
||||
protected:
|
||||
void dropEvent(QDropEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent* event);
|
||||
private:
|
||||
QPushButton* m_addButton;
|
||||
QPushButton* m_removeButton;
|
||||
QListWidget* m_list;
|
||||
|
||||
private slots:
|
||||
void addListBoxItem();
|
||||
void removeListBoxItem();
|
||||
};
|
||||
|
||||
#endif //QT_DIRECTORYLISTBOX_H
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "component/view/View.h"
|
||||
#include "component/view/CompositeView.h"
|
||||
#include "qt/element/QtStartScreen.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/messaging/type/MessageFind.h"
|
||||
@@ -31,6 +30,7 @@ QtMainWindow::QtMainWindow()
|
||||
setDockNestingEnabled(true);
|
||||
|
||||
setWindowIcon(QIcon("./data/gui/icon/logo_1024_1024.png"));
|
||||
setWindowFlags(Qt::Widget);
|
||||
|
||||
QApplication::setOverrideCursor(Qt::ArrowCursor);
|
||||
|
||||
@@ -44,13 +44,17 @@ QtMainWindow::QtMainWindow()
|
||||
// Need to call loadLayout here for right DockWidget size on Linux
|
||||
// Seconde call is in Application.cpp
|
||||
loadLayout();
|
||||
}
|
||||
|
||||
void QtMainWindow::init()
|
||||
{
|
||||
// StartScreen
|
||||
m_startScreen = std::make_shared<QtStartScreen>(this);
|
||||
m_startScreen->setWindowModality(Qt::WindowModal);
|
||||
m_startScreen->setup();
|
||||
m_startScreen->show();
|
||||
}
|
||||
|
||||
|
||||
QtMainWindow::~QtMainWindow()
|
||||
{
|
||||
}
|
||||
@@ -60,8 +64,8 @@ void QtMainWindow::addView(View* view)
|
||||
QDockWidget* dock = new QDockWidget(tr(view->getName().c_str()), this);
|
||||
dock->setWidget(QtViewWidgetWrapper::getWidgetOfView(view));
|
||||
dock->setObjectName(QString::fromStdString("Dock" + view->getName()));
|
||||
// dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
// dock->setTitleBarWidget(new QWidget());
|
||||
//dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
//dock->setTitleBarWidget(new QWidget());
|
||||
addDockWidget(Qt::TopDockWidgetArea, dock);
|
||||
m_dockWidgets.push_back(std::make_pair(view, dock));
|
||||
}
|
||||
@@ -149,12 +153,9 @@ void QtMainWindow::about()
|
||||
|
||||
void QtMainWindow::newProject()
|
||||
{
|
||||
QString sourceDir = QFileDialog::getExistingDirectory(this, tr("Open Directory"));
|
||||
|
||||
if (!sourceDir.isEmpty())
|
||||
{
|
||||
MessageLoadSource(sourceDir.toStdString()).dispatch();
|
||||
}
|
||||
m_newProjectDialog = std::make_shared<QtProjectSetupScreen>(this);
|
||||
m_newProjectDialog->setup();
|
||||
m_newProjectDialog->show();
|
||||
}
|
||||
|
||||
void QtMainWindow::openProject(const QString &path)
|
||||
@@ -241,7 +242,14 @@ void QtMainWindow::switchColorScheme()
|
||||
|
||||
void QtMainWindow::handleEscapeShortcut()
|
||||
{
|
||||
m_startScreen->hide();
|
||||
if(m_startScreen)
|
||||
{
|
||||
m_startScreen->hide();
|
||||
}
|
||||
if(m_newProjectDialog)
|
||||
{
|
||||
m_newProjectDialog->hide();
|
||||
}
|
||||
MessageInterruptTasks().dispatch();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <QtWidgets/QMainWindow>
|
||||
|
||||
#include "QtStartScreen.h"
|
||||
#include "QtProjectSetupScreen.h"
|
||||
|
||||
class QDockWidget;
|
||||
class View;
|
||||
@@ -21,6 +22,8 @@ public:
|
||||
QtMainWindow();
|
||||
~QtMainWindow();
|
||||
|
||||
void init();
|
||||
|
||||
void addView(View* view);
|
||||
void removeView(View* view);
|
||||
|
||||
@@ -62,6 +65,7 @@ private:
|
||||
QDockWidget* getDockWidgetForView(View* view) const;
|
||||
|
||||
std::shared_ptr<QtStartScreen> m_startScreen;
|
||||
std::shared_ptr<QtProjectSetupScreen> m_newProjectDialog;
|
||||
|
||||
std::vector<std::pair<View*, QDockWidget*>> m_dockWidgets;
|
||||
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
#include "qt/element/QtProjectSetupScreen.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QFileDialog>
|
||||
#include <QFormLayout>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
#include <QScrollArea>
|
||||
#include <QSysInfo>
|
||||
|
||||
|
||||
#include "settings/ProjectSettings.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "qt/utility/QtDeviceScaledPixmap.h"
|
||||
#include "utility/messaging/type/MessageLoadProject.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
|
||||
QtTextLine::QtTextLine(QWidget *parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
QBoxLayout* layout = new QHBoxLayout();
|
||||
layout->setSpacing(0);
|
||||
layout->setContentsMargins(1, 1, 1, 1);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
m_data = new QLineEdit(this);
|
||||
m_button = new QPushButton("...");
|
||||
m_button->setMaximumWidth(40);
|
||||
m_button->setObjectName("moreButton");
|
||||
layout->addWidget(m_data);
|
||||
layout->addWidget(m_button);
|
||||
|
||||
connect(m_button, SIGNAL(clicked()), this, SLOT(handleButtonPress()));
|
||||
}
|
||||
|
||||
QString QtTextLine::getText()
|
||||
{
|
||||
return m_data->text();
|
||||
}
|
||||
|
||||
void QtTextLine::setText(QString text)
|
||||
{
|
||||
m_data->setText(text);
|
||||
}
|
||||
|
||||
void QtTextLine::handleButtonPress()
|
||||
{
|
||||
QString file = QFileDialog::getExistingDirectory(this, tr("Select File"), "");
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
m_data->setText(file);
|
||||
}
|
||||
}
|
||||
|
||||
QtProjectSetupScreen::QtProjectSetupScreen(QWidget *parent)
|
||||
: QtSettingsWindow(parent)
|
||||
{
|
||||
raise();
|
||||
}
|
||||
|
||||
void QtProjectSetupScreen::setup()
|
||||
{
|
||||
setStyleSheet(utility::getStyleSheet("data/gui/settingwindows/projectsetup.css").c_str());
|
||||
QVBoxLayout* windowLayout = new QVBoxLayout();
|
||||
windowLayout->setContentsMargins(20,30,20,20);
|
||||
QLabel* windowTitleLabel = new QLabel("NEW PROJECT");
|
||||
windowLayout->addWidget(windowTitleLabel);
|
||||
windowLayout->addSpacing(30);
|
||||
|
||||
QScrollArea* scrollArea = new QScrollArea();
|
||||
scrollArea->setObjectName("coatiBackground");
|
||||
QWidget* form = new QWidget();
|
||||
form->setObjectName("form");
|
||||
scrollArea->setWidget(form);
|
||||
scrollArea->setFrameShadow(QFrame::Plain);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
QFormLayout *layout = new QFormLayout();
|
||||
layout->setContentsMargins(20,30,20,20);
|
||||
|
||||
//Background Image
|
||||
QPalette p = palette();
|
||||
QPixmap pixmap1("data/gui/startscreen/logo.png");
|
||||
QRect rect = scrollArea->rect();
|
||||
QSize size(rect.width()-90,rect.height());
|
||||
QPixmap pixmap(pixmap1.scaled(size));
|
||||
p.setBrush(QPalette::Background, pixmap);
|
||||
scrollArea->setPalette(p);
|
||||
|
||||
QLabel* nameLabel = new QLabel("Name");
|
||||
m_projectName = new QLineEdit();
|
||||
layout->addRow(nameLabel, m_projectName);
|
||||
|
||||
QLabel* locationLabel = new QLabel("Location");
|
||||
m_projectFileLocation = new QtTextLine(this);
|
||||
layout->addRow(locationLabel, m_projectFileLocation);
|
||||
|
||||
/*
|
||||
QLabel* languageLabel = new QLabel("Language");
|
||||
QComboBox* language = new QComboBox();
|
||||
language->insertItem(0, "C++");
|
||||
layout->addRow(languageLabel, language);
|
||||
*/
|
||||
|
||||
QLabel* sourcePathsLabel = new QLabel("Sourcepaths");
|
||||
m_sourcePaths = new QtDirectoryListBox(this);
|
||||
layout->addRow(sourcePathsLabel, m_sourcePaths);
|
||||
|
||||
QLabel* includePathsLabel = new QLabel("IncludePaths");
|
||||
m_includePaths = new QtDirectoryListBox(this);
|
||||
layout->addRow(includePathsLabel, m_includePaths);
|
||||
|
||||
if(QSysInfo::macVersion() != QSysInfo::MV_None)
|
||||
{
|
||||
QLabel* frameworkPathsLabel = new QLabel("FrameworkPaths");
|
||||
m_frameworkPaths = new QtDirectoryListBox(this);
|
||||
layout->addRow(frameworkPathsLabel, m_frameworkPaths);
|
||||
}
|
||||
form->setLayout(layout);
|
||||
|
||||
QPushButton* createButton = new QPushButton("Create");
|
||||
createButton->setObjectName("windowButton");
|
||||
QPushButton* cancelButton = new QPushButton("Cancel");
|
||||
cancelButton->setObjectName("windowButton");
|
||||
|
||||
connect(createButton, SIGNAL(clicked()), this, SLOT(handleCreateButtonPress()));
|
||||
connect(cancelButton, SIGNAL(clicked()), this, SLOT(handleCancelButtonPress()));
|
||||
|
||||
QHBoxLayout* buttons = new QHBoxLayout();
|
||||
buttons->addSpacing(100);
|
||||
buttons->addWidget(createButton);
|
||||
buttons->addWidget(cancelButton);
|
||||
buttons->addSpacing(30);
|
||||
|
||||
windowLayout->addWidget(scrollArea);
|
||||
windowLayout->addSpacing(20);
|
||||
windowLayout->addLayout(buttons);
|
||||
|
||||
m_window->setLayout(windowLayout);
|
||||
resize(QSize(600,600));
|
||||
}
|
||||
|
||||
void QtProjectSetupScreen::handleCancelButtonPress()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
void QtProjectSetupScreen::handleCreateButtonPress()
|
||||
{
|
||||
bool error = false;
|
||||
if(m_projectName->text().isEmpty())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Please Enter a Project Name");
|
||||
msgBox.exec();
|
||||
error = true;
|
||||
}
|
||||
if(m_projectFileLocation->getText().isEmpty())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Location for the ProjectFiles is empty");
|
||||
msgBox.exec();
|
||||
error = true;
|
||||
}
|
||||
|
||||
if(!error)
|
||||
{
|
||||
ProjectSettings::getInstance()->setSourcePaths(m_sourcePaths->getList());
|
||||
ProjectSettings::getInstance()->setHeaderSearchPaths(m_includePaths->getList());
|
||||
if(m_frameworkPaths)
|
||||
{
|
||||
ProjectSettings::getInstance()->setFrameworkSearchPaths(m_frameworkPaths->getList());
|
||||
}
|
||||
std::string projectFile =
|
||||
m_projectFileLocation->getText().toStdString() + "/" + m_projectName->text().toStdString() + ".xml";
|
||||
ProjectSettings::getInstance()->save(projectFile);
|
||||
MessageLoadProject(projectFile).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
QSize QtProjectSetupScreen::sizeHint() const
|
||||
{
|
||||
return QSize(600,600);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
#ifndef QTPROJECTSETUPSCREEN_H
|
||||
#define QTPROJECTSETUPSCREEN_H
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QListWidget>
|
||||
#include <QPushButton>
|
||||
#include <QWidget>
|
||||
|
||||
#include "QtSettingsWindow.h"
|
||||
|
||||
#include "qt/element/QtDirectoryListBox.h"
|
||||
#include "utility/file/FilePath.h"
|
||||
|
||||
class QtTextLine : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtTextLine(QWidget *parent);
|
||||
QString getText();
|
||||
void setText(QString text);
|
||||
private:
|
||||
QPushButton* m_button;
|
||||
QLineEdit* m_data;
|
||||
private slots:
|
||||
void handleButtonPress();
|
||||
};
|
||||
|
||||
class QtProjectSetupScreen : public QtSettingsWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtProjectSetupScreen(QWidget* parent = 0);
|
||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
||||
virtual void setup();
|
||||
private slots:
|
||||
void handleCreateButtonPress();
|
||||
void handleCancelButtonPress();
|
||||
|
||||
private:
|
||||
QLineEdit* m_projectName;
|
||||
QtDirectoryListBox *m_includePaths;
|
||||
QtDirectoryListBox *m_sourcePaths;
|
||||
QtDirectoryListBox *m_frameworkPaths;
|
||||
QtTextLine* m_projectFileLocation;
|
||||
std::vector<std::string> compilerFlags;
|
||||
std::vector<std::string> sourceExtensions;
|
||||
std::vector<std::string> headerExtensions;
|
||||
};
|
||||
|
||||
|
||||
#endif //QTPROJECTSETUPSCREEN_H
|
||||
@@ -0,0 +1,89 @@
|
||||
#include "qt/element/QtSettingsWindow.h"
|
||||
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
|
||||
#include "utility/messaging/type/MessageInterruptTasks.h"
|
||||
|
||||
QtSettingsWindow::QtSettingsWindow(QWidget *parent, int displacement)
|
||||
: QWidget(parent, Qt::Dialog | Qt::FramelessWindowHint )
|
||||
, m_mousePressedInWindow(false)
|
||||
{
|
||||
QSize windowSize = sizeHint();
|
||||
move(parent->pos().x()+parent->width()/2-250,parent->pos().y()+parent->height()/2-250);
|
||||
setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
m_displacment = displacement;
|
||||
m_window = new QWidget(this);
|
||||
windowSize.setHeight(windowSize.height()-displacement-10);
|
||||
windowSize.setWidth(windowSize.width()-10);
|
||||
m_window->move(0,displacement);
|
||||
//m_window->setFixedSize(windowSize);
|
||||
m_window->resize(windowSize);
|
||||
std::string frameStyle =
|
||||
"#SettingWindow {"
|
||||
"font-size: 17pt; "
|
||||
"border: 1px solid lightgray;"
|
||||
"border-radius: 15px; "
|
||||
"background: white; "
|
||||
"background-image: url(:/data/gui/icon/logo_1024_1024.png); "
|
||||
"}";
|
||||
m_window->setStyleSheet(frameStyle.c_str());
|
||||
m_window->setObjectName("SettingWindow");
|
||||
|
||||
// test with window shadow
|
||||
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
|
||||
effect->setBlurRadius(5);
|
||||
effect->setXOffset(2);
|
||||
effect->setYOffset(2);
|
||||
effect->setColor(Qt::darkGray);
|
||||
m_window->setGraphicsEffect(effect);
|
||||
|
||||
this->raise();
|
||||
}
|
||||
|
||||
void QtSettingsWindow::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if(event->key() == Qt::Key_Escape)
|
||||
{
|
||||
this->hide();
|
||||
}
|
||||
}
|
||||
|
||||
QSize QtSettingsWindow::sizeHint() const
|
||||
{
|
||||
return QSize(500, 500);
|
||||
}
|
||||
|
||||
void QtSettingsWindow::resizeEvent(QResizeEvent *event) {
|
||||
QSize windowSize = event->size()-QSize(10,10+m_displacment);
|
||||
m_window->resize(windowSize);
|
||||
m_window->move(0,m_displacment);
|
||||
}
|
||||
|
||||
void QtSettingsWindow::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->buttons() & Qt::LeftButton && m_mousePressedInWindow)
|
||||
{
|
||||
move(event->globalPos() - m_dragPosition);
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
||||
void QtSettingsWindow::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
m_dragPosition = event->globalPos() - frameGeometry().topLeft();
|
||||
event->accept();
|
||||
m_mousePressedInWindow = true;
|
||||
}
|
||||
}
|
||||
|
||||
void QtSettingsWindow::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
m_dragPosition = event->globalPos() - frameGeometry().topLeft();
|
||||
event->accept();
|
||||
m_mousePressedInWindow = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef QTSETTINGSWINDOW_H
|
||||
#define QTSETTINGSWINDOW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QResizeEvent>
|
||||
|
||||
class QtSettingsWindow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtSettingsWindow(QWidget* parent = 0, int displacement = 0);
|
||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
||||
virtual void setup() = 0;
|
||||
|
||||
protected:
|
||||
QWidget* m_window;
|
||||
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void resizeEvent(QResizeEvent* event);
|
||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
private:
|
||||
int m_displacment;
|
||||
QPoint m_dragPosition;
|
||||
bool m_mousePressedInWindow;
|
||||
//void mouse
|
||||
};
|
||||
|
||||
#endif //QTSETTINGSWINDOW_H
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "QtSplashScreen.h"
|
||||
#include "qt/element/QtSplashScreen.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QThread>
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
#include "QtStartScreen.h"
|
||||
#include "qt/element/QtStartScreen.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/messaging/type/MessageLoadProject.h"
|
||||
|
||||
#include "qt/utility/QtDeviceScaledPixmap.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
|
||||
QtRecentProjectButton::QtRecentProjectButton(const QString &text, QWidget *parent)
|
||||
: QPushButton(text, parent)
|
||||
{
|
||||
m_projectFile = text.toStdString();
|
||||
this->setText(FileSystem::fileName(text.toStdString()).c_str());
|
||||
this->setToolTip(m_projectFile.c_str());
|
||||
}
|
||||
|
||||
void QtRecentProjectButton::handleButtonClick()
|
||||
@@ -21,90 +26,61 @@ void QtRecentProjectButton::handleButtonClick()
|
||||
};
|
||||
|
||||
QtStartScreen::QtStartScreen(QWidget *parent)
|
||||
: QWidget(parent, Qt::Dialog | Qt::Popup | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint )
|
||||
: QtSettingsWindow(parent, 50)
|
||||
{
|
||||
setGeometry(parent->pos().x()+parent->width()/2-250,parent->pos().y()+parent->height()/2-250,500,500);
|
||||
this->raise();
|
||||
}
|
||||
|
||||
QPalette palette;
|
||||
QLinearGradient linearGradient(QPointF(0, 275), QPointF(0, 500));
|
||||
linearGradient.setColorAt(0, QColor(46, 61, 135));
|
||||
linearGradient.setColorAt(1, QColor(0, 120, 195));
|
||||
palette.setBrush(QPalette::Window, *(new QBrush(linearGradient)));
|
||||
this->setPalette(palette);
|
||||
|
||||
QtDeviceScaledPixmap coati_logo("data/gui/startscreen/logo_white.png");
|
||||
coati_logo.scaleToWidth(100);
|
||||
void QtStartScreen::setup()
|
||||
{
|
||||
setStyleSheet(utility::getStyleSheet("data/gui/startscreen/startscreen.css").c_str());
|
||||
std::vector<std::string> recentProjects = ApplicationSettings::getInstance()->getRecentProjects();
|
||||
|
||||
QtDeviceScaledPixmap coati_logo("data/gui/startscreen/logo_schriftzug.png");
|
||||
coati_logo.scaleToWidth(250);
|
||||
QLabel* coatiLogoLabel = new QLabel(this);
|
||||
coatiLogoLabel->setPixmap(coati_logo.pixmap());
|
||||
coatiLogoLabel->setGeometry(30, 30, coati_logo.width(), coati_logo.height());
|
||||
|
||||
std::string buttonStyle =
|
||||
"QPushButton {"
|
||||
"font-size: 17pt; "
|
||||
"border-radius: 10px; "
|
||||
"background: white; "
|
||||
"} "
|
||||
"QPushButton:hover {"
|
||||
"background: rgba(255, 255, 255, 0.8); "
|
||||
"}";
|
||||
coatiLogoLabel->resize(coati_logo.width(), coati_logo.height());
|
||||
coatiLogoLabel->move(30,10);
|
||||
|
||||
m_newProjectButton = new QPushButton("New Project", this);
|
||||
m_newProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_newProjectButton->setGeometry(30, 375, 140, 30);
|
||||
m_newProjectButton->setStyleSheet(buttonStyle.c_str());
|
||||
m_newProjectButton->setObjectName("projectButton");
|
||||
connect(m_newProjectButton, SIGNAL(clicked()), this, SLOT(handleNewProjectButton()));
|
||||
|
||||
m_openProjectButton = new QPushButton("Open Project", this);
|
||||
m_openProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_openProjectButton->setGeometry(30, 420, 140, 30);
|
||||
m_openProjectButton->setStyleSheet(buttonStyle.c_str());
|
||||
m_openProjectButton->setObjectName("projectButton");
|
||||
connect(m_openProjectButton, SIGNAL(clicked()), this, SLOT(handleOpenProjectButton()));
|
||||
|
||||
connect(this, SIGNAL(openOpenProjectDialog()), parent, SLOT(openProject()));
|
||||
connect(this, SIGNAL(openNewProjectDialog()), parent, SLOT(newProject()));
|
||||
connect(this, SIGNAL(openOpenProjectDialog()), parent(), SLOT(openProject()));
|
||||
connect(this, SIGNAL(openNewProjectDialog()), parent(), SLOT(newProject()));
|
||||
|
||||
QLabel* recentProjectsLabel = new QLabel("RECENT PROJECTS: ", this);
|
||||
recentProjectsLabel->setGeometry(300, 129, 300, 50);
|
||||
recentProjectsLabel->setStyleSheet(
|
||||
"QLabel {"
|
||||
"font-size: 16pt; "
|
||||
"color: white; "
|
||||
"}"
|
||||
);
|
||||
|
||||
std::vector<std::string> extensions;
|
||||
extensions.push_back(".xml");
|
||||
std::vector<std::string> recentProjects = FileSystem::getFileNamesFromDirectory("data/projects", extensions);
|
||||
recentProjectsLabel->setObjectName("recentLabel");
|
||||
|
||||
int position = 200;
|
||||
QIcon cpp_icon("data/gui/startscreen/cpluspluss_icon.png");
|
||||
QIcon cpp_icon("data/gui/startscreen/Icon_CPP.png");
|
||||
for (std::string project : recentProjects)
|
||||
{
|
||||
QtRecentProjectButton* button = new QtRecentProjectButton(project.c_str(), this);
|
||||
button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
button->setIcon(cpp_icon);
|
||||
button->setIconSize(QSize(25, 25));
|
||||
button->setStyleSheet(
|
||||
"QPushButton{"
|
||||
"font-size: 12pt; "
|
||||
// "text-align: left; " // when using this the QPixmap is drawn without regard of the screens DPI
|
||||
"color: white; "
|
||||
"background: none; "
|
||||
"border: none; "
|
||||
"} "
|
||||
"QPushButton:hover{"
|
||||
"background: rgba(255, 255, 255, 0.15); "
|
||||
"border-radius: 10px; "
|
||||
"}"
|
||||
);
|
||||
button->minimumSizeHint(); // force font loading
|
||||
button->setGeometry(292, position, button->fontMetrics().width(button->text()) + 45, 40);
|
||||
connect(button, SIGNAL(clicked()), button, SLOT(handleButtonClick()));
|
||||
position += 40;
|
||||
if(FileSystem::exists(project.c_str()))
|
||||
{
|
||||
QtRecentProjectButton* button = new QtRecentProjectButton(project.c_str(), this);
|
||||
button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
button->setIcon(cpp_icon);
|
||||
button->setIconSize(QSize(25, 25));
|
||||
button->setObjectName("recentButton");
|
||||
button->minimumSizeHint(); // force font loading
|
||||
button->setGeometry(292, position, button->fontMetrics().width(button->text()) + 45, 40);
|
||||
connect(button, SIGNAL(clicked()), button, SLOT(handleButtonClick()));
|
||||
position += 40;
|
||||
}
|
||||
}
|
||||
|
||||
this->raise();
|
||||
resize(600,500);
|
||||
}
|
||||
|
||||
QSize QtStartScreen::sizeHint() const
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#ifndef STARTSCREEN_H
|
||||
#define STARTSCREEN_H
|
||||
|
||||
#include <QFrame>
|
||||
#include <QWidget>
|
||||
#include <QtWidgets/qpushbutton.h>
|
||||
#include "QtSettingsWindow.h"
|
||||
|
||||
class QtRecentProjectButton : public QPushButton
|
||||
{
|
||||
@@ -16,13 +15,14 @@ private:
|
||||
std::string m_projectFile;
|
||||
};
|
||||
|
||||
class QtStartScreen : public QWidget
|
||||
class QtStartScreen : public QtSettingsWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtStartScreen(QWidget* parent = 0);
|
||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
||||
virtual void setup();
|
||||
|
||||
signals:
|
||||
void openOpenProjectDialog();
|
||||
|
||||
@@ -8,6 +8,7 @@ QtMainView::QtMainView()
|
||||
{
|
||||
m_window = std::make_shared<QtMainWindow>();
|
||||
m_window->show();
|
||||
m_window->init();
|
||||
}
|
||||
|
||||
QtMainView::~QtMainView()
|
||||
|
||||
+10
-1
@@ -61,9 +61,18 @@ void Application::loadProject(const std::string& projectSettingsFilePath)
|
||||
m_componentManager->refreshViews();
|
||||
|
||||
m_project = Project::create(m_storageCache.get());
|
||||
|
||||
m_project->loadProjectSettings(projectSettingsFilePath);
|
||||
m_project->parseCode();
|
||||
|
||||
std::vector<std::string> recentProjects = ApplicationSettings::getInstance()->getRecentProjects();
|
||||
recentProjects.erase(std::find(recentProjects.begin(),recentProjects.end(),projectSettingsFilePath));
|
||||
recentProjects.insert(recentProjects.begin(),projectSettingsFilePath);
|
||||
if(recentProjects.size() > 7)
|
||||
{
|
||||
recentProjects.pop_back();
|
||||
}
|
||||
ApplicationSettings::getInstance()->setRecentProjects(recentProjects);
|
||||
ApplicationSettings::getInstance()->save("data/ApplicationSettings.xml");
|
||||
}
|
||||
|
||||
void Application::loadSource(const std::string& sourceDirectoryPath)
|
||||
|
||||
@@ -100,3 +100,12 @@ void ApplicationSettings::setCodeSnippetExpandRange(int range)
|
||||
ApplicationSettings::ApplicationSettings()
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<std::string> ApplicationSettings::getRecentProjects() const {
|
||||
std::vector<std::string> recentProjects;
|
||||
return getValues("recentProjects/projectFilePath", recentProjects);
|
||||
}
|
||||
|
||||
bool ApplicationSettings::setRecentProjects(const std::vector<std::string> &recentProjects) {
|
||||
return setValues("recentProjects/projectFilePath", recentProjects);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,10 @@ public:
|
||||
std::string getColorSchemePath() const;
|
||||
void setColorSchemePath(const std::string& colorSchemePath);
|
||||
|
||||
//recent projects
|
||||
std::vector<std::string> getRecentProjects() const;
|
||||
bool setRecentProjects(const std::vector<std::string>& recentProjects);
|
||||
|
||||
// code
|
||||
int getCodeTabWidth() const;
|
||||
void setCodeTabWidth(int codeTabWidth);
|
||||
|
||||
@@ -78,3 +78,13 @@ std::vector<std::string> ProjectSettings::getSourceExtensions() const
|
||||
defaultValues.push_back(".cpp");
|
||||
return getValues("source/Extensions/SourceExtensions", defaultValues);
|
||||
}
|
||||
|
||||
bool ProjectSettings::setHeaderExtensions(const std::vector<std::string> &headerExtensions)
|
||||
{
|
||||
return setValues("source/Extensions/HeaderExtensions", headerExtensions);
|
||||
}
|
||||
|
||||
bool ProjectSettings::setSourceExtensions(const std::vector<std::string> &sourceExtensions)
|
||||
{
|
||||
return setValues("source/Extensions/SourceExtensions", sourceExtensions);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ public:
|
||||
std::vector<std::string> getHeaderExtensions() const;
|
||||
std::vector<std::string> getSourceExtensions() const;
|
||||
|
||||
bool setHeaderExtensions(const std::vector<std::string>& headerExtensions);
|
||||
bool setSourceExtensions(const std::vector<std::string>& sourceExtensions);
|
||||
|
||||
private:
|
||||
ProjectSettings();
|
||||
ProjectSettings(const ProjectSettings&);
|
||||
|
||||
Reference in New Issue
Block a user