refactor tpanels
This commit is contained in:
parent
7fc4028c8a
commit
cdf1e107d7
|
@ -269,8 +269,8 @@ void FlipBook::addFreezeButtonToTitleBar() {
|
|||
TPanel *panel = qobject_cast<TPanel *>(parentWidget());
|
||||
if (panel) {
|
||||
TPanelTitleBar *titleBar = panel->getTitleBar();
|
||||
m_freezeButton = new TPanelTitleBarButton(
|
||||
titleBar, getIconThemePath("actions/20/pane_freeze.svg"));
|
||||
m_freezeButton =
|
||||
new TPanelTitleBarButton(titleBar, getIconPath("pane_freeze"));
|
||||
m_freezeButton->setToolTip("Freeze");
|
||||
titleBar->add(QPoint(-64, 0), m_freezeButton);
|
||||
connect(m_freezeButton, SIGNAL(toggled(bool)), this, SLOT(freeze(bool)));
|
||||
|
|
|
@ -145,15 +145,13 @@ void TPanel::enterEvent(QEvent *event) {
|
|||
// grab the focus, unless a line-edit is focused currently
|
||||
|
||||
QWidget *focusWidget = qApp->focusWidget();
|
||||
if (focusWidget && dynamic_cast<QLineEdit*>(focusWidget)) {
|
||||
event->accept();
|
||||
return;
|
||||
if (focusWidget && dynamic_cast<QLineEdit *>(focusWidget)) {
|
||||
event->accept();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
widgetFocusOnEnter();
|
||||
|
||||
|
||||
// Some panels (e.g. Viewer, StudioPalette, Palette, ColorModel) are
|
||||
// activated when mouse enters. Viewer is activatable only when being
|
||||
// docked.
|
||||
|
@ -168,12 +166,12 @@ void TPanel::enterEvent(QEvent *event) {
|
|||
//-----------------------------------------------------------------------------
|
||||
/*! clear focus when mouse leaves
|
||||
*/
|
||||
void TPanel::leaveEvent(QEvent *event) {
|
||||
QWidget* focusWidget = qApp->focusWidget();
|
||||
if (focusWidget && dynamic_cast<QLineEdit*>(focusWidget)) {
|
||||
return;
|
||||
}
|
||||
widgetClearFocusOnLeave();
|
||||
void TPanel::leaveEvent(QEvent *event) {
|
||||
QWidget *focusWidget = qApp->focusWidget();
|
||||
if (focusWidget && dynamic_cast<QLineEdit *>(focusWidget)) {
|
||||
return;
|
||||
}
|
||||
widgetClearFocusOnLeave();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -209,13 +207,13 @@ void TPanel::restoreFloatingPanelState() {
|
|||
TPanelTitleBarButton::TPanelTitleBarButton(QWidget *parent,
|
||||
const QString &standardPixmapName)
|
||||
: QWidget(parent)
|
||||
, m_standardPixmap(standardPixmapName)
|
||||
, m_standardPixmapName(standardPixmapName)
|
||||
, m_rollover(false)
|
||||
, m_pressed(false)
|
||||
, m_buttonSet(0)
|
||||
, m_id(0) {
|
||||
setFixedSize(m_standardPixmap.size());
|
||||
updatePixmaps();
|
||||
setFixedSize(m_onPixmap.size());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -223,7 +221,9 @@ TPanelTitleBarButton::TPanelTitleBarButton(QWidget *parent,
|
|||
TPanelTitleBarButton::TPanelTitleBarButton(QWidget *parent,
|
||||
const QPixmap &standardPixmap)
|
||||
: QWidget(parent)
|
||||
, m_standardPixmap(standardPixmap)
|
||||
, m_onPixmap(standardPixmap)
|
||||
, m_offPixmap(standardPixmap)
|
||||
, m_overPixmap(standardPixmap)
|
||||
, m_rollover(false)
|
||||
, m_pressed(false)
|
||||
, m_buttonSet(0)
|
||||
|
@ -251,26 +251,85 @@ void TPanelTitleBarButton::setPressed(bool pressed) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TPanelTitleBarButton::paintEvent(QPaintEvent *event) {
|
||||
// Set unique pressed colors if filename contains the following words:
|
||||
QColor bgColor = getPressedColor();
|
||||
if (m_standardPixmapName.contains("freeze", Qt::CaseInsensitive))
|
||||
void TPanelTitleBarButton::setOverColor(const QColor &color) {
|
||||
if (m_overColor != color) {
|
||||
m_overColor = color;
|
||||
updatePixmaps();
|
||||
}
|
||||
}
|
||||
|
||||
QColor TPanelTitleBarButton::getOverColor() const { return m_overColor; }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TPanelTitleBarButton::setPressedColor(const QColor &color) {
|
||||
if (m_pressedColor != color) {
|
||||
m_pressedColor = color;
|
||||
updatePixmaps();
|
||||
}
|
||||
}
|
||||
|
||||
QColor TPanelTitleBarButton::getPressedColor() const { return m_pressedColor; }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TPanelTitleBarButton::setFreezeColor(const QColor &color) {
|
||||
if (m_freezeColor != color) {
|
||||
m_freezeColor = color;
|
||||
updatePixmaps();
|
||||
}
|
||||
}
|
||||
|
||||
QColor TPanelTitleBarButton::getFreezeColor() const { return m_freezeColor; }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TPanelTitleBarButton::setPreviewColor(const QColor &color) {
|
||||
if (m_previewColor != color) {
|
||||
m_previewColor = color;
|
||||
updatePixmaps();
|
||||
}
|
||||
}
|
||||
|
||||
QColor TPanelTitleBarButton::getPreviewColor() const { return m_previewColor; }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TPanelTitleBarButton::updatePixmaps() {
|
||||
// Get background color used by some icons and states
|
||||
QColor bgColor;
|
||||
if (m_standardPixmapName.contains("freeze", Qt::CaseInsensitive)) {
|
||||
bgColor = getFreezeColor();
|
||||
if (m_standardPixmapName.contains("preview", Qt::CaseInsensitive))
|
||||
} else if (m_standardPixmapName.contains("preview", Qt::CaseInsensitive)) {
|
||||
bgColor = getPreviewColor();
|
||||
} else {
|
||||
bgColor = getPressedColor();
|
||||
}
|
||||
|
||||
QPixmap panePixmap = recolorPixmap(svgToPixmap(m_standardPixmapName));
|
||||
QPixmap panePixmapOff = compositePixmap(panePixmap, 0.8);
|
||||
QPixmap panePixmapOver =
|
||||
compositePixmap(panePixmap, 1, QSize(), 0, 0, getOverColor());
|
||||
QPixmap panePixmapOn = compositePixmap(panePixmap, 1, QSize(), 0, 0, bgColor);
|
||||
ThemeManager &themeManager = ThemeManager::getInstance();
|
||||
const qreal offOpacity = themeManager.getOffOpacity();
|
||||
|
||||
// Compute icon
|
||||
QImage baseImg = svgToImage(m_standardPixmapName);
|
||||
baseImg = themeManager.recolorBlackPixels(baseImg);
|
||||
QImage onImg = compositeImage(baseImg, QSize(), false, bgColor);
|
||||
QImage offImg = adjustImageOpacity(baseImg, offOpacity);
|
||||
QImage overImg = compositeImage(baseImg, QSize(), false, getOverColor());
|
||||
|
||||
// Store in member variables
|
||||
m_onPixmap = convertImageToPixmap(onImg);
|
||||
m_offPixmap = convertImageToPixmap(offImg);
|
||||
m_overPixmap = convertImageToPixmap(overImg);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TPanelTitleBarButton::paintEvent(QPaintEvent *event) {
|
||||
QPainter painter(this);
|
||||
painter.drawPixmap(0, 0,
|
||||
m_pressed ? panePixmapOn
|
||||
: m_rollover ? panePixmapOver
|
||||
: panePixmapOff);
|
||||
painter.end();
|
||||
m_pressed ? m_onPixmap
|
||||
: m_rollover ? m_overPixmap
|
||||
: m_offPixmap);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -447,7 +506,7 @@ TPanelTitleBarButtonForGrids::TPanelTitleBarButtonForGrids(
|
|||
connect(perspectiveCheckbox, &QCheckBox::stateChanged, [=](int value) {
|
||||
ShowPerspectiveGrids = value > 0 ? 1 : 0;
|
||||
emit updateViewer();
|
||||
});
|
||||
});
|
||||
|
||||
QCheckBox *symmetryCheckbox = new QCheckBox(tr("Symmetry Guide"), this);
|
||||
connect(symmetryCheckbox, &QCheckBox::stateChanged, [=](int value) {
|
||||
|
@ -557,6 +616,7 @@ TPanelTitleBar::TPanelTitleBar(QWidget *parent,
|
|||
setMouseTracking(true);
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
setCursor(Qt::ArrowCursor);
|
||||
generateCloseButtonPixmaps();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -565,6 +625,31 @@ QSize TPanelTitleBar::minimumSizeHint() const { return QSize(20, 18); }
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TPanelTitleBar::generateCloseButtonPixmaps() {
|
||||
QString iconSVGName = "pane_close";
|
||||
// Icon theme vars
|
||||
ThemeManager &themeManager = ThemeManager::getInstance();
|
||||
const qreal offOpacity = themeManager.getOffOpacity();
|
||||
|
||||
// Use overColor from stylesheet for bgColor of rollover
|
||||
QColor overColor = getOverColor();
|
||||
|
||||
// Generate base icon image
|
||||
QImage baseImg = generateIconImage("pane_close");
|
||||
baseImg = compositeImage(baseImg, QSize(20, 18));
|
||||
|
||||
// Off icon image
|
||||
QImage offImg = adjustImageOpacity(baseImg, offOpacity);
|
||||
|
||||
// Over icon image
|
||||
QImage overImg = compositeImage(baseImg, QSize(), false, overColor);
|
||||
|
||||
m_closeButtonPixmap = convertImageToPixmap(offImg);
|
||||
m_closeButtonOverPixmap = convertImageToPixmap(overImg);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TPanelTitleBar::paintEvent(QPaintEvent *) {
|
||||
QPainter painter(this);
|
||||
QRect rect = this->rect();
|
||||
|
@ -573,18 +658,11 @@ void TPanelTitleBar::paintEvent(QPaintEvent *) {
|
|||
|
||||
TPanel *dw = qobject_cast<TPanel *>(parentWidget());
|
||||
Q_ASSERT(dw != 0);
|
||||
// docked panel
|
||||
if (!dw->isFloating()) {
|
||||
|
||||
if (!dw->isFloating()) { // docked panel
|
||||
isPanelActive = dw->widgetInThisPanelIsFocused();
|
||||
qDrawBorderPixmap(&painter, rect, QMargins(3, 3, 3, 3),
|
||||
(isPanelActive) ? m_activeBorderPm : m_borderPm);
|
||||
}
|
||||
// floating panel
|
||||
else {
|
||||
} else { // floating panel
|
||||
isPanelActive = isActiveWindow();
|
||||
qDrawBorderPixmap(
|
||||
&painter, rect, QMargins(3, 3, 3, 3),
|
||||
(isPanelActive) ? m_floatActiveBorderPm : m_floatBorderPm);
|
||||
}
|
||||
|
||||
if (dw->getOrientation() == TDockWidget::vertical) {
|
||||
|
@ -597,21 +675,37 @@ void TPanelTitleBar::paintEvent(QPaintEvent *) {
|
|||
}
|
||||
|
||||
if (dw->isFloating()) {
|
||||
QIcon paneCloseIcon = createQIcon("pane_close");
|
||||
const static QPixmap closeButtonPixmap(
|
||||
paneCloseIcon.pixmap(20, 18, QIcon::Normal, QIcon::Off));
|
||||
const static QPixmap closeButtonPixmapOver(
|
||||
paneCloseIcon.pixmap(20, 18, QIcon::Active));
|
||||
|
||||
QPoint closeButtonPos(rect.right() - 20, rect.top());
|
||||
QPoint closeButtonPos(rect.right() - 19, rect.top());
|
||||
|
||||
if (m_closeButtonHighlighted)
|
||||
painter.drawPixmap(closeButtonPos, closeButtonPixmapOver);
|
||||
painter.drawPixmap(closeButtonPos, m_closeButtonOverPixmap);
|
||||
else
|
||||
painter.drawPixmap(closeButtonPos, closeButtonPixmap);
|
||||
painter.drawPixmap(closeButtonPos, m_closeButtonPixmap);
|
||||
}
|
||||
}
|
||||
|
||||
painter.end();
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TPanelTitleBar::setOverColor(const QColor &color) {
|
||||
if (m_overColor != color) {
|
||||
m_overColor = color;
|
||||
generateCloseButtonPixmaps();
|
||||
}
|
||||
}
|
||||
|
||||
QColor TPanelTitleBar::getOverColor() const { return m_overColor; }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void TPanelTitleBar::leaveEvent(QEvent *) {
|
||||
TPanel *dw = qobject_cast<TPanel *>(parentWidget());
|
||||
Q_ASSERT(dw != 0);
|
||||
|
||||
// Mouse left the widget, reset the highlighted flag
|
||||
if (dw->isFloating()) {
|
||||
m_closeButtonHighlighted = false;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -15,13 +15,26 @@ class QMenu;
|
|||
//! icon buttons placed on the panel titlebar (cfr. viewerpane.h)
|
||||
class TPanelTitleBarButton : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
// Filepath
|
||||
QString m_standardPixmapName;
|
||||
|
||||
// Pixmaps
|
||||
QPixmap m_standardPixmap;
|
||||
QPixmap m_onPixmap;
|
||||
QPixmap m_offPixmap;
|
||||
QPixmap m_overPixmap;
|
||||
|
||||
// Colors
|
||||
QColor m_overColor;
|
||||
QColor m_pressedColor;
|
||||
QColor m_freezeColor;
|
||||
QColor m_previewColor;
|
||||
|
||||
// Methods
|
||||
void updatePixmaps();
|
||||
|
||||
// Stylesheet
|
||||
Q_PROPERTY(QColor OverColor READ getOverColor WRITE setOverColor);
|
||||
Q_PROPERTY(QColor PressedColor READ getPressedColor WRITE setPressedColor);
|
||||
Q_PROPERTY(QColor FreezeColor READ getFreezeColor WRITE setFreezeColor);
|
||||
|
@ -42,14 +55,18 @@ public:
|
|||
void setButtonSet(TPanelTitleBarButtonSet *buttonSet, int id);
|
||||
int getId() const { return m_id; }
|
||||
|
||||
void setOverColor(const QColor &color) { m_overColor = color; }
|
||||
QColor getOverColor() const { return m_overColor; }
|
||||
void setPressedColor(const QColor &color) { m_pressedColor = color; }
|
||||
QColor getPressedColor() const { return m_pressedColor; }
|
||||
void setFreezeColor(const QColor &color) { m_freezeColor = color; }
|
||||
QColor getFreezeColor() const { return m_freezeColor; }
|
||||
void setPreviewColor(const QColor &color) { m_previewColor = color; }
|
||||
QColor getPreviewColor() const { return m_previewColor; }
|
||||
// Stylesheet
|
||||
void setOverColor(const QColor &color);
|
||||
QColor getOverColor() const;
|
||||
|
||||
void setPressedColor(const QColor &color);
|
||||
QColor getPressedColor() const;
|
||||
|
||||
void setFreezeColor(const QColor &color);
|
||||
QColor getFreezeColor() const;
|
||||
|
||||
void setPreviewColor(const QColor &color);
|
||||
QColor getPreviewColor() const;
|
||||
|
||||
public slots:
|
||||
void setPressed(bool pressed); // n.b. doesn't emit signals. calls update()
|
||||
|
@ -62,11 +79,7 @@ protected:
|
|||
void leaveEvent(QEvent *) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
|
||||
// Q_PROPERTY(QColor RolloverColor READ getRolloverColor WRITE
|
||||
// setRolloverColor);
|
||||
// Q_PROPERTY(QColor PressedColor READ getPressedColor WRITE setPressedColor);
|
||||
// Q_PROPERTY(QColor FreezeColor READ getFreezeColor WRITE setFreezeColor);
|
||||
// Q_PROPERTY(QColor PreviewColor READ getPreviewColor WRITE setPreviewColor);
|
||||
QPixmap getPixmap(const QString &iconSVGName, bool rollover);
|
||||
|
||||
signals:
|
||||
//! emitted when the user press the button
|
||||
|
@ -178,8 +191,8 @@ class TPanelTitleBar final : public QFrame {
|
|||
bool m_closeButtonHighlighted;
|
||||
std::vector<std::pair<QPoint, QWidget *>> m_buttons;
|
||||
|
||||
QPixmap m_borderPm, m_activeBorderPm, m_floatBorderPm, m_floatActiveBorderPm;
|
||||
QColor m_titleColor, m_activeTitleColor;
|
||||
QColor m_titleColor, m_activeTitleColor, m_overColor;
|
||||
QPixmap m_closeButtonPixmap, m_closeButtonOverPixmap;
|
||||
|
||||
public:
|
||||
TPanelTitleBar(QWidget *parent = 0,
|
||||
|
@ -188,26 +201,19 @@ public:
|
|||
QSize sizeHint() const override { return minimumSizeHint(); }
|
||||
QSize minimumSizeHint() const override;
|
||||
|
||||
void generateCloseButtonPixmaps();
|
||||
|
||||
// pos = widget position. n.b. if pos.x()<0 then origin is topright corner
|
||||
void add(const QPoint &pos, QWidget *widget);
|
||||
|
||||
QPixmap getBorderPixmap() const { return m_borderPm; }
|
||||
void setBorderPixmap(const QPixmap &pixmap) { m_borderPm = pixmap; }
|
||||
QPixmap getActiveBorderPixmap() const { return m_activeBorderPm; }
|
||||
void setActiveBorderPixmap(const QPixmap &pixmap) {
|
||||
m_activeBorderPm = pixmap;
|
||||
}
|
||||
QPixmap getFloatBorderPixmap() const { return m_floatBorderPm; }
|
||||
void setFloatBorderPixmap(const QPixmap &pixmap) { m_floatBorderPm = pixmap; }
|
||||
QPixmap getFloatActiveBorderPixmap() const { return m_floatActiveBorderPm; }
|
||||
void setFloatActiveBorderPixmap(const QPixmap &pixmap) {
|
||||
m_floatActiveBorderPm = pixmap;
|
||||
}
|
||||
QColor getTitleColor() const { return m_titleColor; }
|
||||
void setTitleColor(const QColor &color) { m_titleColor = color; }
|
||||
QColor getActiveTitleColor() const { return m_activeTitleColor; }
|
||||
void setActiveTitleColor(const QColor &color) { m_activeTitleColor = color; }
|
||||
|
||||
QColor getOverColor() const;
|
||||
void setOverColor(const QColor &color);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
|
@ -215,20 +221,17 @@ protected:
|
|||
void contextMenuEvent(QContextMenuEvent *) override {}
|
||||
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void leaveEvent(QEvent *) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent *) override;
|
||||
|
||||
Q_PROPERTY(QPixmap BorderPixmap READ getBorderPixmap WRITE setBorderPixmap);
|
||||
Q_PROPERTY(QPixmap ActiveBorderPixmap READ getActiveBorderPixmap WRITE
|
||||
setActiveBorderPixmap);
|
||||
Q_PROPERTY(QPixmap FloatBorderPixmap READ getFloatBorderPixmap WRITE
|
||||
setFloatBorderPixmap);
|
||||
Q_PROPERTY(QPixmap FloatActiveBorderPixmap READ getFloatActiveBorderPixmap
|
||||
WRITE setFloatActiveBorderPixmap);
|
||||
QPixmap getPixmap(const QString &iconSVGName, bool rollover);
|
||||
|
||||
Q_PROPERTY(QColor TitleColor READ getTitleColor WRITE setTitleColor);
|
||||
Q_PROPERTY(QColor ActiveTitleColor READ getActiveTitleColor WRITE
|
||||
setActiveTitleColor);
|
||||
Q_PROPERTY(QColor OverColor READ getOverColor WRITE setOverColor);
|
||||
|
||||
signals:
|
||||
|
||||
|
|
|
@ -677,8 +677,8 @@ void PaletteViewerPanel::showEvent(QShowEvent *) {
|
|||
TSceneHandle *sceneHandle = TApp::instance()->getCurrentScene();
|
||||
bool ret = connect(sceneHandle, SIGNAL(preferenceChanged(const QString &)),
|
||||
this, SLOT(onPreferenceChanged(const QString &)));
|
||||
ret = ret && connect(sceneHandle, SIGNAL(sceneSwitched()), this,
|
||||
SLOT(onSceneSwitched()));
|
||||
ret = ret && connect(sceneHandle, SIGNAL(sceneSwitched()), this,
|
||||
SLOT(onSceneSwitched()));
|
||||
assert(ret);
|
||||
}
|
||||
|
||||
|
@ -1018,8 +1018,8 @@ public:
|
|||
panel->setWidget(toolbar);
|
||||
panel->setIsMaximizable(false);
|
||||
// panel->setAllowedAreas(Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea);
|
||||
// panel->setFixedWidth(44); // 35
|
||||
// toolbar->setFixedWidth(34);
|
||||
// panel->setFixedWidth(44); // 35
|
||||
// toolbar->setFixedWidth(34);
|
||||
panel->setWindowTitle(QString(""));
|
||||
panel->getTitleBar()->showTitleBar(TApp::instance()->getShowTitleBars());
|
||||
connect(TApp::instance(), SIGNAL(showTitleBars(bool)), panel->getTitleBar(),
|
||||
|
@ -1129,8 +1129,7 @@ void FlipbookPanel::initializeTitleBar(TPanelTitleBar *titleBar) {
|
|||
int iconWidth = 20;
|
||||
// safe area button
|
||||
TPanelTitleBarButtonForSafeArea *safeAreaButton =
|
||||
new TPanelTitleBarButtonForSafeArea(
|
||||
titleBar, getIconThemePath("actions/20/pane_safe.svg"));
|
||||
new TPanelTitleBarButtonForSafeArea(titleBar, getIconPath("pane_safe"));
|
||||
safeAreaButton->setToolTip(tr("Safe Area (Right Click to Select)"));
|
||||
titleBar->add(QPoint(x, 0), safeAreaButton);
|
||||
ret = ret && connect(safeAreaButton, SIGNAL(toggled(bool)),
|
||||
|
@ -1145,8 +1144,7 @@ void FlipbookPanel::initializeTitleBar(TPanelTitleBar *titleBar) {
|
|||
|
||||
x += 28 + iconWidth;
|
||||
// minimize button
|
||||
m_button = new TPanelTitleBarButton(
|
||||
titleBar, getIconThemePath("actions/20/pane_minimize.svg"));
|
||||
m_button = new TPanelTitleBarButton(titleBar, getIconPath("pane_minimize"));
|
||||
m_button->setToolTip(tr("Minimize"));
|
||||
m_button->setPressed(false);
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ BaseViewerPanel::BaseViewerPanel(QWidget *parent, Qt::WindowFlags flags)
|
|||
m_flipConsole->enableButton(FlipConsole::eCheckBg, false, false);
|
||||
m_flipConsole->setChecked(FlipConsole::eSound, true);
|
||||
m_playSound = m_flipConsole->isChecked(FlipConsole::eSound);
|
||||
|
||||
|
||||
m_flipConsole->setFrameRate(app->getCurrentScene()
|
||||
->getScene()
|
||||
->getProperties()
|
||||
|
@ -345,7 +345,7 @@ void BaseViewerPanel::showEvent(QShowEvent *event) {
|
|||
ret = ret && connect(frameHandle, SIGNAL(frameTypeChanged()), this,
|
||||
SLOT(onFrameTypeChanged()));
|
||||
|
||||
// onXshLevelSwitched(TXshLevel*)<29>F changeWindowTitle() + updateFrameRange()
|
||||
// onXshLevelSwitched(TXshLevel*)<29>F changeWindowTitle() + updateFrameRange()
|
||||
ret = ret && connect(levelHandle, SIGNAL(xshLevelSwitched(TXshLevel *)), this,
|
||||
SLOT(onXshLevelSwitched(TXshLevel *)));
|
||||
|
||||
|
@ -394,8 +394,7 @@ void BaseViewerPanel::initializeTitleBar(TPanelTitleBar *titleBar) {
|
|||
|
||||
// buttons for show / hide toggle for the field guide and the safe area
|
||||
TPanelTitleBarButtonForSafeArea *safeAreaButton =
|
||||
new TPanelTitleBarButtonForSafeArea(
|
||||
titleBar, getIconThemePath("actions/20/pane_safe.svg"));
|
||||
new TPanelTitleBarButtonForSafeArea(titleBar, getIconPath("pane_safe"));
|
||||
safeAreaButton->setToolTip(tr("Safe Area (Right Click to Select)"));
|
||||
titleBar->add(QPoint(x, 0), safeAreaButton);
|
||||
ret = ret && connect(safeAreaButton, SIGNAL(toggled(bool)),
|
||||
|
@ -408,8 +407,7 @@ void BaseViewerPanel::initializeTitleBar(TPanelTitleBar *titleBar) {
|
|||
safeAreaButton->setPressed(
|
||||
CommandManager::instance()->getAction(MI_SafeArea)->isChecked());
|
||||
|
||||
button = new TPanelTitleBarButton(
|
||||
titleBar, getIconThemePath("actions/20/pane_grid.svg"));
|
||||
button = new TPanelTitleBarButton(titleBar, getIconPath("pane_grid"));
|
||||
button->setToolTip(tr("Grids and Overlays\nRight click to adjust."));
|
||||
x += 1 + iconWidth;
|
||||
titleBar->add(QPoint(x, 0), button);
|
||||
|
@ -423,8 +421,7 @@ void BaseViewerPanel::initializeTitleBar(TPanelTitleBar *titleBar) {
|
|||
CommandManager::instance()->getAction(MI_FieldGuide)->isChecked());
|
||||
|
||||
TPanelTitleBarButtonForGrids *gridMoreButton =
|
||||
new TPanelTitleBarButtonForGrids(
|
||||
titleBar, getIconThemePath("actions/9/pane_more.svg"));
|
||||
new TPanelTitleBarButtonForGrids(titleBar, getIconPath("pane_more"));
|
||||
gridMoreButton->setToolTip(tr("Grids and Overlays Settings"));
|
||||
x += 1 + iconWidth;
|
||||
titleBar->add(QPoint(x, 0), gridMoreButton);
|
||||
|
@ -432,31 +429,27 @@ void BaseViewerPanel::initializeTitleBar(TPanelTitleBar *titleBar) {
|
|||
[=]() { m_sceneViewer->update(); });
|
||||
|
||||
// view mode toggles
|
||||
button = new TPanelTitleBarButton(
|
||||
titleBar, getIconThemePath("actions/20/pane_table.svg"));
|
||||
button = new TPanelTitleBarButton(titleBar, getIconPath("pane_table"));
|
||||
button->setToolTip(tr("Camera Stand View"));
|
||||
x += 10 + iconWidth;
|
||||
titleBar->add(QPoint(x, 0), button);
|
||||
button->setButtonSet(viewModeButtonSet, SceneViewer::NORMAL_REFERENCE);
|
||||
button->setPressed(true);
|
||||
|
||||
button = new TPanelTitleBarButton(titleBar,
|
||||
getIconThemePath("actions/20/pane_3d.svg"));
|
||||
button = new TPanelTitleBarButton(titleBar, getIconPath("pane_3d"));
|
||||
button->setToolTip(tr("3D View"));
|
||||
x += 1 + iconWidth;
|
||||
titleBar->add(QPoint(x, 0), button);
|
||||
button->setButtonSet(viewModeButtonSet, SceneViewer::CAMERA3D_REFERENCE);
|
||||
|
||||
button = new TPanelTitleBarButton(
|
||||
titleBar, getIconThemePath("actions/20/pane_cam.svg"));
|
||||
button = new TPanelTitleBarButton(titleBar, getIconPath("pane_cam"));
|
||||
button->setToolTip(tr("Camera View"));
|
||||
x += 1 + iconWidth;
|
||||
titleBar->add(QPoint(x, 0), button);
|
||||
button->setButtonSet(viewModeButtonSet, SceneViewer::CAMERA_REFERENCE);
|
||||
|
||||
TPanelTitleBarButtonForCameraView *camTransparencyButton =
|
||||
new TPanelTitleBarButtonForCameraView(
|
||||
titleBar, getIconThemePath("actions/9/pane_more.svg"));
|
||||
new TPanelTitleBarButtonForCameraView(titleBar, getIconPath("pane_more"));
|
||||
camTransparencyButton->setToolTip(tr("Change camera view transparency."));
|
||||
x += 1 + iconWidth;
|
||||
titleBar->add(QPoint(x, 0), camTransparencyButton);
|
||||
|
@ -468,8 +461,7 @@ void BaseViewerPanel::initializeTitleBar(TPanelTitleBar *titleBar) {
|
|||
SLOT(setReferenceMode(int)));
|
||||
|
||||
// freeze button
|
||||
button = new TPanelTitleBarButton(
|
||||
titleBar, getIconThemePath("actions/20/pane_freeze.svg"));
|
||||
button = new TPanelTitleBarButton(titleBar, getIconPath("pane_freeze"));
|
||||
x += 10 + iconWidth;
|
||||
|
||||
button->setToolTip(tr("Freeze"));
|
||||
|
@ -478,8 +470,8 @@ void BaseViewerPanel::initializeTitleBar(TPanelTitleBar *titleBar) {
|
|||
SLOT(freeze(bool)));
|
||||
|
||||
// preview toggles
|
||||
m_previewButton = new TPanelTitleBarButtonForPreview(
|
||||
titleBar, getIconThemePath("actions/20/pane_preview.svg"));
|
||||
m_previewButton =
|
||||
new TPanelTitleBarButtonForPreview(titleBar, getIconPath("pane_preview"));
|
||||
x += 10 + iconWidth;
|
||||
titleBar->add(QPoint(x, 0), m_previewButton);
|
||||
m_previewButton->setToolTip(tr("Preview"));
|
||||
|
@ -488,7 +480,7 @@ void BaseViewerPanel::initializeTitleBar(TPanelTitleBar *titleBar) {
|
|||
// SLOT(enableFullPreview(bool)));
|
||||
|
||||
m_subcameraPreviewButton = new TPanelTitleBarButtonForPreview(
|
||||
titleBar, getIconThemePath("actions/20/pane_subpreview.svg"));
|
||||
titleBar, getIconPath("pane_subpreview"));
|
||||
x += 1 + 24; // width of pane_preview.svg = 24px
|
||||
|
||||
titleBar->add(QPoint(x, 0), m_subcameraPreviewButton);
|
||||
|
@ -633,7 +625,7 @@ void BaseViewerPanel::onPlayingStatusChanged(bool playing) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void BaseViewerPanel::changeWindowTitle() { // —vŠm”F
|
||||
void BaseViewerPanel::changeWindowTitle() { // <EFBFBD>v<EFBFBD>m<EFBFBD>F
|
||||
TApp *app = TApp::instance();
|
||||
ToonzScene *scene = app->getCurrentScene()->getScene();
|
||||
if (!scene) return;
|
||||
|
@ -669,7 +661,7 @@ void BaseViewerPanel::changeWindowTitle() { //
|
|||
m_sceneViewer->getNormalZoomScale().inv();
|
||||
if (m_sceneViewer->getIsFlippedX()) aff = aff * TScale(-1, 1);
|
||||
if (m_sceneViewer->getIsFlippedY()) aff = aff * TScale(1, -1);
|
||||
name = name + tr(" :: Zoom : ") +
|
||||
name = name + tr(" :: Zoom : ") +
|
||||
QString::number(tround(100.0 * sqrt(aff.det()))) + "%";
|
||||
if (m_sceneViewer->getIsFlippedX() || m_sceneViewer->getIsFlippedY()) {
|
||||
name = name + tr(" (Flipped)");
|
||||
|
@ -699,7 +691,7 @@ void BaseViewerPanel::changeWindowTitle() { //
|
|||
m_sceneViewer->getNormalZoomScale().inv();
|
||||
if (m_sceneViewer->getIsFlippedX()) aff = aff * TScale(-1, 1);
|
||||
if (m_sceneViewer->getIsFlippedY()) aff = aff * TScale(1, -1);
|
||||
name = name + tr(" :: Zoom : ") +
|
||||
name = name + tr(" :: Zoom : ") +
|
||||
QString::number(tround(100.0 * sqrt(aff.det()))) + "%";
|
||||
if (m_sceneViewer->getIsFlippedX() || m_sceneViewer->getIsFlippedY()) {
|
||||
name = name + tr(" (Flipped)");
|
||||
|
|
Loading…
Reference in a new issue