1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Added support for Right To Left layout direction and also themes support RTL!

This commit is contained in:
S. Razi Alavizadeh 2012-08-09 06:30:09 +04:30 committed by nowrep
parent e6a5b18675
commit 89f9fc9ac2
16 changed files with 125 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

14
bin/themes/chrome/rtl.css Normal file
View File

@ -0,0 +1,14 @@
#navigation-button-next
{
qproperty-multiIcon: url(images/navigation-back.png);
}
#navigation-button-back
{
qproperty-multiIcon: url(images/navigation-forward.png);
}
#locationbar-goicon
{
qproperty-pixmap: url(images/gotoaddress_rtl.png);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

View File

@ -0,0 +1,14 @@
#navigation-button-next
{
qproperty-icon: url(images/navigation-back.png);
}
#navigation-button-back
{
qproperty-icon: url(images/navigation-forward.png);
}
#locationbar-goicon
{
qproperty-pixmap: url(images/gotoaddress_rtl.png);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

16
bin/themes/linux/rtl.css Normal file
View File

@ -0,0 +1,16 @@
#navigation-button-next
{
qproperty-themeIcon: "go-previous";
qproperty-fallbackIcon: url(images/go-previous.png);
}
#navigation-button-back
{
qproperty-themeIcon: "go-next";
qproperty-fallbackIcon: url(images/go-next.png);
}
#locationbar-goicon
{
qproperty-pixmap: url(images/gotoaddress_rtl.png);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 B

19
bin/themes/mac/rtl.css Normal file
View File

@ -0,0 +1,19 @@
#navigation-button-next
{
qproperty-multiIcon: url(images/navigation-back.png);
}
#navigation-button-back
{
qproperty-multiIcon: url(images/navigation-forward.png);
}
#tabwidget-button-opentabs
{
qproperty-multiIcon: url(images/tabs-list-button_rtl.png);
}
#locationbar-goicon
{
qproperty-pixmap: url(images/gotoaddress_rtl.png);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 927 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

View File

@ -0,0 +1,24 @@
#navigation-button-next
{
qproperty-multiIcon: url(images/navigation-back.png);
}
#navigation-button-back
{
qproperty-multiIcon: url(images/navigation-forward.png);
}
#tabwidget-button-opentabs
{
qproperty-multiIcon: url(images/tabs-list-button_rtl.png);
}
#tabwidget-button-addtab
{
qproperty-multiIcon: url(images/tabbar-addtab_rtl.png);
}
#locationbar-goicon
{
qproperty-pixmap: url(images/gotoaddress_rtl.png);
}

View File

@ -301,6 +301,15 @@ void MainApplication::loadSettings()
} }
#endif #endif
//RTL Support
//loading 'rtl.css' when layout is right to left!
if ( isRightToLeft() && QFile(m_activeThemePath + "rtl.css").exists()) {
cssFile.setFileName(m_activeThemePath + "rtl.css");
cssFile.open(QFile::ReadOnly);
css.append(cssFile.readAll());
cssFile.close();
}
QString relativePath = QDir::current().relativeFilePath(m_activeThemePath); QString relativePath = QDir::current().relativeFilePath(m_activeThemePath);
css.replace(QRegExp("url\\s*\\(\\s*([^\\*:\\);]+)\\s*\\)", Qt::CaseSensitive, QRegExp::RegExp2), css.replace(QRegExp("url\\s*\\(\\s*([^\\*:\\);]+)\\s*\\)", Qt::CaseSensitive, QRegExp::RegExp2),
QString("url(%1\\1)").arg(relativePath + "/")); QString("url(%1\\1)").arg(relativePath + "/"));

View File

@ -169,10 +169,22 @@ QIcon IconProvider::standardIcon(QStyle::StandardPixmap icon)
return QIcon(":/icons/faenza/reload.png"); return QIcon(":/icons/faenza/reload.png");
case QStyle::SP_ArrowForward: case QStyle::SP_ArrowForward:
//RTL Support
if (QApplication::layoutDirection() == Qt::RightToLeft) {
return QIcon(":/icons/faenza/back.png");
}
else {
return QIcon(":/icons/faenza/forward.png"); return QIcon(":/icons/faenza/forward.png");
}
case QStyle::SP_ArrowBack: case QStyle::SP_ArrowBack:
//RTL Support
if (QApplication::layoutDirection() == Qt::RightToLeft) {
return QIcon(":/icons/faenza/forward.png");
}
else {
return QIcon(":/icons/faenza/back.png"); return QIcon(":/icons/faenza/back.png");
}
default: default:
return QIcon(); return QIcon();

View File

@ -217,6 +217,10 @@ QSize TabBar::tabSizeHint(int index) const
if (m_adjustingLastTab) { if (m_adjustingLastTab) {
xForAddTabButton += m_lastTabWidth - m_normalTabWidth; xForAddTabButton += m_lastTabWidth - m_normalTabWidth;
} }
//RTL Support
if (QApplication::layoutDirection() == Qt::RightToLeft) {
xForAddTabButton = width() - xForAddTabButton;
}
emit tabBar->moveAddTabButton(xForAddTabButton); emit tabBar->moveAddTabButton(xForAddTabButton);
} }

View File

@ -163,7 +163,13 @@ void TabWidget::resizeEvent(QResizeEvent* e)
{ {
QPoint posit; QPoint posit;
posit.setY(0); posit.setY(0);
//RTL Support
if (QApplication::layoutDirection() == Qt::RightToLeft) {
posit.setX(0);
}
else {
posit.setX(width() - m_buttonListTabs->width()); posit.setX(width() - m_buttonListTabs->width());
}
m_buttonListTabs->move(posit); m_buttonListTabs->move(posit);
QTabWidget::resizeEvent(e); QTabWidget::resizeEvent(e);
@ -194,6 +200,10 @@ void TabWidget::hideButtons()
void TabWidget::moveAddTabButton(int posX) void TabWidget::moveAddTabButton(int posX)
{ {
int posY = (m_tabBar->height() - m_buttonAddTab->height()) / 2; int posY = (m_tabBar->height() - m_buttonAddTab->height()) / 2;
//RTL Support
if (QApplication::layoutDirection() == Qt::RightToLeft) {
posX = posX - m_buttonAddTab->width();
}
m_buttonAddTab->move(posX, posY); m_buttonAddTab->move(posX, posY);
} }