Commit a834ef1f authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

Merge branch 'release/2.9.1'

parents f3fdaf75 47f7c09e
# ChangeLog
## version 2.9.1 - 2019-05-02
- call enter/leave method when entering/leaving workspaces
- deactivate unused fileMenu and AboutMenu. Move ThemeMenu in a sub-menu
- menubar fixed for HighDpi
## version 2.9.0 - 2019-04-29
- add dtkWidgetsParameterLongLongSpinBox
- use dtk-themes
......
......@@ -24,7 +24,7 @@ project(dtkWidgets)
set(${PROJECT_NAME}_VERSION_MAJOR 2)
set(${PROJECT_NAME}_VERSION_MINOR 9)
set(${PROJECT_NAME}_VERSION_PATCH 0)
set(${PROJECT_NAME}_VERSION_PATCH 1)
set(${PROJECT_NAME}_VERSION
${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
......
......@@ -21,8 +21,6 @@ dtkApplication::dtkApplication(int& argc, char **argv): QApplication(argc, argv)
{
d = new dtkApplicationPrivate;
d->setApplication(this);
this->setAttribute(Qt::AA_EnableHighDpiScaling);
}
dtkApplication::~dtkApplication(void)
......@@ -49,6 +47,8 @@ bool dtkApplication::noGui(void)
dtkApplication *dtkApplication::create(int& argc, char *argv[])
{
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
for (int i = 0; i < argc; i++)
if(!qstrcmp(argv[i], "-nw") || !qstrcmp(argv[i], "--nw") || !qstrcmp(argv[i], "-no-window") || !qstrcmp(argv[i], "--no-window") || !qstrcmp(argv[i], "-h") || !qstrcmp(argv[i], "--help") || !qstrcmp(argv[i], "--version"))
qputenv("QT_QPA_PLATFORM", QByteArrayLiteral("minimal"));
......
......@@ -58,9 +58,9 @@ void dtkWidgetsMainWindow::populate(void)
{
Q_UNUSED(this->menubar());
Q_UNUSED(this->populateFileMenu());
//Q_UNUSED(this->populateFileMenu());
Q_UNUSED(this->populateThemesMenu());
Q_UNUSED(this->populateAboutMenu());
//Q_UNUSED(this->populateAboutMenu());
}
dtkWidgetsMenu *dtkWidgetsMainWindow::populateFileMenu(void)
......@@ -81,9 +81,9 @@ dtkWidgetsMenu *dtkWidgetsMainWindow::populateThemesMenu(void)
if(!d->menu_themes) {
d->menu_themes = d->menubar->addMenu(fa::paintbrush, "Themes");
auto *inner_menu_theme = d->menu_themes->addMenu(fa::paintbrush, "Choose Theme");
for (const QString theme : dtkThemesEngine::instance()->themes()) {
connect(static_cast<dtkWidgetsMenuItem *>(d->menu_themes->addItem(new dtkWidgetsMenuItemTheme(theme))), &dtkWidgetsMenuItem::clicked, [=] (void) -> void {
connect(static_cast<dtkWidgetsMenuItem *>(inner_menu_theme->addItem(new dtkWidgetsMenuItemTheme(theme))), &dtkWidgetsMenuItem::clicked, [=] (void) -> void {
dtkThemesEngine::instance()->apply(theme);
});
}
......
......@@ -198,6 +198,7 @@ public:
QList<QColor> colors;
QList<QMenu *> submenus;
QStringList workspaces;
dtkWidgetsWorkspace *current_workspace = nullptr;
};
void dtkWidgetsWorkspaceBarPrivate::createWorkspace(const QColor & color, const QString& name, bool display_destroy)
......@@ -240,6 +241,12 @@ void dtkWidgetsWorkspaceBarPrivate::onItemClicked(int index)
q->emit indexChanged(index);
this->stack->setCurrentIndex(index);
dtkWidgetsWorkspace *workspace = dynamic_cast<dtkWidgetsWorkspace*>(this->stack->currentWidget());
if (workspace != this->current_workspace) {
this->current_workspace->leave();
this->current_workspace = workspace;
this->current_workspace->enter();
}
for (dtkWidgetsWorkspaceBarItem *item : items) {
int current_index = items.indexOf(item);
......@@ -357,6 +364,10 @@ void dtkWidgetsWorkspaceBar::createWorkspace(const QString &name, const QString&
d->stack->addWidget(workspace);
d->stack->setCurrentWidget(workspace);
if (d->current_workspace)
d->current_workspace->leave();
workspace->enter();
d->current_workspace = workspace;
}
dtkWidgetsWorkspaceBar::~dtkWidgetsWorkspaceBar(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment