Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit a3cf5055 authored by LACROIX Romain's avatar LACROIX Romain
Browse files

Merge branch 'release/2.24.0'

parents 367c91ae 4fcc3836
Pipeline #173693 failed with stage
in 0 seconds
# ChangeLog
## version 2.23.1 - 2020-05-28
## version 2.24.0 - 2020-10-01
- display doc and path in the tooltip, according if both, either one or none is available
- save button can be defined as read-only
- support multiple menubars: bugfix #67
- support multiple menubars: bugfix #68
## version 2.23.1 - 2020-05-28
- fix workspace: we must leave previous workspace before creating a new one
- apply theme in workspaceBar (also raise font size of popup menu) and dtkWidgetsHUDInfo
## version 2.23.0 - 2020-04-30
......
......@@ -23,8 +23,8 @@ project(dtkWidgets)
## ###################################################################
set(${PROJECT_NAME}_VERSION_MAJOR 2)
set(${PROJECT_NAME}_VERSION_MINOR 23)
set(${PROJECT_NAME}_VERSION_PATCH 1)
set(${PROJECT_NAME}_VERSION_MINOR 24)
set(${PROJECT_NAME}_VERSION_PATCH 0)
set(${PROJECT_NAME}_VERSION
${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
......
......@@ -91,6 +91,8 @@ set(${PROJECT_NAME}_HEADERS
dtkWidgetsParameterBoolCheckBox.h
dtkWidgetsParameterBoolPushButton
dtkWidgetsParameterBoolPushButton.h
dtkWidgetsParameterBrowse
dtkWidgetsParameterBrowse.h
dtkWidgetsParameterDirBrowse
dtkWidgetsParameterDirBrowse.h
dtkWidgetsParameterDoubleSlider
......@@ -165,6 +167,7 @@ set(${PROJECT_NAME}_SOURCES
dtkWidgetsParameter.cpp
dtkWidgetsParameterBoolCheckBox.cpp
dtkWidgetsParameterBoolPushButton.cpp
dtkWidgetsParameterBrowse.cpp
dtkWidgetsParameterDirBrowse.cpp
dtkWidgetsParameterDoubleSlider.cpp
dtkWidgetsParameterDoubleSpinBox.cpp
......
......@@ -398,8 +398,6 @@ void dtkWidgetsMenuBarContainerSlide::touch(const QVector<dtkWidgetsMenu *>& men
// dtkWidgetsMenuBarContainer implementation
// ///////////////////////////////////////////////////////////////////
QList<dtkWidgetsMenu *> stack;
dtkWidgetsMenuBarContainer::dtkWidgetsMenuBarContainer(QWidget *parent) : dtkWidgetsOverlayPane(parent)
{
this->slider = new dtkWidgetsOverlayPaneSlider;
......@@ -418,8 +416,8 @@ dtkWidgetsMenuBarContainer::dtkWidgetsMenuBarContainer(QWidget *parent) : dtkWid
return;
dtkWidgetsMenu *menu = nullptr;
if (::stack.count())
menu = ::stack.takeLast();
if (this->stack.count())
menu = this->stack.takeLast();
this->switchToPrevSlide(menu);
});
......@@ -430,6 +428,11 @@ dtkWidgetsMenuBarContainer::~dtkWidgetsMenuBarContainer(void)
}
int dtkWidgetsMenuBarContainer::stackCount(void) const
{
return stack.count();
}
void dtkWidgetsMenuBarContainer::setCurrentIndex(int index, std::function<void ()>& callback)
{
if (this->slider->is_in_transition)
......@@ -450,7 +453,7 @@ void dtkWidgetsMenuBarContainer::setCurrentIndex(int index, std::function<void (
this->slider->setCurrentIndex(index, ca);
};
if (::stack.count())
if (this->stack.count())
this->switchToRoot(cb);
else
cb();
......@@ -466,10 +469,10 @@ void dtkWidgetsMenuBarContainer::switchToRoot(std::function<void(void)> &callbac
this->slider->enableSpying(false);
this->slider->blockSignals(true);
static std::function<void(void)> cb = [=](void) -> void
std::function<void(void)> cb = [=](void) -> void
{
while (!::stack.isEmpty())
this->slider->remSlide(this->slides[::stack.takeLast()]);
while (!this->stack.isEmpty())
this->slider->remSlide(this->slides[this->stack.takeLast()]);
callback();
......@@ -488,8 +491,8 @@ void dtkWidgetsMenuBarContainer::switchToPrevSlide(dtkWidgetsMenu *m)
if (m)
emit q->left(m);
if (::stack.count())
this->navigator->setMenu(::stack.last());
if (this->stack.count())
this->navigator->setMenu(this->stack.last());
else
this->navigator->setMenu(0);
......@@ -506,8 +509,8 @@ void dtkWidgetsMenuBarContainer::switchToPrevSlide(dtkWidgetsMenu *m)
this->slider->slideToPrevious(callback);
}
if(::stack.count())
emit q->entered(::stack.last());
if(this->stack.count())
emit q->entered(this->stack.last());
}
void dtkWidgetsMenuBarContainer::switchToNextSlide(dtkWidgetsMenu *m)
......@@ -515,15 +518,15 @@ void dtkWidgetsMenuBarContainer::switchToNextSlide(dtkWidgetsMenu *m)
if (this->slider->is_in_transition)
return;
if(::stack.count())
emit q->left(::stack.last());
if(this->stack.count())
emit q->left(this->stack.last());
this->slider->addSlide(fa::cogs, this->slides[m]);
this->slider->slideToNext();
this->navigator->setMenu(m);
::stack << m;
this->stack << m;
emit q->entered(m);
}
......@@ -533,7 +536,7 @@ void dtkWidgetsMenuBarContainer::touch(void)
if (this->slider->is_in_transition)
return;
::stack.clear();
this->stack.clear();
navigator->setMenu(0);
this->master_slide->touch(this->master_menus, this);
}
......@@ -543,7 +546,7 @@ void dtkWidgetsMenuBarContainer::touch(dtkWidgetsMenuBar *mb)
if (this->slider->is_in_transition)
return;
::stack.clear();
this->stack.clear();
navigator->setMenu(0);
if(!this->master_slide) {
......@@ -576,7 +579,7 @@ void dtkWidgetsMenuBarContainer::decr(void)
this->slider->decr();
::stack.takeLast();
this->stack.takeLast();
}
void dtkWidgetsMenuBarContainer::build(const QVector<dtkWidgetsMenu *>& menus)
......@@ -1123,7 +1126,7 @@ QDebug operator<<(QDebug debug, const dtkWidgetsMenuBar &c)
{
debug << "MenuBar state in ";
debug << "d->layout->count() = " << c.d->layout->count();
debug << "::stack.count() = " << ::stack.count();
debug << "d->c->stackCount() = " << c.d->c->stackCount();
//c.d->c->slider->print();
return debug;
}
......@@ -1132,7 +1135,7 @@ QDebug operator<<(QDebug debug, dtkWidgetsMenuBar *c)
{
debug << "MenuBar state in ";
debug << "d->layout->count() = " << c->d->layout->count();
debug << "::stack.count() = " << ::stack.count();
debug << "d->c->stackCount() = " << c->d->c->stackCount();
//c->d->c->slider->print();
return debug;
}
......
......@@ -83,11 +83,13 @@ public:
public:
QVector<dtkWidgetsMenu *> master_menus;
int stackCount(void) const;
// /////////////////////////////////////////////////////////////////////////////
private:
friend class dtkWidgetsMenuBarButton;
QList<dtkWidgetsMenu *> stack;
};
// ///////////////////////////////////////////////////////////////////
......
#include "dtkWidgetsParameterBrowse.h"
\ No newline at end of file
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#include "dtkWidgetsParameterBrowse.h"
#include <QtWidgets>
#include <QStringBuilder>
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsParameterBrowsePrivate declaration
// ///////////////////////////////////////////////////////////////////
class dtkWidgetsParameterBrowsePrivate
{
public:
QPushButton *push_button = nullptr;
public:
void setToolTip(const QString& doc, const QString& path)
{
QString tooltip;
if (!doc.isEmpty()) {
tooltip += QString("Doc: %1").arg(doc);
}
if (!path.isEmpty()) {
if (!tooltip.isEmpty()) {
tooltip += "\n";
}
tooltip += QString("Path: %1").arg(path);
}
push_button->setToolTip( tooltip );
}
};
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsParameterBrowse implementation
// ///////////////////////////////////////////////////////////////////
dtkWidgetsParameterBrowse::dtkWidgetsParameterBrowse(QWidget* parent) : dtkWidgetsParameterBase<dtk::d_path>(parent), d(new dtkWidgetsParameterBrowsePrivate)
{
d->push_button = new QPushButton;
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(d->push_button);
this->setLayout(layout);
}
dtkWidgetsParameterBrowse::~dtkWidgetsParameterBrowse(void)
{
delete d;
}
void dtkWidgetsParameterBrowse::setReadOnly(bool val)
{
this->dtkWidgetsParameter::m_readonly = val;
d->push_button->setEnabled(!this->dtkWidgetsParameter::m_readonly);
d->push_button->setFocusPolicy((this->dtkWidgetsParameter::m_readonly? Qt::NoFocus : Qt::WheelFocus));
}
bool dtkWidgetsParameterBrowse::connect(dtkCoreParameter *p)
{
if (!p) {
qWarning() << Q_FUNC_INFO << "The input parameter is null. Nothing is done.";
return false;
}
m_parameter = dynamic_cast<dtk::d_path *>(p);
if(!m_parameter) {
qWarning() << Q_FUNC_INFO << "The type of the parameter is not compatible with the widget dtkWidgetsParameterBrowse.";
return false;
}
QString text = "Browse";
QString base_name = m_parameter->baseName();
if(!base_name.isEmpty()) {
text = base_name;
}
d->push_button->setText(text);
d->setToolTip( m_parameter->documentation(), m_parameter->path() );
m_parameter->connect([=] (QVariant v) {
d->push_button->blockSignals(true);
QString value = v.value<dtk::d_path>().baseName();
if (value.isEmpty()) {
value = "Browse";
}
d->push_button->setText(value);
d->push_button->blockSignals(false);
QString tip = v.value<dtk::d_path>().path();
if(!tip.isEmpty()) {
d->setToolTip( m_parameter->documentation(), tip );
}
});
QObject::connect(d->push_button, &QPushButton::clicked, [=] ()
{
QString v = QFileDialog::getOpenFileName(this, "Open file", m_parameter->dirName(), m_parameter->filters().join(";;"));
m_parameter->shareValue(QVariant::fromValue(v));
});
return true;
}
//
// dtkWidgetsParameterBrowse.cpp ends here
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#pragma once
#include <dtkWidgetsExport>
#include "dtkWidgetsParameter.h"
#include <dtkCore/dtkCoreParameter>
#include <dtkCore/dtkCoreParameterPath>
class DTKWIDGETS_EXPORT dtkWidgetsParameterBrowse : public dtkWidgetsParameterBase<dtk::d_path>
{
Q_OBJECT
public:
dtkWidgetsParameterBrowse(QWidget* parent = nullptr);
~dtkWidgetsParameterBrowse(void);
public:
bool connect(dtkCoreParameter *) override;
void setReadOnly(bool) override;
protected:
virtual QString browse(void) = 0;
protected:
using dtkWidgetsParameterBase<dtk::d_path>::m_parameter;
private:
class dtkWidgetsParameterBrowsePrivate *d;
};
//
// dtkWidgetsParameterBrowse.h ends here
//
// dtkWidgetsParameterDirBrowse.cpp ends here
// Version: $Id$
//
//
......@@ -16,68 +18,11 @@
#include <QtWidgets>
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsParameterDirBrowsePrivate declaration
// ///////////////////////////////////////////////////////////////////
class dtkWidgetsParameterDirBrowsePrivate
{
public:
QPushButton *push_button = nullptr;
};
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsParameterDirBrowse implementation
// ///////////////////////////////////////////////////////////////////
dtkWidgetsParameterDirBrowse::dtkWidgetsParameterDirBrowse(QWidget* parent) : dtkWidgetsParameterBase<dtk::d_path>(parent), d(new dtkWidgetsParameterDirBrowsePrivate)
{
d->push_button = new QPushButton;
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(d->push_button);
this->setLayout(layout);
}
dtkWidgetsParameterDirBrowse::~dtkWidgetsParameterDirBrowse(void)
{
delete d;
}
bool dtkWidgetsParameterDirBrowse::connect(dtkCoreParameter *p)
{
if (!p) {
qWarning() << Q_FUNC_INFO << "The input parameter is null. Nothing is done.";
return false;
}
m_parameter = dynamic_cast<dtk::d_path *>(p);
if(!m_parameter) {
qWarning() << Q_FUNC_INFO << "The type of the parameter is not compatible with the widget dtkWidgetsParameterDirBrowse.";
return false;
}
d->push_button->setText("Browse");
m_parameter->connect([=] (QVariant v) {
d->push_button->blockSignals(true);
QString value = v.value<dtk::d_path>().baseName();
if (value.isEmpty()) {
value = "Browse";
}
d->push_button->setText(value);
d->push_button->blockSignals(false);
});
QObject::connect(d->push_button, &QPushButton::clicked, [=] ()
{
QString v = QFileDialog::getExistingDirectory(this, "Open Directory", m_parameter->dirName());
m_parameter->shareValue(QVariant::fromValue(v));
});
dtkWidgetsParameterDirBrowse::dtkWidgetsParameterDirBrowse(QWidget* parent) : dtkWidgetsParameterBrowse(parent)
{}
return true;
QString dtkWidgetsParameterDirBrowse::browse(void) {
return QFileDialog::getExistingDirectory(this, "Open Directory", dtkWidgetsParameterBrowse::m_parameter->dirName());
}
//
......
......@@ -16,25 +16,19 @@
#include <dtkWidgetsExport>
#include "dtkWidgetsParameter.h"
#include "dtkWidgetsParameterBrowse.h"
#include <dtkCore/dtkCoreParameterPath>
class DTKWIDGETS_EXPORT dtkWidgetsParameterDirBrowse : public dtkWidgetsParameterBase<dtk::d_path>
class DTKWIDGETS_EXPORT dtkWidgetsParameterDirBrowse : public dtkWidgetsParameterBrowse
{
Q_OBJECT
public:
dtkWidgetsParameterDirBrowse(QWidget* parent = 0);
~dtkWidgetsParameterDirBrowse(void);
public:
bool connect(dtkCoreParameter *) override;
dtkWidgetsParameterDirBrowse(QWidget* parent = nullptr);
private:
using dtkWidgetsParameterBase<dtk::d_path>::m_parameter;
class dtkWidgetsParameterDirBrowsePrivate *d;
QString browse(void) override;
};
// ///////////////////////////////////////////////////////////////////
......
......@@ -17,102 +17,11 @@
#include <QtWidgets>
#include <QStringBuilder>
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsParameterFileBrowsePrivate declaration
// ///////////////////////////////////////////////////////////////////
dtkWidgetsParameterFileBrowse::dtkWidgetsParameterFileBrowse(QWidget* parent) : dtkWidgetsParameterBrowse(parent)
{}
class dtkWidgetsParameterFileBrowsePrivate
{
public:
QPushButton *push_button = nullptr;
public:
void setToolTip(const QString& doc, const QString& path)
{
QString tooltip;
if (!doc.isEmpty()) {
tooltip += QString("Doc: %1").arg(doc);
}
if (!path.isEmpty()) {
if (!tooltip.isEmpty())
tooltip += "\n";
tooltip += QString("Path: %1").arg(path);
}
push_button->setToolTip( tooltip );
}
};
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsParameterFileBrowse implementation
// ///////////////////////////////////////////////////////////////////
dtkWidgetsParameterFileBrowse::dtkWidgetsParameterFileBrowse(QWidget* parent) : dtkWidgetsParameterBase<dtk::d_path>(parent), d(new dtkWidgetsParameterFileBrowsePrivate)
{
d->push_button = new QPushButton;
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(d->push_button);
this->setLayout(layout);
}
dtkWidgetsParameterFileBrowse::~dtkWidgetsParameterFileBrowse(void)
{
delete d;
}
void dtkWidgetsParameterFileBrowse::setReadOnly(bool val)
{
this->dtkWidgetsParameter::m_readonly = val;
d->push_button->setEnabled(!this->dtkWidgetsParameter::m_readonly);
d->push_button->setFocusPolicy((this->dtkWidgetsParameter::m_readonly? Qt::NoFocus : Qt::WheelFocus));
}
bool dtkWidgetsParameterFileBrowse::connect(dtkCoreParameter *p)
{
if (!p) {
qWarning() << Q_FUNC_INFO << "The input parameter is null. Nothing is done.";
return false;
}
m_parameter = dynamic_cast<dtk::d_path *>(p);
if(!m_parameter) {
qWarning() << Q_FUNC_INFO << "The type of the parameter is not compatible with the widget dtkWidgetsParameterFileBrowse.";
return false;
}
QString text = "Browse";
QString base_name = m_parameter->baseName();
if(!base_name.isEmpty()) {
text = base_name;
}
d->push_button->setText(text);
d->setToolTip( m_parameter->documentation(), m_parameter->path() );
m_parameter->connect([=] (QVariant v) {
d->push_button->blockSignals(true);
QString value = v.value<dtk::d_path>().baseName();
if (value.isEmpty()) {
value = "Browse";
}
d->push_button->setText(value);
d->push_button->blockSignals(false);
QString tip = v.value<dtk::d_path>().path();
if(!tip.isEmpty()) {
d->setToolTip( m_parameter->documentation(), tip );
}
});
QObject::connect(d->push_button, &QPushButton::clicked, [=] ()
{
QString v = QFileDialog::getOpenFileName(this, "Open file", m_parameter->dirName(), m_parameter->filters().join(";;"));
m_parameter->shareValue(QVariant::fromValue(v));
});
return true;
QString dtkWidgetsParameterFileBrowse::browse(void) {
return QFileDialog::getOpenFileName(this, "Open file", dtkWidgetsParameterBrowse::m_parameter->dirName(), dtkWidgetsParameterBrowse::m_parameter->filters().join(";;"));
}
//
......
......@@ -16,27 +16,20 @@
#include <dtkWidgetsExport>
#include "dtkWidgetsParameter.h"
#include "dtkWidgetsParameterBrowse.h"
#include <dtkCore/dtkCoreParameter>
#include <dtkCore/dtkCoreParameterPath>
class DTKWIDGETS_EXPORT dtkWidgetsParameterFileBrowse : public dtkWidgetsParameterBase<dtk::d_path>
class DTKWIDGETS_EXPORT dtkWidgetsParameterFileBrowse : public dtkWidgetsParameterBrowse
{
Q_OBJECT
public:
dtkWidgetsParameterFileBrowse(QWidget* parent = nullptr);
~dtkWidgetsParameterFileBrowse(void);
public:
bool connect(dtkCoreParameter *) override;
void setReadOnly(bool) override;