Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
91005972
Commit
91005972
authored
Apr 27, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed software update
parent
2b678dd9
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
0 additions
and
624 deletions
+0
-624
Sankore_3.1.pro
Sankore_3.1.pro
+0
-1
UBRssHandler.cpp
src/softwareupdate/UBRssHandler.cpp
+0
-142
UBRssHandler.h
src/softwareupdate/UBRssHandler.h
+0
-59
UBSoftwareUpdate.cpp
src/softwareupdate/UBSoftwareUpdate.cpp
+0
-52
UBSoftwareUpdate.h
src/softwareupdate/UBSoftwareUpdate.h
+0
-40
UBSoftwareUpdateController.cpp
src/softwareupdate/UBSoftwareUpdateController.cpp
+0
-261
UBSoftwareUpdateController.h
src/softwareupdate/UBSoftwareUpdateController.h
+0
-61
softwareupdate.pri
src/softwareupdate/softwareupdate.pri
+0
-8
No files found.
Sankore_3.1.pro
View file @
91005972
...
...
@@ -52,7 +52,6 @@ include(src/podcast/podcast.pri)
include
(
src
/
tools
/
tools
.
pri
)
include
(
src
/
desktop
/
desktop
.
pri
)
include
(
src
/
web
/
web
.
pri
)
include
(
src
/
softwareupdate
/
softwareupdate
.
pri
)
include
(
src
/
transition
/
transition
.
pri
)
include
(
src
/
customWidgets
/
customWidgets
.
pri
)
include
(
src
/
interfaces
/
interfaces
.
pri
)
...
...
src/softwareupdate/UBRssHandler.cpp
deleted
100644 → 0
View file @
2b678dd9
/*
* 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/>.
*/
#include "frameworks/UBVersion.h"
#include "UBRssHandler.h"
#include "UBSoftwareUpdate.h"
#include "core/memcheck.h"
const
QString
UBRssHandler
::
sRssItemElementName
=
"item"
;
const
QString
UBRssHandler
::
sRssLinkElementName
=
"link"
;
const
QString
UBRssHandler
::
sUniboardVersionElementName
=
"ub:version"
;
// TODO UB 4.x map properly ub namespace
UBRssHandler
::
UBRssHandler
()
:
mRssTagParsed
(
false
)
,
mInItem
(
false
)
,
mInVersion
(
false
)
{
// NOOP
}
UBRssHandler
::~
UBRssHandler
(
void
)
{
while
(
!
mSoftwareUpdates
.
isEmpty
())
{
delete
mSoftwareUpdates
.
takeFirst
();
}
}
bool
UBRssHandler
::
startElement
(
const
QString
&
/* namespaceURI */
,
const
QString
&
/* localName */
,
const
QString
&
qualifiedName
,
const
QXmlAttributes
&
attributes
)
{
bool
ok
=
true
;
if
(
!
mRssTagParsed
&&
qualifiedName
!=
"rss"
)
{
mError
=
"This file is not a RSS source."
;
ok
=
false
;
}
else
if
(
qualifiedName
==
"rss"
)
{
QString
version
=
attributes
.
value
(
"version"
);
if
(
!
version
.
isEmpty
()
&&
version
!=
"2.0"
)
{
mError
=
"Can only handle RSS 2.0."
;
ok
=
false
;
}
else
{
mRssTagParsed
=
true
;
}
}
else
if
(
qualifiedName
==
sRssItemElementName
)
{
mInItem
=
true
;
}
else
if
(
qualifiedName
==
sUniboardVersionElementName
)
{
mInVersion
=
true
;
}
mCurrentText
=
""
;
return
ok
;
}
bool
UBRssHandler
::
characters
(
const
QString
&
str
)
{
mCurrentText
+=
str
;
return
true
;
}
bool
UBRssHandler
::
endElement
(
const
QString
&
/* namespaceURI */
,
const
QString
&
/* localName */
,
const
QString
&
qualifiedName
)
{
bool
ok
=
true
;
if
(
qualifiedName
==
sRssItemElementName
)
{
mInItem
=
false
;
if
(
mVersion
.
isValid
()
&&
!
mDownloadUrl
.
isEmpty
())
{
UBSoftwareUpdate
*
softwareUpdate
=
new
UBSoftwareUpdate
(
mVersion
,
mDownloadUrl
);
mSoftwareUpdates
.
append
(
softwareUpdate
);
}
mVersion
=
UBVersion
();
mDownloadUrl
=
""
;
}
else
if
(
qualifiedName
==
sRssLinkElementName
)
{
if
(
mInItem
)
{
QUrl
url
(
mCurrentText
);
if
(
url
.
isValid
())
mDownloadUrl
=
mCurrentText
;
else
ok
=
false
;
}
}
else
if
(
qualifiedName
==
sUniboardVersionElementName
)
{
if
(
mInItem
)
{
mVersion
.
setString
(
mCurrentText
);
ok
=
mVersion
.
isValid
();
mInVersion
=
false
;
}
}
return
ok
;
}
bool
UBRssHandler
::
fatalError
(
const
QXmlParseException
&
exception
)
{
qWarning
()
<<
"Fatal error at line "
<<
exception
.
lineNumber
()
<<
", column "
<<
exception
.
columnNumber
()
<<
": "
<<
exception
.
message
()
<<
mError
;
return
false
;
}
QString
UBRssHandler
::
error
()
const
{
return
mError
;
}
QList
<
UBSoftwareUpdate
*>
UBRssHandler
::
softwareUpdates
()
const
{
return
mSoftwareUpdates
;
}
src/softwareupdate/UBRssHandler.h
deleted
100644 → 0
View file @
2b678dd9
/*
* 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 UBRSSHANDLER_H_
#define UBRSSHANDLER_H_
#include <QtXml>
#include <QList>
#include "frameworks/UBVersion.h"
class
UBSoftwareUpdate
;
class
UBRssHandler
:
public
QXmlDefaultHandler
{
public
:
UBRssHandler
();
virtual
~
UBRssHandler
(
void
);
// QXmlDefaultHandler
virtual
bool
startElement
(
const
QString
&
namespaceURI
,
const
QString
&
localName
,
const
QString
&
qualifiedName
,
const
QXmlAttributes
&
attributes
);
virtual
bool
endElement
(
const
QString
&
namespaceURI
,
const
QString
&
localName
,
const
QString
&
qualifiedName
);
virtual
bool
characters
(
const
QString
&
str
);
virtual
bool
fatalError
(
const
QXmlParseException
&
exception
);
// UBRssHandler
QString
error
()
const
;
QList
<
UBSoftwareUpdate
*>
softwareUpdates
()
const
;
private
:
QList
<
UBSoftwareUpdate
*>
mSoftwareUpdates
;
bool
mRssTagParsed
;
bool
mInItem
;
bool
mInVersion
;
QString
mError
;
QString
mCurrentText
;
UBVersion
mVersion
;
QString
mDownloadUrl
;
static
const
QString
sRssItemElementName
;
static
const
QString
sRssLinkElementName
;
static
const
QString
sUniboardVersionElementName
;
};
#endif
/* UBRSSHANDLER_H_ */
src/softwareupdate/UBSoftwareUpdate.cpp
deleted
100644 → 0
View file @
2b678dd9
/*
* 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/>.
*/
#include "frameworks/UBVersion.h"
#include "UBSoftwareUpdate.h"
#include "core/memcheck.h"
UBSoftwareUpdate
::
UBSoftwareUpdate
()
{
// NOOP
}
UBSoftwareUpdate
::
UBSoftwareUpdate
(
UBVersion
&
version
,
const
QString
&
downloadUrl
)
:
mVersion
(
version
)
,
mDownloadUrl
(
downloadUrl
)
{
// NOOP
}
UBSoftwareUpdate
::~
UBSoftwareUpdate
()
{
// NOOP
}
UBVersion
UBSoftwareUpdate
::
version
()
const
{
return
mVersion
;
}
QString
UBSoftwareUpdate
::
downloadUrl
()
const
{
return
mDownloadUrl
;
}
bool
UBSoftwareUpdate
::
operator
==
(
const
UBSoftwareUpdate
&
other
)
const
{
return
version
()
==
other
.
version
();
}
src/softwareupdate/UBSoftwareUpdate.h
deleted
100644 → 0
View file @
2b678dd9
/*
* 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 UBSOFTWAREUPDATE_H_
#define UBSOFTWAREUPDATE_H_
#include <QtCore>
#include "frameworks/UBVersion.h"
class
UBSoftwareUpdate
{
public
:
UBSoftwareUpdate
();
UBSoftwareUpdate
(
UBVersion
&
version
,
const
QString
&
downloadUrl
);
virtual
~
UBSoftwareUpdate
();
UBVersion
version
()
const
;
QString
downloadUrl
()
const
;
bool
operator
==
(
const
UBSoftwareUpdate
&
other
)
const
;
private
:
UBVersion
mVersion
;
QString
mDownloadUrl
;
};
#endif // UBSOFTWAREUPDATE_H_
src/softwareupdate/UBSoftwareUpdateController.cpp
deleted
100644 → 0
View file @
2b678dd9
/*
* 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/>.
*/
//#include "frameworks/UBVersion.h"
//#include "frameworks/UBFileSystemUtils.h"
//#include "frameworks/UBPlatformUtils.h"
//#include "UBSoftwareUpdateController.h"
//#include "UBRssHandler.h"
//#include "UBSoftwareUpdate.h"
//#include "core/UBApplication.h"
//#include "core/UBSettings.h"
//#include "core/UBSetting.h"
//#include "board/UBBoardController.h"
//#include "document/UBDocumentProxy.h"
//#include "network/UBHttpGet.h"
//#include "network/UBServerXMLHttpRequest.h"
//#include "network/UBNetworkAccessManager.h"
//const qreal UBSoftwareUpdateController::sProgressPercentageStep = 1;
//const int UBSoftwareUpdateController::sMinDisplayedDownloadedSizeInBytes = 2 * 1024 * 1024;
//UBSoftwareUpdateController::UBSoftwareUpdateController(QObject *parent)
// : QObject(parent)
// , mHttp(0)
//{
// // NOOP
//}
//UBSoftwareUpdateController::~UBSoftwareUpdateController()
//{
// delete mHttp;
//}
//void UBSoftwareUpdateController::beginRssDownload(const QUrl &url)
//{
// UBServerXMLHttpRequest * request = new UBServerXMLHttpRequest(UBNetworkAccessManager::defaultAccessManager());
// connect(request, SIGNAL(finished(bool, const QByteArray &)), this, SLOT(rssDownloadFinished(bool, const QByteArray &)));
// request->get(url);
//}
//void UBSoftwareUpdateController::beginInstallerDownload(const QUrl &url)
//{
// delete mHttp;
// mHttp = new UBHttpGet();
// connect(mHttp, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(installerDownloadProgress(qint64, qint64)));
// connect(mHttp, SIGNAL(downloadFinished(bool, QUrl, QString, QByteArray, QPointF, QSize, bool)),
// this, SLOT(installerDownloadFinished(bool, QUrl, QString, QByteArray)));
// mLastDisplayedProgress = 0;
// UBApplication::showMessage(tr("Downloading software update (%1%)").arg(0), true);
// mHttp->get(url, QPointF(), QSize());
//}
//void UBSoftwareUpdateController::rssDownloadFinished(bool success, const QByteArray &payload)
//{
// if (!success)
// {
// qWarning() << "Failed to download RSS file.";
// failedToRetrieveSoftwareUpdateInfo();
// return;
// }
// parseRss(payload);
//}
//void UBSoftwareUpdateController::installerDownloadProgress(qint64 receivedBytes, qint64 bytesTotal)
//{
// if (bytesTotal > sMinDisplayedDownloadedSizeInBytes)
// {
// qreal progress = ((qreal)(receivedBytes * 100) / bytesTotal);
// if (progress >= mLastDisplayedProgress + sProgressPercentageStep || receivedBytes == bytesTotal)
// {
// mLastDisplayedProgress = progress;
// UBApplication::showMessage(tr("Downloading software update (%1%)").arg(progress, 0, 'f', 0), true);
// }
// }
//}
//void UBSoftwareUpdateController::installerDownloadFinished(bool success, QUrl sourceUrl, QString contentTypeHeader, QByteArray data)
//{
// Q_UNUSED(contentTypeHeader);
// if (!success)
// {
// UBApplication::showMessage(tr("Downloading software update failed"));
// return;
// }
// UBApplication::showMessage(tr("Download finished"));
// QStringList urlParts = sourceUrl.toString().split("/");
// QString installerFileName = urlParts.last();
// QString tempDirPath = UBFileSystemUtils::createTempDir(UBFileSystemUtils::defaultTempDirName(), false);
// QString installerFilePath = tempDirPath + "/" + installerFileName;
// QFile file(installerFilePath);
// if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate))
// {
// qCritical() << "Cannot open " << installerFilePath << " for writing...";
// return;
// }
// file.write(data);
// file.flush();
// file.close();
// if (QMessageBox::question(
// QApplication::activeWindow(),
// tr("Software Update"),
// tr("Are you sure you want to install this new version of Uniboard now?\nThis session will close as soon as installation begins."),
// QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
// {
// UBDocumentProxy* document = UBApplication::boardController->activeDocument();
// int sceneIndex = UBApplication::boardController->activeSceneIndex();
// if (document)
// {
// UBSettings::settings()->appLastSessionDocumentUUID->set(UBStringUtils::toCanonicalUuid(document->uuid()));
// UBSettings::settings()->appLastSessionPageIndex->set(sceneIndex);
// }
// UBSettings::settings()->appIsInSoftwareUpdateProcess->set(true);
// UBPlatformUtils::runInstaller(installerFilePath);
// UBApplication::quit();
// }
//}
//void UBSoftwareUpdateController::parseRss(const QByteArray &rssContent)
//{
// UBRssHandler rssHandler;
// QXmlSimpleReader xmlReader;
// xmlReader.setContentHandler(&rssHandler);
// xmlReader.setErrorHandler(&rssHandler);
// QXmlInputSource source;
// source.setData(rssContent);
// if (!xmlReader.parse(source))
// {
// failedToRetrieveSoftwareUpdateInfo();
// return;
// }
// if (rssHandler.error().length() > 0)
// {
// qWarning() << "Failed to parse RSS file. Reason: " << rssHandler.error();
// failedToRetrieveSoftwareUpdateInfo();
// return;
// }
// if (rssHandler.softwareUpdates().isEmpty())
// {
// qWarning() << "RSS file does not contain software update info.";
// failedToRetrieveSoftwareUpdateInfo();
// return;
// }
// UBVersion installedVersion(qApp->applicationVersion());
// if (!installedVersion.isValid())
// {
// qWarning() << "Failed to parse installed version format: " << qApp->applicationVersion();
// failedToRetrieveSoftwareUpdateInfo();
// return;
// }
// QList<UBSoftwareUpdate *> softwareUpdates = rssHandler.softwareUpdates();
// const UBSoftwareUpdate *mostRecentSoftwareUpdate = searchForMoreRecentAndAsStableSoftwareUpdate(installedVersion, softwareUpdates);
// if (mostRecentSoftwareUpdate)
// {
// emit softwareUpdateAvailable(installedVersion, *mostRecentSoftwareUpdate);
// }
// else
// {
// emit noSoftwareUpdateAvailable();
// }
//}
//const UBSoftwareUpdate* UBSoftwareUpdateController::searchForMoreRecentAndAsStableSoftwareUpdate(const UBVersion &installedVersion, const QList<UBSoftwareUpdate *> &softwareUpdates)
//{
// const UBSoftwareUpdate *mostRecentSoftwareUpdate = 0;
// foreach (const UBSoftwareUpdate *softwareUpdate, softwareUpdates)
// {
// bool moreRecentAndAsStable = false;
// if (Alpha == installedVersion.releaseStage())
// {
// if (installedVersion < softwareUpdate->version() &&
// installedVersion.platformNumber() == softwareUpdate->version().platformNumber())
// {
// moreRecentAndAsStable = true;
// }
// }
// else if (Beta == installedVersion.releaseStage())
// {
// if (Alpha != softwareUpdate->version().releaseStage() &&
// installedVersion < softwareUpdate->version() &&
// installedVersion.platformNumber() == softwareUpdate->version().platformNumber())
// {
// moreRecentAndAsStable = true;
// }
// }
// else
// {
// if (ReleaseCandidate == softwareUpdate->version().releaseStage() &&
// installedVersion < softwareUpdate->version() &&
// installedVersion.platformNumber() == softwareUpdate->version().platformNumber())
// {
// moreRecentAndAsStable = true;
// }
// }
// if (moreRecentAndAsStable)
// {
// if (mostRecentSoftwareUpdate)
// {
// if (mostRecentSoftwareUpdate->version() < softwareUpdate->version())
// {
// mostRecentSoftwareUpdate = softwareUpdate;
// }
// }
// else
// {
// mostRecentSoftwareUpdate = softwareUpdate;
// }
// }
// }
// return mostRecentSoftwareUpdate;
//}
src/softwareupdate/UBSoftwareUpdateController.h
deleted
100644 → 0
View file @
2b678dd9
/*
* 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 UBSOFTWAREUPDATECONTROLLER_H_
//#define UBSOFTWAREUPDATECONTROLLER_H_
//#include <QObject>
//#include <QUrl>
//class UBVersion;
//class UBSoftwareUpdate;
//class UBHttpGet;
//class UBSoftwareUpdateController : public QObject
//{
// Q_OBJECT;
// public:
// UBSoftwareUpdateController(QObject *parent = 0);
// virtual ~UBSoftwareUpdateController();
// void beginRssDownload(const QUrl &url);
// void beginInstallerDownload(const QUrl &url);
// static const UBSoftwareUpdate* searchForMoreRecentAndAsStableSoftwareUpdate(const UBVersion &installedVersion,
// const QList<UBSoftwareUpdate *> &softwareUpdates);
// signals:
// void softwareUpdateAvailable(const UBVersion &installedVersion, const UBSoftwareUpdate &softwareUpdate);
// void noSoftwareUpdateAvailable();
// void failedToRetrieveSoftwareUpdateInfo();
// private slots:
// void rssDownloadFinished(bool success, const QByteArray &payload);
// void installerDownloadProgress(qint64 receivedBytes, qint64 bytesTotal);
// void installerDownloadFinished(bool success, QUrl sourceUrl, QString header, QByteArray data);
// private:
// // Helpers
// void parseRss(const QByteArray &rssContent);
// UBHttpGet *mHttp;
// qreal mLastDisplayedProgress;
// static const int sMinDisplayedDownloadedSizeInBytes;
// static const qreal sProgressPercentageStep;
//};
//#endif // UBSOFTWAREUPDATECONTROLLER_H_
src/softwareupdate/softwareupdate.pri
deleted
100644 → 0
View file @
2b678dd9
HEADERS += src/softwareupdate/UBSoftwareUpdateController.h \
src/softwareupdate/UBRssHandler.h \
src/softwareupdate/UBSoftwareUpdate.h
SOURCES += src/softwareupdate/UBSoftwareUpdateController.cpp \
src/softwareupdate/UBRssHandler.cpp \
src/softwareupdate/UBSoftwareUpdate.cpp
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment