Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
Anatoly Mihalchenko 13 years ago
commit 8e78896b7e
  1. 2
      Sankore_3.1.pro
  2. 2
      release.linux.sh
  3. BIN
      resources/i18n/sankore_es.qm
  4. 2860
      resources/i18n/sankore_es.ts
  5. 240
      resources/images/libpalette/WebSearchCategory.svg
  6. 3
      resources/sankore.qrc
  7. 21
      resources/style.qss
  8. 5
      src/board/UBBoardPaletteManager.cpp
  9. 1
      src/board/UBBoardPaletteManager.h
  10. 35
      src/board/UBLibraryController.cpp
  11. 3
      src/board/UBLibraryController.h
  12. 4
      src/core/UBApplicationController.cpp
  13. 7
      src/core/UBPersistenceManager.cpp
  14. 2
      src/core/UBPersistenceManager.h
  15. 9
      src/core/UBSettings.cpp
  16. 1
      src/core/UBSettings.h
  17. 1
      src/domain/UBGraphicsItemDelegate.cpp
  18. 3
      src/frameworks/UBFileSystemUtils.cpp
  19. 5
      src/gui/UBDocumentNavigator.cpp
  20. 63
      src/gui/UBLibItemProperties.cpp
  21. 6
      src/gui/UBLibItemProperties.h
  22. 61
      src/gui/UBLibNavigatorWidget.cpp
  23. 8
      src/gui/UBLibNavigatorWidget.h
  24. 45
      src/gui/UBLibPathViewer.cpp
  25. 8
      src/gui/UBLibPathViewer.h
  26. 86
      src/gui/UBLibWebView.cpp
  27. 27
      src/gui/UBLibWebView.h
  28. 66
      src/gui/UBLibWidget.cpp
  29. 14
      src/gui/UBLibWidget.h
  30. 26
      src/gui/UBLibraryWidget.cpp
  31. 3
      src/gui/UBLibraryWidget.h
  32. 24
      src/gui/UBMainWindow.cpp
  33. 5
      src/gui/UBMainWindow.h
  34. 41
      src/gui/UBUpdateDlg.cpp
  35. 6
      src/gui/gui.pri
  36. 20
      src/network/UBNetworkAccessManager.cpp
  37. 3
      src/web/browser/WBWebView.cpp

@ -7,7 +7,7 @@ CONFIG += debug_and_release \
no_include_pwd
VERSION_MAJ = 1
VERSION_MIN = 28
VERSION_MIN = 35
VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error
VERSION_PATCH = 00

@ -19,7 +19,7 @@ make clean
rm -rf build/linux/release/
rm -rf install
QT_PATH="/usr/local/Trolltech/Qt-4.7.3"
QT_PATH="../Qt-sankore3.1"
PLUGINS_PATH="$QT_PATH/plugins"
QMAKE_PATH="$QT_PATH/bin/qmake"

Binary file not shown.

File diff suppressed because it is too large Load Diff

@ -0,0 +1,240 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.2"
x="0px"
y="0px"
width="96px"
height="96px"
viewBox="0 -8.898 96 96"
overflow="visible"
xml:space="preserve"
id="svg2"
inkscape:version="0.48.1 r9760"
sodipodi:docname="folder.svg"><metadata
id="metadata70"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1280"
inkscape:window-height="776"
id="namedview68"
showgrid="false"
inkscape:zoom="3"
inkscape:cx="-12.833333"
inkscape:cy="48"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<defs
id="defs4"><linearGradient
id="linearGradient3819"><stop
style="stop-color:#bcd8dc;stop-opacity:1;"
offset="0"
id="stop3821" /><stop
style="stop-color:#7ecbdc;stop-opacity:0;"
offset="1"
id="stop3823" /></linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3819"
id="radialGradient3825"
cx="71.333336"
cy="70.5"
fx="71.333336"
fy="70.5"
r="7.6666665"
gradientTransform="matrix(1,0,0,0.97826089,0,1.5326073)"
gradientUnits="userSpaceOnUse" /></defs>
<g
id="g6">
<path
fill="none"
stroke="#000000"
stroke-miterlimit="10"
d="M0.75,63.903"
id="path8" />
<linearGradient
id="SVGID_1_"
gradientUnits="userSpaceOnUse"
x1="38.2183"
y1="69.7495"
x2="38.2183"
y2="0.7495">
<stop
offset="0"
style="stop-color:#B8B6B7"
id="stop11" />
<stop
offset="1"
style="stop-color:#D9D9DE"
id="stop13" />
</linearGradient>
<path
fill="url(#SVGID_1_)"
d="M75.687,17.069v-5.114c0-1.247-1.021-2.268-2.268-2.268h-42.67V3.75c0-1.657-1.343-3-3-3H3.75 c-1.657,0-3,1.343-3,3v60c0,3.313,1.116,6,2.772,6c1.657,0,2.657-2.682,3.228-6l5.71-44.432c0.159-1.237,1.31-2.249,2.557-2.249 H75.687"
id="path15" />
<path
fill="none"
stroke="#000000"
stroke-miterlimit="10"
d="M0.75,63.903"
id="path17" />
<linearGradient
id="SVGID_2_"
gradientUnits="userSpaceOnUse"
x1="45.7817"
y1="69.7837"
x2="45.7817"
y2="17.0342">
<stop
offset="0"
style="stop-color:#EBEBED"
id="stop20" />
<stop
offset="1"
style="stop-color:#FFFFFF"
id="stop22" />
</linearGradient>
<path
fill="url(#SVGID_2_)"
d="M3.493,69.703c1.657,0.001,2.66-2.679,3.235-5.997l5.76-44.425c0.161-1.237,1.312-2.248,2.559-2.246 l71.136,0.08c1.246,0.001,2.079,1.006,1.851,2.232l-7.891,42.213c-0.229,1.226-0.789,3.18-1.244,4.341c0,0-1.522,3.886-3.18,3.884 l-71.45-0.08L3.493,69.703z"
id="path24" />
<linearGradient
id="SVGID_3_"
gradientUnits="userSpaceOnUse"
x1="47.1133"
y1="69.7495"
x2="47.1133"
y2="19.7071">
<stop
offset="0"
style="stop-color:#C8C8CC"
id="stop27" />
<stop
offset="0.0241"
style="stop-color:#CBCBCF"
id="stop29" />
<stop
offset="0.1455"
style="stop-color:#D6D6DB"
id="stop31" />
<stop
offset="0.2577"
style="stop-color:#D9D9DE"
id="stop33" />
<stop
offset="1"
style="stop-color:#E5E5E9"
id="stop35" />
</linearGradient>
<path
fill="url(#SVGID_3_)"
d="M6.184,69.75c1.605,0,2.574-2.547,3.126-5.699l5.53-42.207c0.154-1.175,1.268-2.136,2.476-2.136 h68.896c1.208,0,2.016,0.953,1.795,2.118l-7.596,40.108c-0.22,1.164-0.761,3.021-1.2,4.124c0,0-1.47,3.692-3.075,3.692H6.935H6.184 z"
id="path37" />
<g
id="g39">
<linearGradient
id="SVGID_4_"
gradientUnits="userSpaceOnUse"
x1="3.6626"
y1="43.4028"
x2="75.8658"
y2="43.4028">
<stop
offset="0"
style="stop-color:#848685"
id="stop42" />
<stop
offset="0.0053"
style="stop-color:#888A89"
id="stop44" />
<stop
offset="0.0344"
style="stop-color:#9A9C9B"
id="stop46" />
<stop
offset="0.0687"
style="stop-color:#A7A9A9"
id="stop48" />
<stop
offset="0.113"
style="stop-color:#AFB0B1"
id="stop50" />
<stop
offset="0.2025"
style="stop-color:#B1B3B4"
id="stop52" />
<stop
offset="0.4988"
style="stop-color:#AFB0B1"
id="stop54" />
<stop
offset="0.6946"
style="stop-color:#A6A7A7"
id="stop56" />
<stop
offset="0.8607"
style="stop-color:#979898"
id="stop58" />
<stop
offset="1"
style="stop-color:#848685"
id="stop60" />
</linearGradient>
<path
fill="url(#SVGID_4_)"
d="M3.663,69.047c0.725-0.279,1.739-1.881,2.349-5.424l5.705-44.401 c0.209-1.628,1.659-2.903,3.3-2.903h60.849v1.5H15.017c-0.871,0-1.701,0.73-1.813,1.594l-5.71,44.433 c-0.735,4.274-1.954,6.455-3.722,6.642L3.663,69.047z"
id="path62" />
</g>
<path
fill="none"
stroke="#848685"
stroke-width="1.5"
stroke-miterlimit="10"
d="M75.687,17.069v-5.114 c0-1.247-1.021-2.268-2.268-2.268h-42.67V3.75c0-1.657-1.343-3-3-3H3.75c-1.657,0-3,1.343-3,3v60c0,3.313,1.116,6,2.772,6"
id="path64" />
<path
fill="none"
stroke="#848685"
stroke-width="1.5"
stroke-miterlimit="10"
d="M75.819,17.069h10.333 c1.247,0,2.081,1.003,1.853,2.229l-7.842,42.223c-0.228,1.226-0.785,3.18-1.239,4.342c0,0-1.519,3.887-3.175,3.887H3.522"
id="path66" />
</g>
<path
sodipodi:type="arc"
style="opacity:1;fill:#00a9dc;fill-opacity:1;stroke:#0078c5;stroke-opacity:1;stroke-width:1.60000000000000009;stroke-miterlimit:4;stroke-dasharray:none"
id="path3047"
sodipodi:cx="70.833336"
sodipodi:cy="71.5"
sodipodi:rx="15.166667"
sodipodi:ry="15.166667"
d="m 86.000003,71.5 a 15.166667,15.166667 0 1 1 -30.333334,0 15.166667,15.166667 0 1 1 30.333334,0 z"
transform="translate(2.3333333,-7.2313333)" /><path
sodipodi:type="arc"
style="fill:url(#radialGradient3825);fill-opacity:1.0;stroke:none"
id="path3817"
sodipodi:cx="71.333336"
sodipodi:cy="70.5"
sodipodi:rx="7.6666665"
sodipodi:ry="7.5"
d="m 79.000002,70.5 a 7.6666665,7.5 0 1 1 -15.333333,0 7.6666665,7.5 0 1 1 15.333333,0 z"
transform="matrix(1.8043479,0,0,1.7111112,-55.876816,-57.031334)" /></svg>

After

Width:  |  Height:  |  Size: 6.7 KiB

@ -319,7 +319,6 @@
<file>images/pages_open.png</file>
<file>images/cache_close.png</file>
<file>images/cache_open.png</file>
<file>style.qss</file>
<file>images/cache_circle.png</file>
<file>images/cache_square.png</file>
<file>images/down_arrow.png</file>
@ -333,6 +332,8 @@
<file>images/teacher_close.png</file>
<file>images/teacher_open.png</file>
<file>images/teacher_close_disabled.png</file>
<file>style.qss</file>
<file>images/teacher_open_disabled.png</file>
<file>images/libpalette/WebSearchCategory.svg</file>
</qresource>
</RCC>

@ -1,13 +1,25 @@
QWidget#DockPaletteWidgetBox,
QWidget#documentNavigator,
QWidget#UBLibraryWidget,
QWidget#UBLibPathViewer,
QWidget#UBTeacherStudentAction
QWidget#UBTeacherStudentAction,
QWidget#UBLibNavigatorWidget,
QWidget#UBLibItemProperties
{
background: #EEEEEE;
border-radius: 10px;
border: 2px solid #999999;
/* padding-bottom: -2px; */
}
QWidget#UBLibWebView
{
background: #EEEEEE;
border-radius : 10px;
border: 2px solid #999999;
}
QWebView#SearchEngineView
{
background:#EEEEEE;
}
QColorDialog
@ -121,8 +133,6 @@ QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical
background:transparent;
}
QScrollBar::horizontal
{
background:transparent;
@ -166,7 +176,6 @@ QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal
background:transparent;
}
QSlider::handle::horizontal
{
background-color:#EEEEEE;

@ -106,6 +106,11 @@ UBBoardPaletteManager::~UBBoardPaletteManager()
delete mpLibWidget;
mpLibWidget = NULL;
}
if(NULL != mpTeacherBarWidget)
{
delete mpTeacherBarWidget;
mpTeacherBarWidget = NULL;
}
if(NULL != mpCachePropWidget)
{
delete mpCachePropWidget;

@ -26,7 +26,6 @@
#include "gui/UBLibWidget.h"
#include "gui/UBCachePropertiesWidget.h"
#include "gui/UBTeacherBarWidget.h"
#include "core/UBApplicationController.h"

@ -222,7 +222,6 @@ QList<UBLibElement*> UBLibraryController::rootCategoriesList()
element->setMoveable(false);
categories << element;
element = new UBLibElement(eUBLibElementType_Folder, mInteractiveUserDirectoryPath, tr("Applications", "Applications category element"));
element->setThumbnail(QImage(":images/libpalette/ApplicationsCategory.svg"));
element->setMoveable(false);
@ -239,11 +238,20 @@ QList<UBLibElement*> UBLibraryController::rootCategoriesList()
element->setMoveable(false);
categories << element;
// Note : FEATURE IN DEVELOPMENT, DO NOT ERASE (or you will get problems) !!!!
// mSearchCategoryPath = QUrl::fromLocalFile(UBSettings::settings()->uniboardSearchDirectory());
// element = new UBLibElement(eUBLibElementType_Folder, mSearchCategoryPath, tr("Web Search", "Web search category element"));
// element->setThumbnail(QImage(":images/libpalette/WebSearchCategory.svg"));
// element->setMoveable(false);
// categories << element;
element = new UBLibElement(eUBLibElementType_Folder, mAnimationUserDirectoryPath, tr("Animations", "Animations category element"));
element->setThumbnail(QImage(":images/libpalette/FlashCategory.svg"));
element->setMoveable(false);
categories << element;
categories << UBLibElement::trashElement();
return categories;
@ -759,6 +767,31 @@ void UBChainedLibElement::setNextElement(UBChainedLibElement *nextElem)
mpNextElem = nextElem;
}
UBChainedLibElement* UBChainedLibElement::lastElement()
{
UBChainedLibElement* pElem = NULL;
if(NULL != mpNextElem)
{
UBChainedLibElement* pLast = mpNextElem->lastElement();
if(NULL != pLast)
{
pElem = pLast;
}
else
{
pElem = mpNextElem;
}
}
return pElem;
}
QUrl UBChainedLibElement::lastItemPath()
{
return lastElement()->element()->path();
}
UBLibElement* UBLibElement::trashElement()
{
UBLibElement *trashElement;

@ -82,8 +82,10 @@ public:
~UBChainedLibElement();
UBChainedLibElement* nextElement(){return mpNextElem;}
UBChainedLibElement* lastElement();
void setNextElement(UBChainedLibElement* nextElem);
UBLibElement* element(){return mpElem;}
QUrl lastItemPath();
private:
UBLibElement* mpElem;
@ -160,6 +162,7 @@ class UBLibraryController : public QObject
QUrl mInteractiveUserDirectoryPath;
QUrl mInteractiveCategoryPath;
QUrl mAnimationUserDirectoryPath;
QUrl mSearchCategoryPath;
QStringList addItemsToCurrentLibrary(const QDir& pSelectedFolder, const QStringList& pExtensions);

@ -566,9 +566,7 @@ void UBApplicationController::downloadJsonFinished(QString currentJson)
}
else {
if (isNoUpdateDisplayed) {
QMessageBox msgBox;
msgBox.setText (tr ("No update available"));
msgBox.exec();
mMainWindow->information(tr("Update"), tr("No update available"));
}
}
}

@ -14,6 +14,7 @@
*/
#include "UBPersistenceManager.h"
#include "gui/UBMainWindow.h"
#include <QtXml>
@ -1005,11 +1006,7 @@ void UBPersistenceManager::checkIfDocumentRepositoryExists()
QString humanPath = QDir::cleanPath(mDocumentRepositoryPath);
humanPath = QDir::toNativeSeparators(humanPath);
QMessageBox::question(
QApplication::activeWindow(),
tr("Document Repository Loss"),
tr("Sankore has lost access to the document repository '%1'. Unfortunately the application must shut down to avoid data corruption. Latest changes may be lost as well.").arg(humanPath),
QMessageBox::Yes);
UBApplication::mainWindow->warning(tr("Document Repository Loss"),tr("Sankore has lost access to the document repository '%1'. Unfortunately the application must shut down to avoid data corruption. Latest changes may be lost as well.").arg(humanPath));
UBApplication::quit();
}

@ -74,8 +74,8 @@ class UBPersistenceManager : public QObject
virtual void persistDocumentScene(UBDocumentProxy* pDocumentProxy,
UBGraphicsScene* pScene, const int pSceneIndex);
virtual void persistTeacherBar(UBDocumentProxy* pDocumentProxy, int page, sTeacherBarInfos infos);
sTeacherBarInfos getTeacherBarInfos(UBDocumentProxy* pDocumentProxy, int page);
virtual UBGraphicsScene* createDocumentSceneAt(UBDocumentProxy* pDocumentProxy, int index);

@ -1020,6 +1020,15 @@ QString UBSettings::uniboardGipLibraryDirectory()
return dirPath;
}
QString UBSettings::uniboardSearchDirectory()
{
QString dirPath = UBPlatformUtils::applicationResourcesDirectory() + "/library/search";
if (!QDir(dirPath).exists())
QDir().mkpath(dirPath);
return dirPath;
}
QString UBSettings::uniboardImageLibraryDirectory()
{
QString defaultRelativePath = QString("./library/image");

@ -112,6 +112,7 @@ class UBSettings : public QObject
QString uniboardImageLibraryDirectory();
QString uniboardUserImageDirectory();
QString defaultUserImagesDirectory();
QString uniboardSearchDirectory();
QString uniboardUserVideoDirectory();
QString uniboardDefaultUserImageLibraryDirectory();

@ -193,6 +193,7 @@ bool UBGraphicsItemDelegate::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
bool UBGraphicsItemDelegate::weelEvent(QGraphicsSceneWheelEvent *event)
{
Q_UNUSED(event);
if( mDelegated->isSelected() )
{
// event->accept();

@ -334,7 +334,7 @@ QString UBFileSystemUtils::mimeTypeFromFileName(const QString& fileName)
{
QString ext = extension(fileName);
if (ext == "xls" || ext == "xlsx") return "application/msexcel";
if (ext == "xls" || ext == "xlsx") return "application/msexcel";
if (ext == "ppt" || ext == "pptx") return "application/mspowerpoint";
if (ext == "ief") return "image/ief";
if (ext == "m3u") return "audio/x-mpegurl";
@ -396,6 +396,7 @@ QString UBFileSystemUtils::mimeTypeFromFileName(const QString& fileName)
if (ext == "m4v") return "video/x-m4v";
// W3C widget
if (ext == "wgt") return "application/widget";
if (ext == "wgs") return "application/search";
// Apple widget
if (ext == "wdgt") return "application/vnd.apple-widget"; //mime type invented by us :-(
if (ext == "swf") return "application/x-shockwave-flash";

@ -141,7 +141,10 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage)
{
// Save the current state of the scene
pScene->setModified(true);
UBSvgSubsetAdaptor::persistScene(mCrntDoc,pScene, iPage);
if(UBApplication::boardController)
{
UBApplication::boardController->persistCurrentScene();
}
UBThumbnailAdaptor::persistScene(mCrntDoc->persistencePath(), pScene, iPage);

@ -38,38 +38,16 @@ UBLibItemProperties::UBLibItemProperties(QWidget *parent, const char *name):QWid
, mpThumbnail(NULL)
, mpOrigPixmap(NULL)
, mpElement(NULL)
, mpNavigBar(NULL)
, mpNavigLayout(NULL)
, mpNavigBack(NULL)
, mpNavigBackAction(NULL)
{
setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
// Create the GUI
mpLayout = new QVBoxLayout(this);
setLayout(mpLayout);
mpNavigBar = new QWidget(this);
mpNavigLayout = new QHBoxLayout(mpNavigBar);
mpNavigBar->setLayout(mpNavigLayout);
mpNavigBar->setStyleSheet(QString("background-color : white; border-radius : 10px;"));
mpNavigBar->setMaximumHeight(42);
mpNavigBackAction = new QAction(QIcon(":/images/libpalette/back.png"), tr("Back"), mpNavigBar);
mpNavigBack = new QToolButton(mpNavigBar);
mpNavigBar->addAction(mpNavigBackAction);
mpNavigBack->setDefaultAction(mpNavigBackAction);
mpNavigBack->setIconSize(QSize(32,32));
mpNavigBack->setToolButtonStyle(Qt::ToolButtonIconOnly);
mpNavigBack->setStyleSheet(QString("QToolButton {color: white; font-weight: bold; font-family: Arial; background-color: transparent; border: none}"));
mpNavigBack->setFocusPolicy(Qt::NoFocus);
mpNavigLayout->addWidget(mpNavigBack, 0);
connect(mpNavigBackAction, SIGNAL(triggered()), this, SLOT(onBack()));
mpNavigLayout->addStretch(1);
mpLayout->addWidget(mpNavigBar);
maxThumbHeight = height() / 4;
mpThumbnail = new QLabel();
@ -77,7 +55,8 @@ UBLibItemProperties::UBLibItemProperties(QWidget *parent, const char *name):QWid
icon.scaledToWidth(THUMBNAIL_WIDTH);
mpThumbnail->setPixmap(icon);
mpThumbnail->setStyleSheet(QString("background-color : white; padding : 10 px; border-radius : 10px;"));
mpThumbnail->setObjectName("DockPaletteWidgetBox");
mpThumbnail->setStyleSheet("background:white;");
mpThumbnail->setAlignment(Qt::AlignHCenter);
mpLayout->addWidget(mpThumbnail, 0);
@ -104,7 +83,8 @@ UBLibItemProperties::UBLibItemProperties(QWidget *parent, const char *name):QWid
mpObjInfos = new QTextEdit(this);
mpObjInfos->setReadOnly(true);
mpObjInfos->setStyleSheet(QString("background-color: white; border-radius : 10px;"));
mpObjInfos->setObjectName("DockPaletteWidgetBox");
mpObjInfos->setStyleSheet("background:white;");
mpLayout->addWidget(mpObjInfos, 1);
connect(mpAddPageButton, SIGNAL(clicked()), this, SLOT(onAddToPage()));
@ -118,26 +98,6 @@ UBLibItemProperties::UBLibItemProperties(QWidget *parent, const char *name):QWid
*/
UBLibItemProperties::~UBLibItemProperties()
{
if(NULL != mpNavigBackAction)
{
delete mpNavigBackAction;
mpNavigBackAction = NULL;
}
if(NULL != mpNavigBack)
{
delete mpNavigBack;
mpNavigBack = NULL;
}
if(NULL != mpNavigLayout)
{
delete mpNavigLayout;
mpNavigLayout = NULL;
}
if(NULL != mpNavigBar)
{
delete mpNavigLayout;
mpNavigLayout = NULL;
}
if(NULL != mpOrigPixmap)
{
delete mpOrigPixmap;
@ -148,11 +108,6 @@ UBLibItemProperties::~UBLibItemProperties()
delete mpLayout;
mpLayout = NULL;
}
//if(NULL != mpButtonLayout)
//{
// delete mpButtonLayout;
// mpButtonLayout = NULL;
//}
if(NULL != mpSetAsBackgroundButton)
{
delete mpSetAsBackgroundButton;
@ -211,10 +166,6 @@ void UBLibItemProperties::adaptSize()
mpThumbnail->setPixmap(mpOrigPixmap->scaledToWidth(THUMBNAIL_WIDTH));
}
}
if(NULL != mpNavigBar)
{
mpNavigBar->resize(width(), mpNavigBar->height());
}
}
/**

@ -73,12 +73,6 @@ private:
QPixmap* mpOrigPixmap;
int maxThumbHeight;
UBLibElement* mpElement;
// Navigation bar
QWidget* mpNavigBar;
QHBoxLayout* mpNavigLayout;
QToolButton* mpNavigBack;
QAction* mpNavigBackAction;
};

@ -15,6 +15,7 @@
#include "UBLibNavigatorWidget.h"
#include "UBLibWidget.h"
#include "core/UBApplication.h"
#include "core/memcheck.h"
static int lowBoundForSlider = 40;
@ -29,22 +30,20 @@ static int tickIntervalForSlider = 10;
UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QWidget(parent)
, mLayout(NULL)
, mLibWidget(NULL)
, mPathViewer(NULL)
, mSlider(NULL)
, mSliderWidthSetting(NULL)
{
setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
setAcceptDrops(true);
UBLibWidget* libWidget = dynamic_cast<UBLibWidget*>(parentWidget());
mLayout = new QVBoxLayout(this);
setLayout(mLayout);
mPathViewer = new UBLibPathViewer(this);
mPathViewer->setMaximumHeight(62);
mLayout->addWidget(mPathViewer, 0);
mLibWidget = new UBLibraryWidget(this);
mLayout->addWidget(mLibWidget, 1);
@ -56,27 +55,25 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
mSlider->setValue(defaultWidth);
mSlider->setTickInterval(tickIntervalForSlider);
mLayout->addWidget(mSlider, 0);
mLibWidget->updateThumbnailsSize(defaultWidth);
connect(mLibWidget, SIGNAL(navigBarUpdate(UBLibElement*)), this, SLOT(onNavigbarUpate(UBLibElement*)));
connect(mLibWidget, SIGNAL(propertiesRequested(UBLibElement*)), this, SLOT(onPropertiesRequested(UBLibElement*)));
connect(mPathViewer, SIGNAL(mouseClick(UBChainedLibElement*)), this, SLOT(onPathItemClicked(UBChainedLibElement*)));
connect(mSlider,SIGNAL(valueChanged(int)),this,SLOT(updateThumbnailsSize(int)));
connect(mPathViewer, SIGNAL(elementsDropped(QList<QString>,UBLibElement*)), mLibWidget, SLOT(onElementsDropped(QList<QString>,UBLibElement*)));
connect(this, SIGNAL(updateNavigBar(UBChainedLibElement*)), libWidget, SLOT(onUpdateNavigBar(UBChainedLibElement*)));
mLibWidget->updateThumbnailsSize(defaultWidth);
connect(mLibWidget, SIGNAL(propertiesRequested(UBLibElement*)), this, SLOT(onPropertiesRequested(UBLibElement*)));
connect(mLibWidget, SIGNAL(displaySearchEngine(UBLibElement*)), this, SLOT(onDisplaySearchEngine(UBLibElement*)));
connect(mSlider,SIGNAL(valueChanged(int)),this,SLOT(updateThumbnailsSize(int)));
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(mLibWidget, SIGNAL(navigBarUpdate(UBLibElement*)), libWidget->actionBar(), SLOT(onNavigbarUpdate(UBLibElement*)));
connect(mLibWidget, SIGNAL(itemsSelected(QList<UBLibElement*>, bool)), libWidget->actionBar(), SLOT(onSelectionChanged(QList<UBLibElement*>, bool)));
connect(libWidget->actionBar(), SIGNAL(deleteDone()), mLibWidget, SLOT(onRefreshCurrentFolder()));
connect(mLibWidget, SIGNAL(favoritesEntered(bool)), libWidget->actionBar(), SLOT(onFavoritesEntered(bool)));
connect(libWidget->actionBar(), SIGNAL(searchElement(QString)), mLibWidget, SLOT(onSearchElement(QString)));
connect(libWidget->actionBar(), SIGNAL(newFolderToCreate()), mLibWidget, SLOT(onNewFolderToCreate()));
/*** to update the search bar **/
connect(mLibWidget, SIGNAL(itemClicked()),libWidget->actionBar(), SLOT(onItemChanged()));
connect(mPathViewer, SIGNAL(mouseClick(UBChainedLibElement*)),libWidget->actionBar(), SLOT(onItemChanged()));
connect(libWidget->pathViewer(), SIGNAL(mouseClick(UBChainedLibElement*)),libWidget->actionBar(), SLOT(onItemChanged()));
mLibWidget->init();
}
@ -85,10 +82,10 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
*/
UBLibNavigatorWidget::~UBLibNavigatorWidget()
{
if(NULL != mPathViewer)
if(NULL != mLibWidget)
{
delete mPathViewer;
mPathViewer = NULL;
delete mLibWidget;
mLibWidget = NULL;
}
if(NULL != mSlider)
{
@ -100,6 +97,11 @@ UBLibNavigatorWidget::~UBLibNavigatorWidget()
delete mSliderWidthSetting;
mSliderWidthSetting = NULL;
}
if(NULL != mLayout)
{
delete mLayout;
mLayout = NULL;
}
}
void UBLibNavigatorWidget::dropMe(const QMimeData *_data)
@ -114,14 +116,8 @@ void UBLibNavigatorWidget::dropMe(const QMimeData *_data)
*/
void UBLibNavigatorWidget::onNavigbarUpate(UBLibElement *pElem)
{
if(NULL != pElem)
{
// Refresh the path navigator
mPathViewer->displayPath(mLibWidget->chainedElements);
// Show the path navigator
mPathViewer->show();
}
Q_UNUSED(pElem);
emit updateNavigBar(mLibWidget->chainedElements);
}
/**
@ -157,13 +153,22 @@ void UBLibNavigatorWidget::removeNextChainedElements(UBChainedLibElement *fromEl
/**
* \brief Handles the properties requested event
* @param elem as tje related element
* @param elem as the related element
*/
void UBLibNavigatorWidget::onPropertiesRequested(UBLibElement *elem)
{
emit propertiesRequested(elem);
}
/**
* \brief Handles the display search engine requested event
* @param elem as the related element
*/
void UBLibNavigatorWidget::onDisplaySearchEngine(UBLibElement *elem)
{
emit displaySearchEngine(elem);
}
/**
* \brief Update the thumbnails size
* @param newSize as the given thumbnails size

@ -21,7 +21,6 @@
#include <QDropEvent>
#include "UBLibraryWidget.h"
#include "UBLibPathViewer.h"
#include "core/UBSetting.h"
class UBLibNavigatorWidget : public QWidget
@ -32,24 +31,25 @@ public:
~UBLibNavigatorWidget();
void dropMe(const QMimeData* _data);
UBLibraryWidget* libraryWidget(){return mLibWidget;};
UBLibraryWidget* libraryWidget(){return mLibWidget;}
signals:
void propertiesRequested(UBLibElement* elem);
void displaySearchEngine(UBLibElement* elem);
void updateNavigBar(UBChainedLibElement* elem);
private slots:
void onNavigbarUpate(UBLibElement* pElem);
void onPathItemClicked(UBChainedLibElement *elem);
void onPropertiesRequested(UBLibElement* elem);
void updateThumbnailsSize(int newSize);
void onDisplaySearchEngine(UBLibElement* elem);
private:
void removeNextChainedElements(UBChainedLibElement* fromElem);
QVBoxLayout* mLayout;
UBLibraryWidget* mLibWidget;
UBLibPathViewer* mPathViewer;
QSlider* mSlider;
UBSetting* mSliderWidthSetting;
};

@ -29,15 +29,21 @@
*/
UBLibPathViewer::UBLibPathViewer(QWidget *parent, const char *name):QGraphicsView(parent)
, mpElems(NULL)
, mpElemsBackup(NULL)
, mpScene(NULL)
, mpLayout(NULL)
, mpContainer(NULL)
, mpBackElem(NULL)
{
setObjectName(name);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
setAcceptDrops(true);
mpBackElem = new UBLibElement();
mpBackElem->setThumbnail(QPixmap(":images/libpalette/back.png").toImage());
mpBackElem->setDeletable(false);
mpScene = new UBPathScene(this);
setScene(mpScene);
@ -57,21 +63,31 @@ UBLibPathViewer::UBLibPathViewer(QWidget *parent, const char *name):QGraphicsVie
*/
UBLibPathViewer::~UBLibPathViewer()
{
// if(NULL != mpLayout)
// {
// delete mpLayout;
// mpLayout = NULL;
// }
if(NULL != mpContainer)
{
delete mpContainer;
mpContainer = NULL;
}
if(NULL != mpBackElem)
{
delete mpBackElem;
mpBackElem = NULL;
}
if(NULL != mpElems)
{
delete mpElems;
mpElems = NULL;
}
if(NULL != mpElemsBackup)
{
delete mpElemsBackup;
mpElemsBackup = NULL;
}
if(NULL != mpLayout)
{
delete mpLayout;
mpLayout = NULL;
}
if(NULL != mpScene)
{
delete mpScene;
@ -255,6 +271,24 @@ void UBLibPathViewer::onElementsDropped(QList<QString> elements, UBLibElement *t
emit elementsDropped(elements, target);
}
void UBLibPathViewer::showBack()
{
// Backup the current path so we can go back by clicking on the back button
mpElemsBackup = mpElems;
// Set the correct path to the backElem
UBChainedLibElement* pLastElem = mpElemsBackup->lastElement();
if(NULL != pLastElem)
{
mpBackElem->setPath(pLastElem->element()->path());
mpBackElem->setType(eUBLibElementType_Folder);
mpBackElem->setName(pLastElem->element()->name());
}
// Display the 'back' element
displayPath(new UBChainedLibElement(mpBackElem));
}
UBFolderPath::UBFolderPath():QGraphicsProxyWidget()
{
@ -422,7 +456,6 @@ void UBPathScene::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event)
{
const QMimeData* pMimeData = event->mimeData();
qDebug() << " Drop source : " << event->source()->metaObject()->className();
if(0 == QString::compare(event->source()->metaObject()->className(), "UBLibraryWidget"))
{

@ -79,6 +79,10 @@ public:
void displayPath(UBChainedLibElement* elementsChain);
int widgetAt(QPointF p);
void updateScrolls();
public slots:
void showBack();
signals:
void mouseClick(UBChainedLibElement* elem);
void elementsDropped(QList<QString> elements, UBLibElement* target);
@ -99,6 +103,8 @@ private:
/** The chained path elements */
UBChainedLibElement* mpElems;
/** The backup chained path elements */
UBChainedLibElement* mpElemsBackup;
/** The scene */
UBPathScene* mpScene;
//QGraphicsScene* mpScene;
@ -110,6 +116,8 @@ private:
QVector<QGraphicsWidget*> mVItems;
/** The total width of the element in the scene */
int mSceneWidth;
/** The back element */
UBLibElement* mpBackElem;
};

@ -0,0 +1,86 @@
#include <QDomDocument>
#include "core/UBApplication.h"
#include "UBLibWebView.h"
UBLibWebView::UBLibWebView(QWidget* parent, const char* name):QWidget(parent)
, mpView(NULL)
, mpWebSettings(NULL)
, mpLayout(NULL)
{
setObjectName(name);
setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet());
mpLayout = new QVBoxLayout();
setLayout(mpLayout);
mpView = new QWebView(this);
mpView->setObjectName("SearchEngineView");
//mpView->setStyleSheet(QString("background-color:white;"));
mpWebSettings = QWebSettings::globalSettings();
mpWebSettings->setAttribute(QWebSettings::JavaEnabled, true);
mpWebSettings->setAttribute(QWebSettings::PluginsEnabled, true);
mpWebSettings->setAttribute(QWebSettings::JavaEnabled, true);
mpWebSettings->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
mpWebSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
mpWebSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
mpWebSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
mpWebSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, true);
mpLayout->addWidget(mpView);
}
UBLibWebView::~UBLibWebView()
{
if(NULL != mpView)
{
delete mpView;
mpView = NULL;
}
if(NULL != mpLayout)
{
delete mpLayout;
mpLayout = NULL;
}
}
void UBLibWebView::setElement(UBLibElement *elem)
{
if(NULL != elem)
{
QString qsWidgetName;
QString path = elem->path().toLocalFile();
QString qsConfigPath = QString("%0/config.xml").arg(path);
if(QFile::exists(qsConfigPath))
{
QFile f(qsConfigPath);
if(f.open(QIODevice::ReadOnly))
{
QDomDocument domDoc;
domDoc.setContent(QString(f.readAll()));
QDomElement root = domDoc.documentElement();
QDomNode node = root.firstChild();
while(!node.isNull())
{
if(node.toElement().tagName() == "content")
{
QDomAttr srcAttr = node.toElement().attributeNode("src");
qsWidgetName = srcAttr.value();
break;
}
node = node.nextSibling();
}
f.close();
}
}
mpView->load(QUrl::fromLocalFile(QString("%0/%1").arg(path).arg(qsWidgetName)));
}
}

@ -0,0 +1,27 @@
#ifndef UBLIBWEBVIEW_H
#define UBLIBWEBVIEW_H
#include <QWidget>
#include <QWebView>
#include <QWebSettings>
#include <QVBoxLayout>
#include "board/UBLibraryController.h"
class UBLibWebView : public QWidget
{
Q_OBJECT
public:
UBLibWebView(QWidget* parent = 0, const char* name = "UBLibWebView");
~UBLibWebView();
void setElement(UBLibElement* elem);
private:
QWebView* mpView;
QWebSettings* mpWebSettings;
QVBoxLayout* mpLayout;
};
#endif // UBLIBWEBVIEW_H

@ -29,6 +29,8 @@ UBLibWidget::UBLibWidget(QWidget *parent, const char *name):UBDockPaletteWidget(
, mNavigator(NULL)
, mProperties(NULL)
, mActionBar(NULL)
, mpWebView(NULL)
, mpPathViewer(NULL)
{
setObjectName(name);
mName = "LibWidget";
@ -43,23 +45,37 @@ UBLibWidget::UBLibWidget(QWidget *parent, const char *name):UBDockPaletteWidget(
mLayout = new QVBoxLayout(this);
setLayout(mLayout);
// -------------
// Build the GUI
// -------------
// The 'global' widgets
mStackedWidget = new QStackedWidget(this);
mActionBar = new UBLibActionBar(this);
mpPathViewer = new UBLibPathViewer(this);
mpPathViewer->setMaximumHeight(62);
// The internal widgets
mNavigator = new UBLibNavigatorWidget(this);
mProperties = new UBLibItemProperties(this);
mpWebView = new UBLibWebView(this);
mLayout->addWidget(mpPathViewer, 0);
mLayout->addWidget(mStackedWidget, 1);
mLayout->addWidget(mActionBar, 0);
mStackedWidget->addWidget(mNavigator);
mStackedWidget->addWidget(mProperties);
mStackedWidget->addWidget(mpWebView);
mStackedWidget->setCurrentIndex(ID_NAVIGATOR);
miCrntStackWidget = ID_NAVIGATOR;
connect(mNavigator, SIGNAL(updateNavigBar(UBChainedLibElement*)), this, SLOT(onUpdateNavigBar(UBChainedLibElement*)));
connect(mNavigator, SIGNAL(propertiesRequested(UBLibElement*)), this, SLOT(showProperties(UBLibElement*)));
connect(mNavigator, SIGNAL(displaySearchEngine(UBLibElement*)), this, SLOT(showSearchEngine(UBLibElement*)));
connect(mProperties, SIGNAL(showFolderContent()), this, SLOT(showFolder()));
connect(this, SIGNAL(showLibElemProperties()), mpPathViewer, SLOT(showBack()));
connect(this, SIGNAL(showLibSearchEngine()), mpPathViewer, SLOT(showBack()));
}
/**
@ -67,16 +83,41 @@ UBLibWidget::UBLibWidget(QWidget *parent, const char *name):UBDockPaletteWidget(
*/
UBLibWidget::~UBLibWidget()
{
if(NULL != mpPathViewer)
{
delete mpPathViewer;
mpPathViewer = NULL;
}
if(NULL != mNavigator)
{
delete mNavigator;
mNavigator = NULL;
}
if(NULL != mpWebView)
{
delete mpWebView;
mpWebView = NULL;
}
if(NULL != mProperties)
{
delete mProperties;
mProperties = NULL;
}
if(NULL != mStackedWidget)
{
delete mStackedWidget;
mStackedWidget = NULL;
}
if(NULL != mActionBar)
{
delete mActionBar;
mActionBar = NULL;
}
if(NULL != mLayout)
{
delete mLayout;
mLayout = NULL;
}
}
/**
@ -133,14 +174,26 @@ void UBLibWidget::showProperties(UBLibElement *elem)
{
if(NULL != elem)
{
emit showLibElemProperties();
mActionBar->setButtons(eButtonSet_Properties);
// Show the properties of this object
mProperties->showElement(elem);
mStackedWidget->setCurrentIndex(ID_PROPERTIES);
miCrntStackWidget = ID_PROPERTIES;
}
}
void UBLibWidget::showSearchEngine(UBLibElement *elem)
{
if(NULL != elem)
{
emit showLibSearchEngine();
mActionBar->hide();
mpWebView->setElement(elem);
mStackedWidget->setCurrentIndex(ID_WEBVIEW);
miCrntStackWidget = ID_WEBVIEW;
}
}
void UBLibWidget::showFolder()
{
mActionBar->setButtons(mActionBar->previousButtonSet());
@ -157,3 +210,14 @@ int UBLibWidget::border()
{
return 15;
}
void UBLibWidget::onUpdateNavigBar(UBChainedLibElement *elem)
{
mpPathViewer->displayPath(elem);
mpPathViewer->show();
if(ID_NAVIGATOR != miCrntStackWidget)
{
showFolder();
}
}

@ -30,9 +30,12 @@
#include "UBLibNavigatorWidget.h"
#include "UBLibItemProperties.h"
#include "UBLibActionBar.h"
#include "UBLibWebView.h"
#include "UBLibPathViewer.h"
#define ID_NAVIGATOR 0
#define ID_PROPERTIES 1
#define ID_WEBVIEW 2
class UBLibWidget : public UBDockPaletteWidget
{
@ -42,10 +45,13 @@ public:
~UBLibWidget();
UBLibActionBar* actionBar(){return mActionBar;}
UBLibNavigatorWidget* libNavigator() {return mNavigator;};
UBLibNavigatorWidget* libNavigator() {return mNavigator;}
UBLibPathViewer* pathViewer() {return mpPathViewer;}
signals:
void resized();
void showLibElemProperties();
void showLibSearchEngine();
protected:
void dragEnterEvent(QDragEnterEvent* pEvent);
@ -55,7 +61,9 @@ protected:
private slots:
void showProperties(UBLibElement* elem);
void showSearchEngine(UBLibElement* elem);
void showFolder();
void onUpdateNavigBar(UBChainedLibElement* elem);
private:
void processMimeData(const QMimeData* pData);
@ -74,6 +82,10 @@ private:
UBLibActionBar* mActionBar;
/** The current stack widget index*/
int miCrntStackWidget;
/** The webview used to display the search engines */
UBLibWebView* mpWebView;
/** The path navigation widget */
UBLibPathViewer* mpPathViewer;
};
#endif // UBLIBWIDGET_H

@ -25,15 +25,18 @@
#include "core/memcheck.h"
#include "frameworks/UBFileSystemUtils.h"
/**
* \brief Constructor
* @param parent as the parent widget
* @param name as the widget object name
*/
UBLibraryWidget::UBLibraryWidget(QWidget *parent, const char *name):UBThumbnailWidget(parent)
, chainedElements(NULL)
, mpCrntDir(NULL)
, mpCrntElem(NULL)
, chainedElements(NULL)
, mpCrntDir(NULL)
, mpCrntElem(NULL)
, mLibraryController(NULL)
{
setObjectName(name);
setSpacing(5);
@ -45,7 +48,8 @@ UBLibraryWidget::UBLibraryWidget(QWidget *parent, const char *name):UBThumbnailW
*/
UBLibraryWidget::~UBLibraryWidget()
{
if(mLibraryController){
if(NULL != mLibraryController)
{
delete mLibraryController;
mLibraryController = NULL;
}
@ -148,7 +152,8 @@ void UBLibraryWidget::onItemClicked(QGraphicsItem *item, int index)
{
delete mpCrntElem;
mpCrntElem = new UBLibElement(pElem);
if(eUBLibElementType_Folder == pElem->type() || eUBLibElementType_VirtualFolder == pElem->type()) {
if(eUBLibElementType_Folder == pElem->type() || eUBLibElementType_VirtualFolder == pElem->type())
{
// Add the clicked element to the end of the elements list
// (at this level, the user can only go down in the path)
UBChainedLibElement* pNextElem = new UBChainedLibElement(pElem);
@ -162,8 +167,15 @@ void UBLibraryWidget::onItemClicked(QGraphicsItem *item, int index)
}
else
{
// Display the properties view
emit propertiesRequested(pElem);
if ("application/search" == UBFileSystemUtils::mimeTypeFromFileName(pElem->path().toLocalFile()))
{
emit displaySearchEngine(pElem);
}
else
{
// Display the properties view
emit propertiesRequested(pElem);
}
}
}
emit itemClicked();

@ -47,7 +47,7 @@ public:
void updateThumbnailsSize(int newSize);
void init();
UBLibraryController* libraryController() {return mLibraryController;};
UBLibraryController* libraryController() {return mLibraryController;}
public slots:
void onRefreshCurrentFolder();
@ -59,6 +59,7 @@ signals:
void navigBarUpdate(UBLibElement* pElem);
void itemsSelected(QList<UBLibElement*> elemList, bool inTrash);
void propertiesRequested(UBLibElement* pElem);
void displaySearchEngine(UBLibElement* pElem);
void favoritesEntered(bool bFav);
void itemClicked();

@ -16,7 +16,6 @@
#include <QtGui>
#include "UBMainWindow.h"
#include "core/UBApplication.h"
#include "core/UBApplicationController.h"
#include "board/UBBoardController.h"
@ -160,3 +159,26 @@ bool UBMainWindow::yesNoQuestion(QString windowTitle, QString text)
return messageBox.clickedButton() == yesButton;
}
void UBMainWindow::oneButtonMessageBox(QString windowTitle, QString text, QMessageBox::Icon type)
{
QMessageBox messageBox;
messageBox.setParent(this);
messageBox.setWindowFlags(Qt::Dialog);
messageBox.setWindowTitle(windowTitle);
messageBox.setText(text);
messageBox.addButton(tr("Ok"),QMessageBox::YesRole);
messageBox.setIcon(type);
messageBox.exec();
}
void UBMainWindow::warning(QString windowTitle, QString text)
{
oneButtonMessageBox(windowTitle,text, QMessageBox::Warning);
}
void UBMainWindow::information(QString windowTitle, QString text)
{
oneButtonMessageBox(windowTitle, text, QMessageBox::Information);
}

@ -20,6 +20,7 @@
#include <QMainWindow>
#include <QWidget>
#include <QWebView>
#include <QMessageBox>
class QStackedLayout;
@ -41,7 +42,10 @@ class UBMainWindow : public QMainWindow, public Ui::MainWindow
void addDocumentsWidget(QWidget *pWidget);
void switchToDocumentsWidget();
bool yesNoQuestion(QString windowTitle, QString text);
void warning(QString windowTitle, QString text);
void information(QString windowTitle, QString text);
signals:
void closeEvent_Signal( QCloseEvent *event );
@ -50,6 +54,7 @@ class UBMainWindow : public QMainWindow, public Ui::MainWindow
void onExportDone();
protected:
void oneButtonMessageBox(QString windowTitle, QString text, QMessageBox::Icon type);
virtual void keyPressEvent(QKeyEvent *event);
virtual void closeEvent (QCloseEvent *event);

@ -12,28 +12,29 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QMessageBox>
#include <QFileDialog>
#include "UBUpdateDlg.h"
#include "core/UBApplication.h"
#include "UBMainWindow.h"
#include "core/memcheck.h"
UBUpdateDlg::UBUpdateDlg(QWidget *parent, int nbFiles, const QString& bkpPath)
: QDialog(parent)
, mMainLayout(NULL)
, mNbFilesLabel(NULL)
, mBkpLabel(NULL)
, mBkpPath(NULL)
, mBrowseBttn(NULL)
, mpDlgBttn(NULL)
, mLayout(NULL)
, mHLayout(NULL)
, mStackedWidget(NULL)
, mDialogWidget(NULL)
, mProgressWidget(NULL)
, mProgressLayout(NULL)
, mProgressLabel(NULL)
: QDialog(parent)
, mMainLayout(NULL)
, mNbFilesLabel(NULL)
, mBkpLabel(NULL)
, mBkpPath(NULL)
, mBrowseBttn(NULL)
, mpDlgBttn(NULL)
, mLayout(NULL)
, mHLayout(NULL)
, mStackedWidget(NULL)
, mDialogWidget(NULL)
, mProgressWidget(NULL)
, mProgressLayout(NULL)
, mProgressLabel(NULL)
{
mDialogWidget = new QWidget(this);
@ -178,18 +179,16 @@ void UBUpdateDlg::onUpdate()
void UBUpdateDlg::onFilesUpdated(bool bResult)
{
this->hide();
this->hide();
QString qsMsg;
if (bResult)
{
if (bResult) {
qsMsg = tr("Files update successful!\nPlease reboot the application to access the updated documents.");
}
else
{
else {
qsMsg = tr("An error occured during the update. The files have not been affected.");
}
QMessageBox::information(this, tr("Files update results"), qsMsg, QMessageBox::Ok);
UBApplication::mainWindow->information(tr("Files update results"), qsMsg);
}
QString UBUpdateDlg::backupPath()

@ -43,7 +43,8 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBLibWidget.h \
src/gui/UBMagnifer.h \
src/gui/UBCachePropertiesWidget.h \
src/gui/UBTeacherBarWidget.h
src/gui/UBTeacherBarWidget.h \
src/gui/UBLibWebView.h
SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFloatingPalette.cpp \
@ -89,7 +90,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBLibWidget.cpp \
src/gui/UBMagnifer.cpp \
src/gui/UBCachePropertiesWidget.cpp \
src/gui/UBTeacherBarWidget.cpp
src/gui/UBTeacherBarWidget.cpp \
src/gui/UBLibWebView.cpp
win32 {

@ -160,14 +160,18 @@ void UBNetworkAccessManager::sslErrors(QNetworkReply *reply, const QList<QSslErr
QString errors = errorStrings.join(QLatin1String("\n"));
int ret = QMessageBox::warning(mainWindow, QCoreApplication::applicationName(),
tr("SSL Errors:\n\n%1\n\n%2\n\n"
"Do you want to ignore these errors for this host?").arg(reply->url().toString()).arg(errors),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No);
if (ret == QMessageBox::Yes)
{
QMessageBox messageBox;
messageBox.setParent(mainWindow);
messageBox.setWindowFlags(Qt::Dialog);
messageBox.setWindowTitle(QCoreApplication::applicationName());
messageBox.setText(tr("SSL Errors:\n\n%1\n\n%2\n\n"
"Do you want to ignore these errors for this host?").arg(reply->url().toString()).arg(errors));
QPushButton* yesButton = messageBox.addButton(tr("Yes"),QMessageBox::YesRole);
messageBox.addButton(tr("No"),QMessageBox::NoRole);
messageBox.setIcon(QMessageBox::Question);
messageBox.exec();
if(messageBox.clickedButton() == yesButton) {
reply->ignoreSslErrors();
sslTrustedHostList.append(replyHost);
}

@ -168,8 +168,7 @@ void WBWebPage::handleUnsupportedContent(QNetworkReply *reply)
messageBox.setText(tr("Download PDF Document: would you prefer to download the PDF file or add it to the current Sankore document?"));
messageBox.addButton(tr("Download"), QMessageBox::AcceptRole);
QAbstractButton *addButton =
messageBox.addButton(tr("Add to Current Document"), QMessageBox::AcceptRole);
QAbstractButton *addButton = messageBox.addButton(tr("Add to Current Document"), QMessageBox::AcceptRole);
messageBox.exec();
if (messageBox.clickedButton() == addButton)

Loading…
Cancel
Save