Commit 367c91ae authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas
Browse files

Merge branch 'release/2.23.1'

parents 88ea1978 d0d36006
Pipeline #147894 running with stage
# ChangeLog
## version 2.23.1 - 2020-05-28
- display doc and path in the tooltip, according if both, either one or none is available
- save button can be defined as read-only
- 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
- expose parameter menubar widgets
## version 2.22.2 - 2020-04-27
......
......@@ -24,7 +24,7 @@ project(dtkWidgets)
set(${PROJECT_NAME}_VERSION_MAJOR 2)
set(${PROJECT_NAME}_VERSION_MINOR 23)
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})
......
......@@ -49,7 +49,7 @@
"file_browse": {
"label": "Open a file",
"doc": "Open a VTK file.",
"path": ".",
"path": "..",
"filters": [
"VTK (*.vtk)",
"VTI (*.vti)",
......@@ -58,6 +58,15 @@
],
"type": "dtk::d_path"
},
"file_save": {
"label": "Save in a file",
"doc": "Save in a file",
"path": "./output.txt",
"filters": [
"VTK (*.txt)"
],
"type": "dtk::d_path"
},
"slider_int": {
"type": "dtk::d_int",
"doc": "documentation",
......@@ -141,6 +150,18 @@
],
"type": "dtk::d_path"
},
"file_save_ro": {
"label": "Save a file (Read Only)",
"doc": "",
"path": ".",
"filters": [
"VTK (*.vtk)",
"VTI (*.vti)",
"VTU (*.vtu)",
"VTP (*.vtp)"
],
"type": "dtk::d_path"
},
"slider_int_ro": {
"type": "dtk::d_int",
"doc": "documentation",
......
......@@ -59,6 +59,14 @@
"widget_read_only": true
}
},
{
"parameter": {
"widget": "dtkWidgetsParameterFileSave",
"uid": "file_save_ro",
"advanced": false,
"widget_read_only": true
}
},
{
"parameter": {
"widget": "dtkWidgetsParameterIntSlider",
......@@ -155,6 +163,13 @@
"advanced": false
}
},
{
"parameter": {
"widget": "dtkWidgetsParameterFileSave",
"uid": "file_save",
"advanced": false
}
},
{
"parameter": {
"widget": "dtkWidgetsParameterIntSlider",
......
......@@ -14,6 +14,7 @@
#include "dtkWidgetsHUDInfo.h"
#include <dtkThemes/dtkThemesEngine>
#include <QtGui>
// ///////////////////////////////////////////////////////////////////
......@@ -52,10 +53,13 @@ void dtkWidgetsHUDInfo::paintEvent(QPaintEvent *event)
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.setPen(QColor("#cc2d2e2e"));
painter.setBrush(QColor("#cc2d2e2e"));
QColor fg = dtkThemesEngine::instance()->color("@fgalt");
QColor bg = dtkThemesEngine::instance()->color("@bgalt");
painter.setPen(bg);
painter.setBrush(bg);
painter.drawRoundedRect(event->rect(), 25 + 2, 25 + 2);
painter.setPen(QColor("#bebfbf"));
painter.setPen(fg);
painter.drawText(event->rect(), d->text, QTextOption(Qt::AlignCenter));
QFrame::paintEvent(event);
......
......@@ -15,6 +15,7 @@
#include "dtkWidgetsParameterFileBrowse.h"
#include <QtWidgets>
#include <QStringBuilder>
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsParameterFileBrowsePrivate declaration
......@@ -24,6 +25,20 @@ 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 );
}
};
// ///////////////////////////////////////////////////////////////////
......@@ -74,11 +89,7 @@ bool dtkWidgetsParameterFileBrowse::connect(dtkCoreParameter *p)
}
d->push_button->setText(text);
QString path = m_parameter->path();
if(!path.isEmpty()) {
d->push_button->setToolTip(path);
}
d->setToolTip( m_parameter->documentation(), m_parameter->path() );
m_parameter->connect([=] (QVariant v) {
d->push_button->blockSignals(true);
......@@ -91,7 +102,7 @@ bool dtkWidgetsParameterFileBrowse::connect(dtkCoreParameter *p)
QString tip = v.value<dtk::d_path>().path();
if(!tip.isEmpty()) {
d->push_button->setToolTip(tip);
d->setToolTip( m_parameter->documentation(), tip );
}
});
......
......@@ -15,6 +15,7 @@
#include "dtkWidgetsParameterFileSave.h"
#include <QtWidgets>
#include <QStringBuilder>
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsParameterFileSavePrivate declaration
......@@ -24,6 +25,20 @@ class dtkWidgetsParameterFileSavePrivate
{
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 );
}
};
// ///////////////////////////////////////////////////////////////////
......@@ -45,6 +60,14 @@ dtkWidgetsParameterFileSave::~dtkWidgetsParameterFileSave(void)
delete d;
}
void dtkWidgetsParameterFileSave::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 dtkWidgetsParameterFileSave::connect(dtkCoreParameter *p)
{
if (!p) {
......@@ -59,7 +82,15 @@ bool dtkWidgetsParameterFileSave::connect(dtkCoreParameter *p)
return false;
}
d->push_button->setText("Save");
QString text = "Save";
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);
......@@ -68,6 +99,7 @@ bool dtkWidgetsParameterFileSave::connect(dtkCoreParameter *p)
value = "Save";
}
d->push_button->setText(value);
d->setToolTip( m_parameter->documentation(), value );
d->push_button->blockSignals(false);
});
......
......@@ -30,6 +30,7 @@ public:
public:
bool connect(dtkCoreParameter *) override;
void setReadOnly(bool val) override;
private:
using dtkWidgetsParameterBase<dtk::d_path>::m_parameter;
......
......@@ -116,6 +116,12 @@ void dtkWidgetsWorkspaceBarPrivate::createWorkspace(const QColor& color, const Q
q->setTabText(index, name);
q->setTabTextColor(index, color.isValid() ? color : dtkThemesEngine::instance()->color("@fg"));
connect(dtkThemesEngine::instance(), &dtkThemesEngine::changed,
[=] () {
q->setTabTextColor(index, color.isValid() ? color : dtkThemesEngine::instance()->color("@fg"));
});
this->workspace_map.insert(index, workspace);
q->repaint();
......@@ -273,15 +279,22 @@ void dtkWidgetsWorkspaceBar::createWorkspace(const QString& type)
void dtkWidgetsWorkspaceBar::createWorkspace(const QString &name, const QString& type, bool display_destroy)
{
dtkWidgetsWorkspace *workspace = dtk::widgets::workspace::pluginFactory().create(type);
// the leave() must be done BEFORE changing d->current_workspace (which is what d->createWorkspace DOES!!)
// and before creating new workspace
if (d->current_workspace)
d->current_workspace->leave();
workspace->setObjectName(name);
dtkWidgetsWorkspace *workspace = dtk::widgets::workspace::pluginFactory().create(type);
if (!workspace) {
qWarning() << "can't create workspace of type" << type << dtk::widgets::workspace::pluginFactory().keys();
if (d->current_workspace)
d->current_workspace->enter();
return;
}
workspace->setObjectName(name);
// the leave() must be done BEFORE changing d->current_workspace (which is what d->createWorkspace DOES!!)
if (d->current_workspace)
d->current_workspace->leave();
......
......@@ -57,6 +57,8 @@ Rectangle {
color: theme.value("@fg");
font.pointSize: 12;
Image {
anchors.verticalCenter: parent.verticalCenter;
anchors.right: parent.right;
......@@ -79,7 +81,7 @@ Rectangle {
text: description;
font.pointSize: 9;
font.pointSize: 12;
wrapMode: TextEdit.WordWrap;
}
......@@ -150,6 +152,8 @@ Rectangle {
color: theme.value("@fg");
text: "Choose package";
font.pointSize: 12;
}
Image {
......
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