diff --git a/bin/app/data/ApplicationSettings_template.xml b/bin/app/data/ApplicationSettings_template.xml index c6abeb0f..240ede3b 100644 --- a/bin/app/data/ApplicationSettings_template.xml +++ b/bin/app/data/ApplicationSettings_template.xml @@ -70,20 +70,20 @@ #F4BC3D - #6DA1BC - #3190BA + #7BB5D4 + #42A1D4 - #6DA1BC - #3190BA + #7BB5D4 + #42A1D4 #00000000 #00000000 - #6DA1BC - #3190BA + #7BB5D4 + #42A1D4 #F4D07D @@ -102,8 +102,8 @@ #ededed - #6DA1BC - #3190BA + #7BB5D4 + #42A1D4 #ededed diff --git a/bin/app/data/gui/refresh_view/images/auto_refresh.png b/bin/app/data/gui/refresh_view/images/auto_refresh.png old mode 100644 new mode 100755 index ae7bc7c4..0175bce0 Binary files a/bin/app/data/gui/refresh_view/images/auto_refresh.png and b/bin/app/data/gui/refresh_view/images/auto_refresh.png differ diff --git a/bin/app/data/gui/refresh_view/images/refresh.png b/bin/app/data/gui/refresh_view/images/refresh.png index f674bd4f..956c4b59 100755 Binary files a/bin/app/data/gui/refresh_view/images/refresh.png and b/bin/app/data/gui/refresh_view/images/refresh.png differ diff --git a/bin/app/data/gui/refresh_view/refresh_view.css b/bin/app/data/gui/refresh_view/refresh_view.css index 92b91c02..9210003c 100644 --- a/bin/app/data/gui/refresh_view/refresh_view.css +++ b/bin/app/data/gui/refresh_view/refresh_view.css @@ -5,7 +5,6 @@ QPushButton { background: #E0E0E0; border: none; - background-position: 15px 5px; height: 30px; width: 30px; } diff --git a/bin/app/data/gui/search_view/images/button_case_sensitive_active.png b/bin/app/data/gui/search_view/images/button_case_sensitive_active.png deleted file mode 100644 index 72212a67..00000000 Binary files a/bin/app/data/gui/search_view/images/button_case_sensitive_active.png and /dev/null differ diff --git a/bin/app/data/gui/search_view/images/button_case_sensitive_inactive.png b/bin/app/data/gui/search_view/images/button_case_sensitive_inactive.png deleted file mode 100644 index 02deccb4..00000000 Binary files a/bin/app/data/gui/search_view/images/button_case_sensitive_inactive.png and /dev/null differ diff --git a/bin/app/data/gui/search_view/images/button_search.png b/bin/app/data/gui/search_view/images/button_search.png deleted file mode 100644 index 21db3a21..00000000 Binary files a/bin/app/data/gui/search_view/images/button_search.png and /dev/null differ diff --git a/bin/app/data/gui/search_view/images/search.png b/bin/app/data/gui/search_view/images/search.png old mode 100644 new mode 100755 index ca7e7079..4ae4638c Binary files a/bin/app/data/gui/search_view/images/search.png and b/bin/app/data/gui/search_view/images/search.png differ diff --git a/bin/app/data/gui/startscreen/logo_white.png b/bin/app/data/gui/startscreen/logo_white.png index 6692fe78..00712bca 100644 Binary files a/bin/app/data/gui/startscreen/logo_white.png and b/bin/app/data/gui/startscreen/logo_white.png differ diff --git a/bin/app/data/gui/undoredo_view/images/arrow_left.png b/bin/app/data/gui/undoredo_view/images/arrow_left.png index acf2fca9..3df1439c 100755 Binary files a/bin/app/data/gui/undoredo_view/images/arrow_left.png and b/bin/app/data/gui/undoredo_view/images/arrow_left.png differ diff --git a/bin/app/data/gui/undoredo_view/images/arrow_right.png b/bin/app/data/gui/undoredo_view/images/arrow_right.png index 7a5e0a5a..0a80d5ce 100755 Binary files a/bin/app/data/gui/undoredo_view/images/arrow_right.png and b/bin/app/data/gui/undoredo_view/images/arrow_right.png differ diff --git a/src/app/main.cpp b/src/app/main.cpp index 8b243d95..ea0e4124 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -1,19 +1,16 @@ #include #include -#include -#include -#include -#include + +#include "utility/logging/ConsoleLogger.h" +#include "utility/logging/FileLogger.h" +#include "utility/logging/LogManager.h" #include "Application.h" #include "includes.h" // defines 'void setup(int argc, char *argv[])' #include "qt/element/QtSplashScreen.h" #include "qt/utility/utilityQt.h" #include "qt/view/QtViewFactory.h" -#include "utility/logging/ConsoleLogger.h" -#include "utility/logging/FileLogger.h" -#include "utility/logging/LogManager.h" void init() { @@ -28,56 +25,27 @@ void init() utility::loadFontsFromDirectory("data/fonts", ".otf"); } -class InitThread : public QThread -{ -public: - void run(void) - { - //min Time the Splash screen is displayed - QThread::msleep(500); - } -}; - int main(int argc, char *argv[]) { setup(argc, argv); QApplication qtApp(argc, argv); - QPixmap whitePixmap(500,500); + qtApp.setAttribute(Qt::AA_UseHighDpiPixmaps); + + QPixmap whitePixmap(500, 500); whitePixmap.fill(Qt::white); - QPixmap p; - p.load("data/gui/splash_white.png"); - QPixmap foreground = p.scaled(whitePixmap.size()*0.8); - p.load("data/gui/splash_blue.png"); - QPixmap background = p.scaled(whitePixmap.size()*0.9); - QtSplashScreen* splash = new QtSplashScreen(whitePixmap, Qt::WindowStaysOnTopHint); - qtApp.processEvents(); - splash->setForeground(foreground); - splash->setBackground(background); - - splash->show(); - splash->repaint(); - - qtApp.processEvents(); - if (splash) splash->message( "Starting GUI" ); - qtApp.processEvents(); + splash->setMessage("Loading UI"); + splash->setVersion("0.1"); + splash->exec(qtApp); init(); - // Eventloop for Splashscreen - QEventLoop loop; - InitThread* initThread = new InitThread(); - QObject::connect(initThread, SIGNAL(finished()), &loop, SLOT(quit())); - QObject::connect(initThread, SIGNAL(terminated()), &loop, SLOT(quit())); - initThread->start(); - loop.exec(); - QtViewFactory viewFactory; std::shared_ptr app = Application::create(&viewFactory); - if(splash) + if (splash) { delete splash; } diff --git a/src/app/qt/element/QtMainWindow.cpp b/src/app/qt/element/QtMainWindow.cpp index a88fd46d..ba43fca8 100644 --- a/src/app/qt/element/QtMainWindow.cpp +++ b/src/app/qt/element/QtMainWindow.cpp @@ -42,10 +42,10 @@ QtMainWindow::QtMainWindow() // Seconde call is in Application.cpp loadLayout(); - //startScreen - startScreen = std::make_shared(this); - startScreen->setWindowModality(Qt::WindowModal); - startScreen->show(); + // StartScreen + m_startScreen = std::make_shared(this); + m_startScreen->setWindowModality(Qt::WindowModal); + m_startScreen->show(); } QtMainWindow::~QtMainWindow() @@ -57,6 +57,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()); addDockWidget(Qt::TopDockWidgetArea, dock); m_dockWidgets.push_back(std::make_pair(view, dock)); } @@ -216,6 +218,7 @@ void QtMainWindow::redo() void QtMainWindow::handleEscapeShortcut() { + m_startScreen->hide(); MessageInterruptTasks().dispatch(); } diff --git a/src/app/qt/element/QtMainWindow.h b/src/app/qt/element/QtMainWindow.h index 7bb14556..f0e87ce6 100644 --- a/src/app/qt/element/QtMainWindow.h +++ b/src/app/qt/element/QtMainWindow.h @@ -56,7 +56,8 @@ private: void setupShortcuts(); QDockWidget* getDockWidgetForView(View* view) const; - std::shared_ptr startScreen; + + std::shared_ptr m_startScreen; std::vector> m_dockWidgets; diff --git a/src/app/qt/element/QtSmartSearchBox.cpp b/src/app/qt/element/QtSmartSearchBox.cpp index 2c0e1389..188620e5 100644 --- a/src/app/qt/element/QtSmartSearchBox.cpp +++ b/src/app/qt/element/QtSmartSearchBox.cpp @@ -781,7 +781,7 @@ void QtSmartSearchBox::updatePlaceholder() { if (!text().size() && !m_elements.size()) { - setPlaceholderText("Please enter your search string."); + setPlaceholderText("Search"); } else { diff --git a/src/app/qt/element/QtSplashScreen.cpp b/src/app/qt/element/QtSplashScreen.cpp index 80605192..563981df 100644 --- a/src/app/qt/element/QtSplashScreen.cpp +++ b/src/app/qt/element/QtSplashScreen.cpp @@ -1,63 +1,103 @@ #include "QtSplashScreen.h" +#include +#include #include -QtSplashScreen::QtSplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) : QSplashScreen (pixmap, f) +#include "qt/utility/QtDeviceScaledPixmap.h" + +namespace { - state = 0; - QTimer *timer = new QTimer( this ); - QObject::connect(timer, SIGNAL(timeout()), this, SLOT(animate())); - timer->start(150); - show(); - repaint(); + class InitThread : public QThread + { + public: + void run(void) + { + // Mininmum time the SplashScreen gets displayed. + QThread::msleep(5000); + } + }; +} + +QtSplashScreen::QtSplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) + : QSplashScreen(pixmap, f) + , m_state(0) +{ + QtDeviceScaledPixmap foreground("data/gui/splash_white.png"); + foreground.scaleToHeight(pixmap.size().height() * 0.8); + m_foreground = foreground.pixmap(); + + QtDeviceScaledPixmap background("data/gui/splash_blue.png"); + background.scaleToHeight(pixmap.size().height() * 0.9); + m_background = background.pixmap(); } QtSplashScreen::~QtSplashScreen() { } +void QtSplashScreen::exec(QApplication& app) +{ + m_state = 0; + QTimer* timer = new QTimer(this); + QObject::connect(timer, SIGNAL(timeout()), this, SLOT(animate())); + timer->start(150); + + app.processEvents(); + + show(); + repaint(); + + app.processEvents(); + + // Eventloop for the SplashScreen + // QEventLoop loop; + // InitThread* initThread = new InitThread(); + // QObject::connect(initThread, SIGNAL(finished()), &loop, SLOT(quit())); + // initThread->start(); + // loop.exec(); +} + +void QtSplashScreen::setMessage(const QString &str) +{ + m_string = str; + repaint(); +} + +void QtSplashScreen::setVersion(const QString &str) +{ + m_version = str; + repaint(); +} + void QtSplashScreen::animate() { - state = (state+2)%120; - repaint(); -} - -void QtSplashScreen::setBackground(QPixmap& pixmap) -{ - m_Background = pixmap; -} - -void QtSplashScreen::setForeground(QPixmap &pixmap) -{ - m_Foreground = pixmap; -} - -void QtSplashScreen::message(const QString &str, int flag, const QColor &color) -{ - QSplashScreen::showMessage(str,flag,color); - animate(); - m_string = str; + m_state = (m_state + 2) % 120; + repaint(); } void QtSplashScreen::drawContents(QPainter *painter) { - painter->save(); - painter->translate(rect().width()/2,rect().height()/2); - painter->rotate(state*3); - painter->drawPixmap(-rect().width()*0.9/2,-rect().height()*0.9/2,m_Background); - painter->restore(); - painter->drawPixmap(rect().width()*0.1,rect().height()*0.1,m_Foreground); + painter->save(); + painter->translate(rect().width() / 2, rect().height() / 2); + painter->rotate(m_state * 3); + painter->drawPixmap(-rect().width() * 0.9 / 2, -rect().height() * 0.9 / 2, m_background); + painter->restore(); + painter->drawPixmap(rect().width() * 0.1, rect().height() * 0.1, m_foreground); - painter->setPen(QColor(74,112,18)); - QRect r = rect(); - r.setRect(r.x() + 5, r.y() + 5, r.width() - 10, r.height() - 10); + QRect r = rect(); + r.setRect(r.x() + 5, r.height() - 20, r.width() - 10, 20); - // TODO: automated Version number - painter->drawText(r, Qt::AlignRight, "Version 0.0.0"); + // TODO: automated Version number + painter->drawText(r, Qt::AlignRight, QString("Coati v").append(m_version)); - // Draw message at given position, limited to 43 chars - // If message is too long, string is truncated - if (m_string.length() > 40) {m_string.truncate(39); m_string += "...";} - painter->drawText(90, 16,m_string); + // Draw message at given position, limited to 43 chars + // If message is too long, string is truncated + if (m_string.length() > 40) + { + m_string.truncate(39); + m_string += "..."; + } + + painter->drawText(r, Qt::AlignLeft, m_string); } - diff --git a/src/app/qt/element/QtSplashScreen.h b/src/app/qt/element/QtSplashScreen.h index 65d454ab..7748ed7a 100644 --- a/src/app/qt/element/QtSplashScreen.h +++ b/src/app/qt/element/QtSplashScreen.h @@ -5,30 +5,35 @@ #include #include +class QApplication; class QPixmap; -class QtSplashScreen : public QSplashScreen +class QtSplashScreen + : public QSplashScreen { - Q_OBJECT + Q_OBJECT public: - QtSplashScreen(const QPixmap& pixmap, Qt::WindowFlags f = 0); - QtSplashScreen(Qt::WindowFlags f = 0); - virtual ~QtSplashScreen(); - void setBackground(QPixmap& pixmap); - void setForeground(QPixmap& pixmap); -protected: - void drawContents(QPainter* painter); + QtSplashScreen(const QPixmap& pixmap, Qt::WindowFlags f = 0); + virtual ~QtSplashScreen(); + + void exec(QApplication& app); + void setMessage(const QString& str); + void setVersion(const QString& str); public slots: - void animate(); - void message(const QString& str, int flag = Qt::AlignLeft, const QColor& color = Qt::black); + void animate(); private: - QString m_string; - int state; - QPixmap m_Background; - QPixmap m_Foreground; + void drawContents(QPainter* painter); + + int m_state; + + QString m_string; + QString m_version; + + QPixmap m_background; + QPixmap m_foreground; }; #endif //QTSPLASHSCREEN_H diff --git a/src/app/qt/element/QtStartScreen.cpp b/src/app/qt/element/QtStartScreen.cpp index dc53918c..6ef6eb69 100644 --- a/src/app/qt/element/QtStartScreen.cpp +++ b/src/app/qt/element/QtStartScreen.cpp @@ -1,17 +1,17 @@ -#include #include "QtStartScreen.h" -#include -#include +#include #include "utility/file/FileSystem.h" #include "utility/messaging/type/MessageLoadProject.h" +#include "qt/utility/QtDeviceScaledPixmap.h" + QtRecentProjectButton::QtRecentProjectButton(const QString &text, QWidget *parent) : QPushButton(text, parent) { m_projectFile = text.toStdString(); - this->setText(FileSystem::fileName(FileSystem::filePathWithoutExtension(text.toStdString())).c_str()); + this->setText(FileSystem::fileName(text.toStdString()).c_str()); } void QtRecentProjectButton::handleButtonClick() @@ -23,37 +23,41 @@ void QtRecentProjectButton::handleButtonClick() QtStartScreen::QtStartScreen(QWidget *parent) : QWidget(parent, Qt::Dialog | Qt::Popup | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint ) { - setGeometry(parent->pos().x()+parent->width()/2-350,parent->pos().y()+parent->height()/2-250,600,500); + setGeometry(parent->pos().x()+parent->width()/2-250,parent->pos().y()+parent->height()/2-250,500,500); QPalette palette; - QLinearGradient linearGradient(QPointF(0, 0), QPointF(0, 500)); - linearGradient.setColorAt(0, QColor(46,61,135)); - linearGradient.setColorAt(1, QColor(0,120,195)); - palette.setBrush(QPalette::Window,*(new QBrush(linearGradient))); + 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); - //QPixmap coati_logo("data/gui/logo_coati.png"); - QPixmap coati_logo("data/gui/startscreen/logo_white.png"); - QPixmap cpp_icon("data/gui/startscreen/cpluspluss_icon.png"); + QtDeviceScaledPixmap coati_logo("data/gui/startscreen/logo_white.png"); + coati_logo.scaleToWidth(100); QLabel* coatiLogoLabel = new QLabel(this); - coatiLogoLabel->setPixmap(coati_logo); - coatiLogoLabel->setGeometry(30,30,100,138); + coatiLogoLabel->setPixmap(coati_logo.pixmap()); + coatiLogoLabel->setGeometry(30, 30, coati_logo.width(), coati_logo.height()); std::string buttonStyle = - "QPushButton{font-family: " - "Source Code Pro; " - "font-size: 17pt; " - "border-radius: 15px; " - "background: white} " - "QPushButton:hover {background:lightgrey;}"; + "QPushButton {" + "font-size: 17pt; " + "border-radius: 10px; " + "background: white; " + "} " + "QPushButton:hover {" + "background: rgba(255, 255, 255, 0.8); " + "}"; m_newProjectButton = new QPushButton("New Project", this); - m_newProjectButton->setGeometry(20,350, 200, 50); + m_newProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac + m_newProjectButton->setGeometry(30, 375, 140, 30); m_newProjectButton->setStyleSheet(buttonStyle.c_str()); connect(m_newProjectButton, SIGNAL(clicked()), this, SLOT(handleNewProjectButton())); + m_openProjectButton = new QPushButton("Open Project", this); - m_openProjectButton->setGeometry(20,420, 200, 50); + m_openProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac + m_openProjectButton->setGeometry(30, 420, 140, 30); m_openProjectButton->setStyleSheet(buttonStyle.c_str()); connect(m_openProjectButton, SIGNAL(clicked()), this, SLOT(handleOpenProjectButton())); @@ -61,47 +65,51 @@ QtStartScreen::QtStartScreen(QWidget *parent) connect(this, SIGNAL(openNewProjectDialog()), parent, SLOT(newProject())); QLabel* recentProjectsLabel = new QLabel("RECENT PROJECTS: ", this); - QFont font("Helvetica", 20); - recentProjectsLabel->setFont(font); - recentProjectsLabel->setStyleSheet("QLabel{font-family: Source Code Pro; font-size: 20pt; color: white;}"); - recentProjectsLabel->setGeometry(250, 100, 300, 50); + recentProjectsLabel->setGeometry(300, 129, 300, 50); + recentProjectsLabel->setStyleSheet( + "QLabel {" + "font-size: 16pt; " + "color: white; " + "}" + ); std::vector extensions; extensions.push_back(".xml"); std::vector recentProjects = FileSystem::getFileNamesFromDirectory("data/projects", extensions); - int position = 150; - for(std::string project : recentProjects) + int position = 200; + QIcon cpp_icon("data/gui/startscreen/cpluspluss_icon.png"); + for (std::string project : recentProjects) { QtRecentProjectButton* button = new QtRecentProjectButton(project.c_str(), this); - button->setGeometry(250, position, 400, 40); + button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac button->setIcon(cpp_icon); - button->setIconSize(QSize(40,40)); + button->setIconSize(QSize(25, 25)); button->setStyleSheet( - "QPushButton{" - "font-family: Source Code Pro; " - "font-size: 12pt; " - "Text-align:left; " - "color: white; " - "background:none; " - "border:none;} " - "QPushButton:hover{color:lightgrey;}"); + "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 +=50; + position += 40; } this->raise(); - } QSize QtStartScreen::sizeHint() const { - return QSize(500,500); -} - -void QtStartScreen::paintEvent(QPaintEvent *event) -{ - QPainter* painter = new QPainter(this); + return QSize(500, 500); } void QtStartScreen::handleNewProjectButton() diff --git a/src/app/qt/element/QtStartScreen.h b/src/app/qt/element/QtStartScreen.h index 0ab499bc..c3422405 100644 --- a/src/app/qt/element/QtStartScreen.h +++ b/src/app/qt/element/QtStartScreen.h @@ -5,7 +5,6 @@ #include #include - class QtRecentProjectButton : public QPushButton { Q_OBJECT @@ -25,8 +24,6 @@ public: QtStartScreen(QWidget* parent = 0); QSize sizeHint() const Q_DECL_OVERRIDE; - void paintEvent(QPaintEvent* event); - signals: void openOpenProjectDialog(); void openNewProjectDialog(); @@ -40,5 +37,4 @@ private: std::vector m_recentProjects; }; - #endif //STARTSCREEN_H diff --git a/src/app/qt/utility/QtDeviceScaledPixmap.h b/src/app/qt/utility/QtDeviceScaledPixmap.h index bd20f101..935475a1 100644 --- a/src/app/qt/utility/QtDeviceScaledPixmap.h +++ b/src/app/qt/utility/QtDeviceScaledPixmap.h @@ -36,6 +36,12 @@ public: return m_pixmap.height() / devicePixelRatio(); } + void scaleToWidth(int width) + { + m_pixmap = m_pixmap.scaledToWidth(width * devicePixelRatio(), Qt::SmoothTransformation); + m_pixmap.setDevicePixelRatio(devicePixelRatio()); + } + void scaleToHeight(int height) { m_pixmap = m_pixmap.scaledToHeight(height * devicePixelRatio(), Qt::SmoothTransformation); diff --git a/src/app/qt/view/QtCompositeView.cpp b/src/app/qt/view/QtCompositeView.cpp index 51444f97..239a821b 100644 --- a/src/app/qt/view/QtCompositeView.cpp +++ b/src/app/qt/view/QtCompositeView.cpp @@ -19,7 +19,7 @@ QtCompositeView::QtCompositeView(ViewLayout* viewLayout, CompositeDirection dire } layout->setSpacing(5); - layout->setContentsMargins(5, 5, 5, 5); + layout->setContentsMargins(8, 8, 8, 8); layout->setAlignment(Qt::AlignTop); m_widget = new QWidget();