Skip to content

Commit

Permalink
fix(tabbar): dnd background error
Browse files Browse the repository at this point in the history
Change-Id: If0089917639ca999d352a83a82c19cae6dcf9835
  • Loading branch information
rekols committed Aug 25, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 3341f0f commit 8934d1e
Showing 5 changed files with 9 additions and 17 deletions.
9 changes: 4 additions & 5 deletions editor/src/tabwidget.cpp
Original file line number Diff line number Diff line change
@@ -221,9 +221,9 @@ bool TabWidget::eventFilter(QObject *, QEvent *event)
static_cast<Window*>(this->window())->changeTitlebarBackground(m_dndStartColor, m_dndEndColor);
}
} else if (event->type() == QEvent::DragLeave) {
static_cast<Window*>(this->window())->changeTitlebarBackground(m_backgroundStartColor, m_backgroundEndColor);
static_cast<Window*>(this->window())->changeTitlebarBackground(m_backgroundColor);
} else if (event->type() == QEvent::Drop) {
static_cast<Window*>(this->window())->changeTitlebarBackground(m_backgroundStartColor, m_backgroundEndColor);
static_cast<Window*>(this->window())->changeTitlebarBackground(m_backgroundColor);
} else if (event->type() == QEvent::DragMove) {
event->accept();
}
@@ -256,10 +256,9 @@ void TabWidget::handleDragActionChanged(Qt::DropAction action)
}
}

void TabWidget::setBackground(QString startColor, QString endColor)
void TabWidget::setBackground(QString color)
{
m_backgroundStartColor = startColor;
m_backgroundEndColor = endColor;
m_backgroundColor = color;
}

void TabWidget::setDNDColor(QString startColor, QString endColor)
5 changes: 2 additions & 3 deletions editor/src/tabwidget.h
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ class TabWidget : public DTabBar
void insertFromMimeData(int index, const QMimeData *source);
void insertFromMimeDataOnDragEnter(int index, const QMimeData *source);

void setBackground(QString startColor, QString endColor);
void setBackground(QString color);
void setDNDColor(QString startColor, QString endColor);

signals:
@@ -65,8 +65,7 @@ public slots:
QAction *m_closeTabAction;
QMenu *m_menu;
int m_rightClickTab;
QString m_backgroundStartColor;
QString m_backgroundEndColor;
QString m_backgroundColor;
QString m_dndStartColor;
QString m_dndEndColor;
};
3 changes: 1 addition & 2 deletions editor/src/window.cpp
Original file line number Diff line number Diff line change
@@ -1245,10 +1245,8 @@ void Window::loadTheme(const QString &name)

if (QColor(m_tabbarBackgroundColor).lightness() < 128) {
DThemeManager::instance()->setTheme("dark");
m_tabbar->tabbar->setBackground(m_darkTabBackgroundStartColor, m_darkTabBackgroundEndColor);
} else {
DThemeManager::instance()->setTheme("light");
m_tabbar->tabbar->setBackground(m_lightTabBackgroundStartColor, m_lightTabBackgroundEndColor);
}

changeTitlebarBackground(m_tabbarBackgroundColor);
@@ -1262,6 +1260,7 @@ void Window::loadTheme(const QString &name)
m_replaceBar->setBackground(backgroundColor);
m_findBar->setBackground(backgroundColor);
m_tabbar->tabbar->setDNDColor(jsonMap["app-colors"].toMap()["tab-dnd-start"].toString(), jsonMap["app-colors"].toMap()["tab-dnd-end"].toString());
m_tabbar->tabbar->setBackground(m_tabbarBackgroundColor);

auto frameSelectedColor = jsonMap["app-colors"].toMap()["themebar-frame-selected"].toString();
auto frameNormalColor = jsonMap["app-colors"].toMap()["themebar-frame-normal"].toString();
5 changes: 0 additions & 5 deletions editor/src/window.h
Original file line number Diff line number Diff line change
@@ -195,11 +195,6 @@ public slots:
QString m_readonlySeparator = " !_! ";

QString m_themeName;
QString m_lightTabBackgroundStartColor = "(255, 255, 255, 90%)";
QString m_lightTabBackgroundEndColor = "(248, 248, 248, 90%)";
QString m_darkTabBackgroundStartColor = "(16, 16, 16, 90%)";
QString m_darkTabBackgroundEndColor = "(16, 16, 16, 90%)";

QString m_tabbarBackgroundColor;
};

4 changes: 2 additions & 2 deletions editor/theme/Solarized Light/editor.theme
Original file line number Diff line number Diff line change
@@ -175,8 +175,8 @@
"app-colors" : {
"tab-active" : "#403513",
"tab-background-color": "#FDF6E3",
"tab-dnd-start" : "(35, 38, 41, 90%)",
"tab-dnd-end" : "(35, 38, 41, 90%)",
"tab-dnd-start" : "(238, 232, 213, 90%)",
"tab-dnd-end" : "(238, 232, 213, 90%)",
"themebar-frame-selected" : "#00FFFF",
"themebar-frame-normal" : "#000000",
"english-completer-item-selected-background" : "#2CA7F8",

0 comments on commit 8934d1e

Please sign in to comment.