r19956 by craig - Move status bar styles to scribus.css and adjust code

scribus-commit scribus-commit at lists.scribus.net
Sun Mar 29 19:25:23 UTC 2015


Author: craig
Date: Sun Mar 29 19:25:23 2015
New Revision: 19956

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19956
Log:
Move status bar styles to scribus.css and adjust code

Added:
    trunk/Scribus/scribus/scribus.css
Modified:
    trunk/Scribus/scribus/CMakeLists.txt
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/ui/pageselector.cpp

Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19956&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Sun Mar 29 19:25:23 2015
@@ -1368,3 +1368,9 @@
 ELSE(WANT_HEADERINSTALL)
 	MESSAGE(STATUS "No source header files will be installed")
 ENDIF(WANT_HEADERINSTALL)
+
+#Install our stylesheet
+INSTALL(FILES
+	scribus.css
+	DESTINATION ${LIBDIR}
+)

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19956&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Mar 29 19:25:23 2015
@@ -1229,37 +1229,6 @@
 	layerMenu->setFocusPolicy(Qt::NoFocus);
 	layerMenu->setSizeAdjustPolicy(QComboBox::AdjustToContents);
 
-	QString downArrow(ScPaths::instance().iconDir()+"16/go-down.png");
-
-	QString comboStyleSheet1 ("QComboBox#layerMenu { border: 1px solid gray; height: 20px; width:5em; }"
-							 "QComboBox::down-arrow { image: url("+downArrow+"); width: 12px; height 12px;}"
-							 "QComboBox::down-arrow:on { top: 1px; left: 1px; }"
-							 "QComboBox:editable { background: white; }"
-							 "QComboBox:!editable, QComboBox::drop-down:editable { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);}"
-							 "QComboBox:!editable:on, QComboBox::drop-down:editable:on { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D3D3D3, stop: 0.4 #D8D8D8, stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1); }"
-							 "QComboBox:on { padding-top: 3px; padding-left: 4px; }"
-							 "QComboBox::drop-down { subcontrol-origin: padding; subcontrol-position: top right; width: 15px; border-left-width: 1px; border-left-color: darkgray; border-left-style: solid; border-top-right-radius: 3px; border-bottom-right-radius: 3px; }"
-
-							 );
-
-	QString comboStyleSheet2 ("QComboBox#unitSwitcher { border: 1px solid gray; height: 20px; width:2em; }"
-							 "QComboBox::down-arrow { image: url("+downArrow+"); width: 12px; height 12px;}"
-							 "QComboBox::down-arrow:on { top: 1px; left: 1px; }"
-							 "QComboBox:editable { background: white; }"
-							 "QComboBox:!editable, QComboBox::drop-down:editable { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);}"
-							 "QComboBox:!editable:on, QComboBox::drop-down:editable:on { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D3D3D3, stop: 0.4 #D8D8D8, stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1); }"
-							 "QComboBox:on { padding-top: 3px; padding-left: 4px; }"
-							 "QComboBox:drop-down { subcontrol-origin: padding; subcontrol-position: top right; width: 20px; border-left-width: 1px; border-left-color: darkgray; border-left-style: solid; }"
-
-							 );
-
-	QString buttonStyleSheet("QPushButton { height: 20px; width: 20px; border: 0px; } "
-							 "QPushButton:hover { border: 1px solid gray ; }"
-							 "QPushButton:pressed { border: 1px solid gray; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #dadbde, stop: 1 #f6f7fa); }");
-
-	QString zoomStyleSheet("QSpinBox { height: 20px; width: 3em; padding-right: 15px; }"
-						   );
-
 	pageSelector = new PageSelector(this, 1);
 	pageSelector->setObjectName("pageSelector");
 	pageSelector->setFont(fo);
@@ -1306,6 +1275,29 @@
 	mainWindowYPosDataLabel->setMinimumWidth(mainWindowYPosDataLabel->fontMetrics().width("99999.999"));
 	statusBarLanguageChange();
 
+	QByteArray stylesheet;
+	if (loadRawText(ScPaths::instance().libDir() + "scribus.css", stylesheet))
+	{
+		QString downArrow(ScPaths::instance().iconDir()+"16/go-down.png");
+		QByteArray da;
+		da.append(downArrow);
+		stylesheet.replace("___downArrow___", da);
+	}
+
+	layerMenu->setObjectName("layerMenu");
+	unitSwitcher->setObjectName("unitSwitcher");
+	zoomDefaultToolbarButton->setObjectName("zoomDefaultToolbarButton");
+	zoomInToolbarButton->setObjectName("zoomInToolbarButton");
+	zoomOutToolbarButton->setObjectName("zoomOutToolbarButton");
+	zoomSpinBox->setObjectName("zoomSpinBox");
+
+	layerMenu->setStyleSheet(stylesheet);
+	unitSwitcher->setStyleSheet(stylesheet);
+	zoomDefaultToolbarButton->setStyleSheet(stylesheet);
+	zoomInToolbarButton->setStyleSheet(stylesheet);
+	zoomOutToolbarButton->setStyleSheet(stylesheet);
+	zoomSpinBox->setStyleSheet(stylesheet);
+
 	statusBar()->setFont(fo);
 	statusBar()->addPermanentWidget(mainWindowStatusLabel, 5);
 	QLabel *s=new QLabel("");
@@ -1325,13 +1317,6 @@
 	statusBar()->addPermanentWidget(unitSwitcher,0);
 	statusBar()->addPermanentWidget(mainWindowProgressBar, 0);
 	connect(statusBar(), SIGNAL(messageChanged(const QString &)), this, SLOT(setTempStatusBarText(const QString &)));
-
-	layerMenu->setStyleSheet(comboStyleSheet1);
-	unitSwitcher->setStyleSheet(comboStyleSheet2);
-	zoomDefaultToolbarButton->setStyleSheet(buttonStyleSheet);
-	zoomInToolbarButton->setStyleSheet(buttonStyleSheet);
-	zoomOutToolbarButton->setStyleSheet(buttonStyleSheet);
-	zoomSpinBox->setStyleSheet(zoomStyleSheet);
 
 }
 

Modified: trunk/Scribus/scribus/ui/pageselector.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19956&path=/trunk/Scribus/scribus/ui/pageselector.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pageselector.cpp (original)
+++ trunk/Scribus/scribus/ui/pageselector.cpp Sun Mar 29 19:25:23 2015
@@ -6,6 +6,8 @@
 */
 #include "pageselector.h"
 
+#include <QByteArray>
+#include <QDebug>
 #include <QEvent>
 #include <QHBoxLayout>
 #include <QLabel>
@@ -31,26 +33,32 @@
 	PageSelectorLayout->setSpacing(1);
 
 	startButton = new QPushButton( this );
+	backButton = new QPushButton( this );
+	forwardButton = new QPushButton( this );
+	lastButton = new QPushButton( this );
+
 	startButton->setDefault( false );
+	backButton->setDefault( false );
+	forwardButton->setDefault( false );
+	lastButton->setDefault( false );
+
 	startButton->setAutoDefault( false );
-	backButton = new QPushButton( this );
-	backButton->setDefault( false );
 	backButton->setAutoDefault( false );
-	forwardButton = new QPushButton( this );
-	forwardButton->setDefault( false );
 	forwardButton->setAutoDefault( false );
-	lastButton = new QPushButton( this );
-	lastButton->setDefault( false );
 	lastButton->setAutoDefault( false );
 
 	startButton->setIcon(QIcon(loadIcon("16/go-first.png")));
+	backButton->setIcon(QIcon(loadIcon("16/go-previous.png")));
+	forwardButton->setIcon(QIcon(loadIcon("16/go-next.png")));
+	lastButton->setIcon(QIcon(loadIcon("16/go-last.png")));
+
 	startButton->setFocusPolicy(Qt::NoFocus);
-	PageSelectorLayout->addWidget( startButton );
-
-	backButton->setIcon(QIcon(loadIcon("16/go-previous.png")));
 	backButton->setFocusPolicy(Qt::NoFocus);
+	forwardButton->setFocusPolicy(Qt::NoFocus);
+	lastButton->setFocusPolicy(Qt::NoFocus);
+
+	forwardButton->setAutoRepeat(true);
 	backButton->setAutoRepeat(true);
-	PageSelectorLayout->addWidget( backButton );
 
 	m_validator = new QIntValidator(1, m_lastPage, this);
 	m_pageCombo = new ScComboBox( this );
@@ -59,25 +67,13 @@
 	m_pageCombo->setInsertPolicy(QComboBox::NoInsert);
 	m_pageCombo->lineEdit()->setAlignment(Qt::AlignHCenter);
 	for (int i = 0; i < m_lastPage; ++i)
-	{
 		m_pageCombo->addItem(QString::number(i+1));
-	}
 	m_pageCombo->setValidator(m_validator);
 	m_pageCombo->setMinimumSize(fontMetrics().width( "9999" )+20, 20);
 	m_pageCombo->setFocusPolicy(Qt::ClickFocus);
-	PageSelectorLayout->addWidget( m_pageCombo );
 	
 	pageCountLabel = new QLabel(PageCountString.arg(m_lastPage), this);
-	PageSelectorLayout->addWidget(pageCountLabel);
-			
-	forwardButton->setIcon(QIcon(loadIcon("16/go-next.png")));
-	forwardButton->setFocusPolicy(Qt::NoFocus);
-	forwardButton->setAutoRepeat(true);
-	PageSelectorLayout->addWidget( forwardButton );
-
-	lastButton->setIcon(QIcon(loadIcon("16/go-last.png")));
-	lastButton->setFocusPolicy(Qt::NoFocus);
-	PageSelectorLayout->addWidget( lastButton );
+
 	forwardButton->setEnabled(true);
 	lastButton->setEnabled(true);
 	backButton->setEnabled(false);
@@ -88,27 +84,23 @@
 		lastButton->setEnabled(false);
 	}
 
-	QString buttonStyleSheet("QPushButton { height: 20px; width: 20px; border: 0px; } "
-							 "QPushButton:hover { border: 1px solid gray ; }"
-							 "QPushButton:pressed { border: 1px solid gray; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #dadbde, stop: 1 #f6f7fa); }");
-	startButton->setStyleSheet(buttonStyleSheet);
-	backButton->setStyleSheet(buttonStyleSheet);
-	forwardButton->setStyleSheet(buttonStyleSheet);
-	lastButton->setStyleSheet(buttonStyleSheet);
-
-	QString downArrow(ScPaths::instance().iconDir()+"16/go-down.png");
-
-	QString comboStyleSheet ("QComboBox { border: 1px solid gray; height: 20px; }"
-							 "QComboBox::down-arrow { image: url("+downArrow+"); width: 12px; height 12px;}"
-							 "QComboBox::down-arrow:on { top: 1px; left: 1px; }"
-							 "QComboBox:editable { background: white; }"
-							 "QComboBox:!editable, QComboBox::drop-down:editable { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);}"
-							 "QComboBox:!editable:on, QComboBox::drop-down:editable:on { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D3D3D3, stop: 0.4 #D8D8D8, stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1); }"
-							 "QComboBox:on { padding-top: 3px; padding-left: 4px; }"
-							 "QComboBox::drop-down { subcontrol-origin: padding; subcontrol-position: top right; width: 15px; border-left-width: 1px; border-left-color: darkgray; border-left-style: solid; border-top-right-radius: 3px; border-bottom-right-radius: 3px; }"
-
-							 );
-	m_pageCombo->setStyleSheet(comboStyleSheet);
+	QByteArray stylesheet;
+	if (loadRawText(ScPaths::instance().libDir() + "scribus.css", stylesheet))
+	{
+		QString downArrow(ScPaths::instance().iconDir()+"16/go-down.png");
+		QByteArray da;
+		da.append(downArrow);
+		stylesheet.replace("___downArrow___", da);
+		setStyleSheet(QString(stylesheet));
+	}
+
+	PageSelectorLayout->addWidget( startButton );
+	PageSelectorLayout->addWidget( backButton );
+	PageSelectorLayout->addWidget( m_pageCombo );
+	PageSelectorLayout->addWidget(pageCountLabel);
+	PageSelectorLayout->addWidget( forwardButton );
+	PageSelectorLayout->addWidget( lastButton );
+
 
 	languageChange();
 	// signals and slots connections




More information about the scribus-commit mailing list