removed globalStyleSheet()

preferencesAboutTextFull
Claudio Valerio 13 years ago
parent 5a6de660d2
commit a9ba75acbb
  1. 16
      src/core/UBApplication.cpp
  2. 1
      src/core/UBApplication.h
  3. 3
      src/customWidgets/UBMediaWidget.cpp
  4. 27
      src/globals/UBGlobals.h
  5. 5
      src/gui/UBCachePropertiesWidget.cpp
  6. 5
      src/gui/UBDockDownloadWidget.cpp
  7. 3
      src/gui/UBDockTeacherGuideWidget.cpp
  8. 7
      src/gui/UBDownloadWidget.cpp
  9. 7
      src/gui/UBLibItemProperties.cpp
  10. 5
      src/gui/UBLibNavigatorWidget.cpp
  11. 9
      src/gui/UBLibWebView.cpp
  12. 7
      src/gui/UBLibWidget.cpp
  13. 9
      src/gui/UBPageNavigationWidget.cpp
  14. 7
      src/gui/UBTeacherGuideWidget.cpp
  15. 2
      src/gui/UBTeacherGuideWidgetsTools.cpp

@ -645,22 +645,6 @@ void UBStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment,
painter->setPen(savedPen); 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 UBApplication::urlFromHtml(QString html)
{ {
QString _html; QString _html;

@ -78,7 +78,6 @@ class UBApplication : public QtSingleApplication
static void setDisabled(bool disable); static void setDisabled(bool disable);
static QObject* staticMemoryCleaner; static QObject* staticMemoryCleaner;
static QString globalStyleSheet();
void decorateActionMenu(QAction* action); void decorateActionMenu(QAction* action);
void insertSpaceToToolbarBeforeAction(QToolBar* toolbar, QAction* action, int width = -1); void insertSpaceToToolbarBeforeAction(QToolBar* toolbar, QAction* action, int width = -1);

@ -35,8 +35,7 @@ UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name)
, mpMediaContainer(NULL) , mpMediaContainer(NULL)
, mpCover(NULL) , mpCover(NULL)
{ {
setAttribute(Qt::WA_StyledBackground, true); SET_STYLE_SHEET();
setStyleSheet(UBApplication::globalStyleSheet());
addAction(eAction_Close); addAction(eAction_Close);
mType = type; mType = type;

@ -1,11 +1,38 @@
/*
* 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 #ifndef UBGLOBALS_H
#define UBGLOBALS_H #define UBGLOBALS_H
#include <QString>
#include <QFile>
#define DELETEPTR(ptr) if(NULL != ptr){ \ #define DELETEPTR(ptr) if(NULL != ptr){ \
delete ptr; \ delete ptr; \
ptr = NULL; \ 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 #ifdef Q_WS_WIN
#define WARNINGS_DISABLE __pragma(warning(push, 0)); #define WARNINGS_DISABLE __pragma(warning(push, 0));

@ -7,6 +7,7 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBApplicationController.h" #include "core/UBApplicationController.h"
#include "globals/UBGlobals.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "domain/UBGraphicsScene.h" #include "domain/UBGraphicsScene.h"
@ -34,8 +35,8 @@ UBCachePropertiesWidget::UBCachePropertiesWidget(QWidget *parent, const char *na
, mpCurrentCache(NULL) , mpCurrentCache(NULL)
{ {
setObjectName(name); setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet()); SET_STYLE_SHEET();
mName = "CachePropWidget"; mName = "CachePropWidget";
mVisibleState = false; mVisibleState = false;

@ -15,6 +15,8 @@
#include "UBDockDownloadWidget.h" #include "UBDockDownloadWidget.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "globals/UBGlobals.h"
UBDockDownloadWidget::UBDockDownloadWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent, name) UBDockDownloadWidget::UBDockDownloadWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent, name)
, mpLayout(NULL) , mpLayout(NULL)
, mpDLWidget(NULL) , mpDLWidget(NULL)
@ -22,8 +24,7 @@ UBDockDownloadWidget::UBDockDownloadWidget(QWidget *parent, const char *name):UB
mName = "DownloadWidget"; mName = "DownloadWidget";
mVisibleState = false; mVisibleState = false;
setAttribute(Qt::WA_StyledBackground, true); SET_STYLE_SHEET();
setStyleSheet(UBApplication::globalStyleSheet());
mIconToLeft = QPixmap(":images/download_open.png"); mIconToLeft = QPixmap(":images/download_open.png");
mIconToRight = QPixmap(":images/download_close.png"); mIconToRight = QPixmap(":images/download_close.png");

@ -26,8 +26,7 @@ UBDockTeacherGuideWidget::UBDockTeacherGuideWidget(QWidget* parent, const char*
{ {
mName = "TeacherGuide"; mName = "TeacherGuide";
setAttribute(Qt::WA_StyledBackground, true); SET_STYLE_SHEET();
setStyleSheet(UBApplication::globalStyleSheet());
mIconToLeft = QPixmap(":images/teacher_open.png"); mIconToLeft = QPixmap(":images/teacher_open.png");
mIconToRight = QPixmap(":images/teacher_close.png"); mIconToRight = QPixmap(":images/teacher_close.png");

@ -18,8 +18,10 @@
#include <QApplication> #include <QApplication>
#include "UBDownloadWidget.h" #include "UBDownloadWidget.h"
#include "core/UBApplication.h"
#include "globals/UBGlobals.h"
#include "core/UBApplication.h"
#include "core/memcheck.h" #include "core/memcheck.h"
/** /**
@ -36,8 +38,7 @@ UBDownloadWidget::UBDownloadWidget(QWidget *parent, const char *name):QWidget(pa
{ {
setObjectName(name); setObjectName(name);
setWindowTitle(tr("Downloading files")); setWindowTitle(tr("Downloading files"));
setAttribute(Qt::WA_StyledBackground, true); SET_STYLE_SHEET();
setStyleSheet(UBApplication::globalStyleSheet());
resize(400, 300); resize(400, 300);
mpLayout = new QVBoxLayout(this); mpLayout = new QVBoxLayout(this);

@ -18,10 +18,12 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBDownloadManager.h" #include "core/UBDownloadManager.h"
#include "core/memcheck.h"
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h" #include "globals/UBGlobals.h"
/** /**
* \brief Constructor * \brief Constructor
@ -43,8 +45,7 @@ UBLibItemProperties::UBLibItemProperties(QWidget *parent, const char *name):QWid
{ {
setObjectName(name); setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true); SET_STYLE_SHEET();
setStyleSheet(UBApplication::globalStyleSheet());
// Create the GUI // Create the GUI
mpLayout = new QVBoxLayout(this); mpLayout = new QVBoxLayout(this);

@ -18,6 +18,8 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/memcheck.h" #include "core/memcheck.h"
#include "globals/UBGlobals.h"
static int lowBoundForSlider = 40; static int lowBoundForSlider = 40;
static int topBoundForSlider = 120; static int topBoundForSlider = 120;
static int tickIntervalForSlider = 10; static int tickIntervalForSlider = 10;
@ -35,8 +37,7 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
{ {
setObjectName(name); setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true); SET_STYLE_SHEET();
setStyleSheet(UBApplication::globalStyleSheet());
setAcceptDrops(true); setAcceptDrops(true);

@ -1,11 +1,15 @@
#include <QDomDocument> #include <QDomDocument>
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/memcheck.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "globals/UBGlobals.h"
#include "UBLibWebView.h" #include "UBLibWebView.h"
#include "core/memcheck.h"
UBLibWebView::UBLibWebView(QWidget* parent, const char* name):QWidget(parent) UBLibWebView::UBLibWebView(QWidget* parent, const char* name):QWidget(parent)
, mpView(NULL) , mpView(NULL)
@ -15,8 +19,7 @@ UBLibWebView::UBLibWebView(QWidget* parent, const char* name):QWidget(parent)
{ {
setObjectName(name); setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true); SET_STYLE_SHEET();
setStyleSheet(UBApplication::globalStyleSheet());
mpLayout = new QVBoxLayout(); mpLayout = new QVBoxLayout();
setLayout(mpLayout); setLayout(mpLayout);

@ -15,10 +15,12 @@
#include <QDebug> #include <QDebug>
#include "UBLibWidget.h" #include "UBLibWidget.h"
#include "core/UBApplication.h"
#include "core/UBApplication.h"
#include "core/memcheck.h" #include "core/memcheck.h"
#include "globals/UBGlobals.h"
/** /**
* \brief Constructor * \brief Constructor
* @param parent as the parent widget * @param parent as the parent widget
@ -37,8 +39,7 @@ UBLibWidget::UBLibWidget(QWidget *parent, const char *name):UBDockPaletteWidget(
mName = "LibWidget"; mName = "LibWidget";
mVisibleState = true; mVisibleState = true;
setAttribute(Qt::WA_StyledBackground, true); SET_STYLE_SHEET();
setStyleSheet(UBApplication::globalStyleSheet());
mIconToLeft = QPixmap(":images/library_open.png"); mIconToLeft = QPixmap(":images/library_open.png");
mIconToRight = QPixmap(":images/library_close.png"); mIconToRight = QPixmap(":images/library_close.png");

@ -14,9 +14,12 @@
*/ */
#include "UBPageNavigationWidget.h" #include "UBPageNavigationWidget.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "core/memcheck.h" #include "core/memcheck.h"
#include "board/UBBoardController.h"
#include "globals/UBGlobals.h"
/** /**
* \brief Constructor * \brief Constructor
* @param parent as the parent widget * @param parent as the parent widget
@ -32,8 +35,8 @@ UBPageNavigationWidget::UBPageNavigationWidget(QWidget *parent, const char *name
setObjectName(name); setObjectName(name);
mName = "PageNavigator"; mName = "PageNavigator";
mVisibleState = true; mVisibleState = true;
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet()); SET_STYLE_SHEET();
mIconToRight = QPixmap(":images/pages_open.png"); mIconToRight = QPixmap(":images/pages_open.png");
mIconToLeft = QPixmap(":images/pages_close.png"); mIconToLeft = QPixmap(":images/pages_close.png");

@ -87,7 +87,8 @@ UBTeacherGuideEditionWidget::UBTeacherGuideEditionWidget(QWidget *parent, const
mpTreeWidget->setColumnCount(2); mpTreeWidget->setColumnCount(2);
mpTreeWidget->header()->setStretchLastSection(false); mpTreeWidget->header()->setStretchLastSection(false);
mpTreeWidget->header()->setResizeMode(0, QHeaderView::Stretch); 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))); connect(mpTreeWidget,SIGNAL(itemClicked(QTreeWidgetItem*,int)),this,SLOT(onAddItemClicked(QTreeWidgetItem*,int)));
@ -158,7 +159,9 @@ QVector<tUBGEElementNode*> UBTeacherGuideEditionWidget::getData()
children << getChildrenList(mpAddALinkItem); children << getChildrenList(mpAddALinkItem);
result << getPageAndCommentData(); result << getPageAndCommentData();
foreach(QTreeWidgetItem* widgetItem, children){ 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; return result;
} }

@ -198,6 +198,8 @@ UBTGMediaWidget::~UBTGMediaWidget()
tUBGEElementNode* UBTGMediaWidget::saveData() tUBGEElementNode* UBTGMediaWidget::saveData()
{ {
if(!mpTitle)
return 0;
tUBGEElementNode* result = new tUBGEElementNode(); tUBGEElementNode* result = new tUBGEElementNode();
result->type = "media"; result->type = "media";
result->attributes.insert("title",mpTitle->toPlainText()); result->attributes.insert("title",mpTitle->toPlainText());

Loading…
Cancel
Save