Commit a9ba75ac authored by Claudio Valerio's avatar Claudio Valerio

removed globalStyleSheet()

parent 5a6de660
......@@ -645,22 +645,6 @@ void UBStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment,
painter->setPen(savedPen);
}
QString UBApplication::globalStyleSheet()
{
QString style;
QFile f(":style.qss");
if(f.exists())
{
if(f.open(QIODevice::ReadOnly))
{
style = QString(f.readAll());
}
}
return style;
}
QString UBApplication::urlFromHtml(QString html)
{
QString _html;
......
......@@ -78,7 +78,6 @@ class UBApplication : public QtSingleApplication
static void setDisabled(bool disable);
static QObject* staticMemoryCleaner;
static QString globalStyleSheet();
void decorateActionMenu(QAction* action);
void insertSpaceToToolbarBeforeAction(QToolBar* toolbar, QAction* action, int width = -1);
......
......@@ -35,8 +35,7 @@ UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name)
, mpMediaContainer(NULL)
, mpCover(NULL)
{
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
SET_STYLE_SHEET();
addAction(eAction_Close);
mType = type;
......
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBGLOBALS_H
#define UBGLOBALS_H
#include <QString>
#include <QFile>
#define DELETEPTR(ptr) if(NULL != ptr){ \
delete ptr; \
ptr = NULL; \
}
#define SET_STYLE_SHEET() {\
setAttribute(Qt::WA_StyledBackground, true);\
QString style;\
QFile f(":style.qss");\
if(f.exists() && f.open(QIODevice::ReadOnly))\
style = QString(f.readAll());\
setStyleSheet(style);\
}
#ifdef Q_WS_WIN
#define WARNINGS_DISABLE __pragma(warning(push, 0));
......
......@@ -7,6 +7,7 @@
#include "core/UBApplication.h"
#include "core/UBApplicationController.h"
#include "globals/UBGlobals.h"
#include "board/UBBoardController.h"
#include "domain/UBGraphicsScene.h"
......@@ -34,8 +35,8 @@ UBCachePropertiesWidget::UBCachePropertiesWidget(QWidget *parent, const char *na
, mpCurrentCache(NULL)
{
setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
SET_STYLE_SHEET();
mName = "CachePropWidget";
mVisibleState = false;
......
......@@ -15,6 +15,8 @@
#include "UBDockDownloadWidget.h"
#include "core/UBApplication.h"
#include "globals/UBGlobals.h"
UBDockDownloadWidget::UBDockDownloadWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent, name)
, mpLayout(NULL)
, mpDLWidget(NULL)
......@@ -22,8 +24,7 @@ UBDockDownloadWidget::UBDockDownloadWidget(QWidget *parent, const char *name):UB
mName = "DownloadWidget";
mVisibleState = false;
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
SET_STYLE_SHEET();
mIconToLeft = QPixmap(":images/download_open.png");
mIconToRight = QPixmap(":images/download_close.png");
......
......@@ -26,8 +26,7 @@ UBDockTeacherGuideWidget::UBDockTeacherGuideWidget(QWidget* parent, const char*
{
mName = "TeacherGuide";
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
SET_STYLE_SHEET();
mIconToLeft = QPixmap(":images/teacher_open.png");
mIconToRight = QPixmap(":images/teacher_close.png");
......
......@@ -18,8 +18,10 @@
#include <QApplication>
#include "UBDownloadWidget.h"
#include "core/UBApplication.h"
#include "globals/UBGlobals.h"
#include "core/UBApplication.h"
#include "core/memcheck.h"
/**
......@@ -36,8 +38,7 @@ UBDownloadWidget::UBDownloadWidget(QWidget *parent, const char *name):QWidget(pa
{
setObjectName(name);
setWindowTitle(tr("Downloading files"));
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
SET_STYLE_SHEET();
resize(400, 300);
mpLayout = new QVBoxLayout(this);
......
......@@ -18,10 +18,12 @@
#include "core/UBApplication.h"
#include "core/UBDownloadManager.h"
#include "core/memcheck.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
#include "globals/UBGlobals.h"
/**
* \brief Constructor
......@@ -43,8 +45,7 @@ UBLibItemProperties::UBLibItemProperties(QWidget *parent, const char *name):QWid
{
setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
SET_STYLE_SHEET();
// Create the GUI
mpLayout = new QVBoxLayout(this);
......
......@@ -18,6 +18,8 @@
#include "core/UBApplication.h"
#include "core/memcheck.h"
#include "globals/UBGlobals.h"
static int lowBoundForSlider = 40;
static int topBoundForSlider = 120;
static int tickIntervalForSlider = 10;
......@@ -35,8 +37,7 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
{
setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
SET_STYLE_SHEET();
setAcceptDrops(true);
......
#include <QDomDocument>
#include "core/UBApplication.h"
#include "core/memcheck.h"
#include "board/UBBoardController.h"
#include "globals/UBGlobals.h"
#include "UBLibWebView.h"
#include "core/memcheck.h"
UBLibWebView::UBLibWebView(QWidget* parent, const char* name):QWidget(parent)
, mpView(NULL)
......@@ -15,8 +19,7 @@ UBLibWebView::UBLibWebView(QWidget* parent, const char* name):QWidget(parent)
{
setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
SET_STYLE_SHEET();
mpLayout = new QVBoxLayout();
setLayout(mpLayout);
......
......@@ -15,10 +15,12 @@
#include <QDebug>
#include "UBLibWidget.h"
#include "core/UBApplication.h"
#include "core/UBApplication.h"
#include "core/memcheck.h"
#include "globals/UBGlobals.h"
/**
* \brief Constructor
* @param parent as the parent widget
......@@ -37,8 +39,7 @@ UBLibWidget::UBLibWidget(QWidget *parent, const char *name):UBDockPaletteWidget(
mName = "LibWidget";
mVisibleState = true;
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
SET_STYLE_SHEET();
mIconToLeft = QPixmap(":images/library_open.png");
mIconToRight = QPixmap(":images/library_close.png");
......
......@@ -14,9 +14,12 @@
*/
#include "UBPageNavigationWidget.h"
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "core/memcheck.h"
#include "board/UBBoardController.h"
#include "globals/UBGlobals.h"
/**
* \brief Constructor
* @param parent as the parent widget
......@@ -32,8 +35,8 @@ UBPageNavigationWidget::UBPageNavigationWidget(QWidget *parent, const char *name
setObjectName(name);
mName = "PageNavigator";
mVisibleState = true;
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
SET_STYLE_SHEET();
mIconToRight = QPixmap(":images/pages_open.png");
mIconToLeft = QPixmap(":images/pages_close.png");
......
......@@ -87,7 +87,8 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const
mpTreeWidget->setColumnCount(2);
mpTreeWidget->header()->setStretchLastSection(false);
mpTreeWidget->header()->setResizeMode(0, QHeaderView::Stretch);
mpTreeWidget->header()->setResizeMode(1, QHeaderView::Custom);
mpTreeWidget->header()->setResizeMode(1, QHeaderView::Fixed);
mpTreeWidget->header()->setDefaultSectionSize(32);
connect(mpTreeWidget,SIGNAL(itemClicked(QTreeWidgetItem*,int)),this,SLOT(onAddItemClicked(QTreeWidgetItem*,int)));
......@@ -158,7 +159,9 @@ QVector<tUBGEElementNode*> UBTeacherGuideEditionWidget::getData()
children << getChildrenList(mpAddALinkItem);
result << getPageAndCommentData();
foreach(QTreeWidgetItem* widgetItem, children){
result << dynamic_cast<iUBTGSavableData*>(mpTreeWidget->itemWidget(widgetItem,0))->saveData();
tUBGEElementNode* node = dynamic_cast<iUBTGSavableData*>(mpTreeWidget->itemWidget(widgetItem,0))->saveData();
if(node)
result << node;
}
return result;
}
......
......@@ -198,6 +198,8 @@ UBTGMediaWidget::~UBTGMediaWidget()
tUBGEElementNode* UBTGMediaWidget::saveData()
{
if(!mpTitle)
return 0;
tUBGEElementNode* result = new tUBGEElementNode();
result->type = "media";
result->attributes.insert("title",mpTitle->toPlainText());
......
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