removed globalStyleSheet()

preferencesAboutTextFull
Claudio Valerio 13 years ago
parent 5a6de660d2
commit a9ba75acbb
  1. 26
      src/core/UBApplication.cpp
  2. 1
      src/core/UBApplication.h
  3. 3
      src/customWidgets/UBMediaWidget.cpp
  4. 35
      src/globals/UBGlobals.h
  5. 9
      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. 7
      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

@ -257,10 +257,10 @@ int UBApplication::exec(const QString& pFileToImport)
applicationController = new UBApplicationController(boardController->controlView(), boardController->displayView(), mainWindow, staticMemoryCleaner); applicationController = new UBApplicationController(boardController->controlView(), boardController->displayView(), mainWindow, staticMemoryCleaner);
connect(applicationController, SIGNAL(mainModeChanged(UBApplicationController::MainMode)), connect(applicationController, SIGNAL(mainModeChanged(UBApplicationController::MainMode)),
boardController->paletteManager(), SLOT(slot_changeMainMode(UBApplicationController::MainMode))); boardController->paletteManager(), SLOT(slot_changeMainMode(UBApplicationController::MainMode)));
connect(applicationController, SIGNAL(desktopMode(bool)), connect(applicationController, SIGNAL(desktopMode(bool)),
boardController->paletteManager(), SLOT(slot_changeDesktopMode(bool))); boardController->paletteManager(), SLOT(slot_changeDesktopMode(bool)));
@ -283,8 +283,8 @@ int UBApplication::exec(const QString& pFileToImport)
connect(mainWindow->actionSankoreEditor, SIGNAL(triggered()), applicationController, SLOT(showSankoreEditor())); connect(mainWindow->actionSankoreEditor, SIGNAL(triggered()), applicationController, SLOT(showSankoreEditor()));
connect(mainWindow->actionCheckUpdate, SIGNAL(triggered()), applicationController, SLOT(checkUpdateRequest())); connect(mainWindow->actionCheckUpdate, SIGNAL(triggered()), applicationController, SLOT(checkUpdateRequest()));
toolBarPositionChanged(UBSettings::settings()->appToolBarPositionedAtTop->get()); toolBarPositionChanged(UBSettings::settings()->appToolBarPositionedAtTop->get());
bool bUseMultiScreen = UBSettings::settings()->appUseMultiscreen->get().toBool(); bool bUseMultiScreen = UBSettings::settings()->appUseMultiscreen->get().toBool();
@ -645,29 +645,13 @@ 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;
QRegExp comments("\\<![ \r\n\t]*(--([^\\-]|[\r\n]|-[^\\-])*--[ \r\n\t]*)\\>"); QRegExp comments("\\<![ \r\n\t]*(--([^\\-]|[\r\n]|-[^\\-])*--[ \r\n\t]*)\\>");
QString url; QString url;
QDomDocument domDoc; QDomDocument domDoc;
// We remove all the comments & CRLF of this html // We remove all the comments & CRLF of this html
_html = html.remove(comments); _html = html.remove(comments);
domDoc.setContent(_html.remove(QRegExp("[\\0]"))); domDoc.setContent(_html.remove(QRegExp("[\\0]")));

@ -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));
@ -14,7 +41,7 @@
#ifdef NO_THIRD_PARTY_WARNINGS #ifdef NO_THIRD_PARTY_WARNINGS
// disabling warning level to 0 and save old state // disabling warning level to 0 and save old state
#define THIRD_PARTY_WARNINGS_DISABLE WARNINGS_DISABLE #define THIRD_PARTY_WARNINGS_DISABLE WARNINGS_DISABLE
#else #else
// just save old state (needs for not empty define) // just save old state (needs for not empty define)
#define THIRD_PARTY_WARNINGS_DISABLE __pragma(warning(push)); #define THIRD_PARTY_WARNINGS_DISABLE __pragma(warning(push));
#endif //#ifdef NO_THIRD_PARTY_WARNINGS #endif //#ifdef NO_THIRD_PARTY_WARNINGS
@ -24,9 +51,9 @@
#define WARNINGS_DISABLE _Pragma("GCC diagnostic push"); \ #define WARNINGS_DISABLE _Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\""); \ _Pragma("GCC diagnostic ignored \"-Wunused-parameter\""); \
_Pragma("GCC diagnostic ignored \"-Wunused-variable\""); \ _Pragma("GCC diagnostic ignored \"-Wunused-variable\""); \
_Pragma("GCC diagnostic ignored \"-Wsign-compare\""); _Pragma("GCC diagnostic ignored \"-Wsign-compare\"");
#define WARNINGS_ENABLE _Pragma("GCC diagnostic pop"); #define WARNINGS_ENABLE _Pragma("GCC diagnostic pop");
#ifdef NO_THIRD_PARTY_WARNINGS #ifdef NO_THIRD_PARTY_WARNINGS
//disabling some warnings //disabling some warnings
@ -43,4 +70,4 @@ _Pragma("GCC diagnostic ignored \"-Wsign-compare\"");
#define THIRD_PARTY_WARNINGS_ENABLE WARNINGS_ENABLE #define THIRD_PARTY_WARNINGS_ENABLE WARNINGS_ENABLE
#endif // UBGLOBALS_H #endif // UBGLOBALS_H

@ -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;
@ -283,7 +284,7 @@ void UBCachePropertiesWidget::updateCurrentCache()
if( UBApplication::applicationController != NULL ) if( UBApplication::applicationController != NULL )
{ {
// if app controller is available, and current mode is Board, and no show desktop, than all ok, just process // if app controller is available, and current mode is Board, and no show desktop, than all ok, just process
if( UBApplication::applicationController->displayMode() == UBApplicationController::Board && if( UBApplication::applicationController->displayMode() == UBApplicationController::Board &&
!UBApplication::applicationController->isShowingDesktop()) !UBApplication::applicationController->isShowingDesktop())
isBoardMode = true; isBoardMode = true;
} }
@ -348,4 +349,4 @@ void UBCachePropertiesWidget::onCacheEnabled()
{ {
emit showTab(this); emit showTab(this);
} }

@ -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);
@ -62,7 +63,7 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
connect(mLibWidget, SIGNAL(propertiesRequested(UBLibElement*)), this, SLOT(onPropertiesRequested(UBLibElement*))); connect(mLibWidget, SIGNAL(propertiesRequested(UBLibElement*)), this, SLOT(onPropertiesRequested(UBLibElement*)));
connect(mLibWidget, SIGNAL(displaySearchEngine(UBLibElement*)), this, SLOT(onDisplaySearchEngine(UBLibElement*))); connect(mLibWidget, SIGNAL(displaySearchEngine(UBLibElement*)), this, SLOT(onDisplaySearchEngine(UBLibElement*)));
connect(mSlider,SIGNAL(valueChanged(int)),this,SLOT(updateThumbnailsSize(int))); connect(mSlider,SIGNAL(valueChanged(int)),this,SLOT(updateThumbnailsSize(int)));
connect(libWidget->pathViewer(), SIGNAL(mouseClick(UBChainedLibElement*)), this, SLOT(onPathItemClicked(UBChainedLibElement*))); connect(libWidget->pathViewer(), SIGNAL(mouseClick(UBChainedLibElement*)), this, SLOT(onPathItemClicked(UBChainedLibElement*)));
connect(libWidget->pathViewer(), SIGNAL(elementsDropped(QList<QString>,UBLibElement*)), mLibWidget, SLOT(onElementsDropped(QList<QString>,UBLibElement*))); connect(libWidget->pathViewer(), SIGNAL(elementsDropped(QList<QString>,UBLibElement*)), mLibWidget, SLOT(onElementsDropped(QList<QString>,UBLibElement*)));

@ -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