1
0
Fork 0
forked from len0rd/rockbox

Remove Rockbox Utility Offline Mode.

Offline Mode was intended to allow performing an installation without network
access. However, to get the required files cached the same installation has to
be performed with network access, which is a rather strange prerequisite. A
better way would be a way to direct Rockbox Utility to some local "repository"
that holds the required files.

Furthermore, Offline Mode hasn't been tested since long and is likely to be
broken since the caching mechanism has been extended.

For now remove this functionality. As far as I know it's been rarely used (if
at all) anyway.

Change-Id: Ib2af4892708e0440bd0a7940c131f04182ddb39a
This commit is contained in:
Dominik Riebeling 2013-01-13 19:45:29 +01:00
parent d608fd604b
commit 1f1826e39c
8 changed files with 2 additions and 32 deletions

View file

@ -24,7 +24,6 @@
QDir HttpGet::m_globalCache; //< global cach path value for new objects QDir HttpGet::m_globalCache; //< global cach path value for new objects
QUrl HttpGet::m_globalProxy; //< global proxy value for new objects QUrl HttpGet::m_globalProxy; //< global proxy value for new objects
bool HttpGet::m_globalDumbCache = false; //< globally set cache "dumb" mode
QString HttpGet::m_globalUserAgent; //< globally set user agent for requests QString HttpGet::m_globalUserAgent; //< globally set user agent for requests
HttpGet::HttpGet(QObject *parent) HttpGet::HttpGet(QObject *parent)
@ -32,7 +31,6 @@ HttpGet::HttpGet(QObject *parent)
{ {
outputToBuffer = true; outputToBuffer = true;
m_cached = false; m_cached = false;
m_dumbCache = m_globalDumbCache;
getRequest = -1; getRequest = -1;
headRequest = -1; headRequest = -1;
// if a request is cancelled before a reponse is available return some // if a request is cancelled before a reponse is available return some
@ -213,7 +211,7 @@ bool HttpGet::getFile(const QUrl &url)
m_header.setValue("User-Agent", m_globalUserAgent); m_header.setValue("User-Agent", m_globalUserAgent);
m_header.setValue("Connection", "Keep-Alive"); m_header.setValue("Connection", "Keep-Alive");
if(m_dumbCache || !m_usecache) { if(!m_usecache) {
getFileFinish(); getFileFinish();
} }
else { else {

View file

@ -45,14 +45,10 @@ class HttpGet : public QObject
{ return m_cached; } { return m_cached; }
QDateTime timestamp(void) QDateTime timestamp(void)
{ return m_serverTimestamp; } { return m_serverTimestamp; }
void setDumbCache(bool b) //< disable checking of http header timestamp for caching
{ m_dumbCache = b; }
static void setGlobalCache(const QDir& d) //< set global cache path static void setGlobalCache(const QDir& d) //< set global cache path
{ m_globalCache = d; } { m_globalCache = d; }
static void setGlobalProxy(const QUrl& p) //< set global proxy value static void setGlobalProxy(const QUrl& p) //< set global proxy value
{ m_globalProxy = p; } { m_globalProxy = p; }
static void setGlobalDumbCache(bool b) //< set "dumb" (ignore server status) caching mode
{ m_globalDumbCache = b; }
static void setGlobalUserAgent(const QString& u) //< set global user agent string static void setGlobalUserAgent(const QString& u) //< set global user agent string
{ m_globalUserAgent = u; } { m_globalUserAgent = u; }
@ -92,12 +88,10 @@ class HttpGet : public QObject
QString m_query; //< constructed query to pass http getter QString m_query; //< constructed query to pass http getter
QString m_path; //< constructed path to pass http getter QString m_path; //< constructed path to pass http getter
QString m_hash; //< caching hash QString m_hash; //< caching hash
bool m_dumbCache; //< true if caching should ignore the server header
QHttpRequestHeader m_header; QHttpRequestHeader m_header;
static QDir m_globalCache; //< global cache path value static QDir m_globalCache; //< global cache path value
static QUrl m_globalProxy; //< global proxy value static QUrl m_globalProxy; //< global proxy value
static bool m_globalDumbCache; //< cache "dumb" mode global setting
static QString m_globalUserAgent; //< global user agent string static QString m_globalUserAgent; //< global user agent string
}; };

View file

@ -69,7 +69,6 @@ const static struct {
{ RbSettings::TtsVoice, ":tts:/voice", "" }, { RbSettings::TtsVoice, ":tts:/voice", "" },
{ RbSettings::EncoderPath, ":encoder:/encoderpath", "" }, { RbSettings::EncoderPath, ":encoder:/encoderpath", "" },
{ RbSettings::EncoderOptions, ":encoder:/encoderoptions", "" }, { RbSettings::EncoderOptions, ":encoder:/encoderoptions", "" },
{ RbSettings::CacheOffline, "offline", "false" },
{ RbSettings::CacheDisabled, "cachedisable", "false" }, { RbSettings::CacheDisabled, "cachedisable", "false" },
{ RbSettings::TtsUseSapi4, "sapi/useSapi4", "false" }, { RbSettings::TtsUseSapi4, "sapi/useSapi4", "false" },
{ RbSettings::EncoderNarrowBand, ":encoder:/narrowband", "false" }, { RbSettings::EncoderNarrowBand, ":encoder:/narrowband", "false" },

View file

@ -66,7 +66,6 @@ class RbSettings : public QObject
WavtrimThreshold, WavtrimThreshold,
EncoderComplexity, EncoderComplexity,
TtsSpeed, TtsSpeed,
CacheOffline,
CacheDisabled, CacheDisabled,
TtsUseSapi4, TtsUseSapi4,
EncoderNarrowBand, EncoderNarrowBand,

View file

@ -202,7 +202,6 @@ void Config::accept()
else // default to system temp path else // default to system temp path
RbSettings::setValue(RbSettings::CachePath, QDir::tempPath()); RbSettings::setValue(RbSettings::CachePath, QDir::tempPath());
RbSettings::setValue(RbSettings::CacheDisabled, ui.cacheDisable->isChecked()); RbSettings::setValue(RbSettings::CacheDisabled, ui.cacheDisable->isChecked());
RbSettings::setValue(RbSettings::CacheOffline, ui.cacheOfflineMode->isChecked());
// tts settings // tts settings
RbSettings::setValue(RbSettings::UseTtsCorrections, ui.ttsCorrections->isChecked()); RbSettings::setValue(RbSettings::UseTtsCorrections, ui.ttsCorrections->isChecked());
@ -287,7 +286,6 @@ void Config::setUserSettings()
RbSettings::setValue(RbSettings::CachePath, QDir::tempPath()); RbSettings::setValue(RbSettings::CachePath, QDir::tempPath());
ui.cachePath->setText(QDir::toNativeSeparators(RbSettings::value(RbSettings::CachePath).toString())); ui.cachePath->setText(QDir::toNativeSeparators(RbSettings::value(RbSettings::CachePath).toString()));
ui.cacheDisable->setChecked(RbSettings::value(RbSettings::CacheDisabled).toBool()); ui.cacheDisable->setChecked(RbSettings::value(RbSettings::CacheDisabled).toBool());
ui.cacheOfflineMode->setChecked(RbSettings::value(RbSettings::CacheOffline).toBool());
updateCacheInfo(RbSettings::value(RbSettings::CachePath).toString()); updateCacheInfo(RbSettings::value(RbSettings::CachePath).toString());
// TTS tab // TTS tab

View file

@ -328,16 +328,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="cacheOfflineMode">
<property name="toolTip">
<string>&lt;p&gt;This will try to use all information from the cache, even information about updates. Only use this option if you want to install without network connection. Note: you need to do the same install you want to perform later with network access first to download all required files to the cache.&lt;/p&gt;</string>
</property>
<property name="text">
<string>O&amp;ffline mode</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item row="4" column="1"> <item row="4" column="1">

View file

@ -210,10 +210,7 @@ void RbUtilQt::downloadInfo()
daily = new HttpGet(this); daily = new HttpGet(this);
connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort()));
if(RbSettings::value(RbSettings::CacheOffline).toBool()) daily->setCache(false);
daily->setCache(true);
else
daily->setCache(false);
ui.statusbar->showMessage(tr("Downloading build information, please wait ...")); ui.statusbar->showMessage(tr("Downloading build information, please wait ..."));
qDebug() << "[RbUtil] downloading build info"; qDebug() << "[RbUtil] downloading build info";
daily->setFile(&buildInfo); daily->setFile(&buildInfo);
@ -311,7 +308,6 @@ void RbUtilQt::updateSettings()
manual->updateManual(); manual->updateManual();
HttpGet::setGlobalProxy(proxy()); HttpGet::setGlobalProxy(proxy());
HttpGet::setGlobalCache(RbSettings::value(RbSettings::CachePath).toString()); HttpGet::setGlobalCache(RbSettings::value(RbSettings::CachePath).toString());
HttpGet::setGlobalDumbCache(RbSettings::value(RbSettings::CacheOffline).toBool());
if(RbSettings::value(RbSettings::RbutilVersion) != PUREVERSION) { if(RbSettings::value(RbSettings::RbutilVersion) != PUREVERSION) {
QApplication::processEvents(); QApplication::processEvents();
@ -645,8 +641,6 @@ void RbUtilQt::checkUpdate(void)
update = new HttpGet(this); update = new HttpGet(this);
connect(update, SIGNAL(done(bool)), this, SLOT(downloadUpdateDone(bool))); connect(update, SIGNAL(done(bool)), this, SLOT(downloadUpdateDone(bool)));
connect(qApp, SIGNAL(lastWindowClosed()), update, SLOT(abort())); connect(qApp, SIGNAL(lastWindowClosed()), update, SLOT(abort()));
if(RbSettings::value(RbSettings::CacheOffline).toBool())
update->setCache(true);
ui.statusbar->showMessage(tr("Checking for update ...")); ui.statusbar->showMessage(tr("Checking for update ..."));
update->getFile(QUrl(url)); update->getFile(QUrl(url));

View file

@ -76,8 +76,6 @@ void ThemesInstallWindow::downloadInfo()
infoUrl.replace("%RBUTILVER%", VERSION); infoUrl.replace("%RBUTILVER%", VERSION);
QUrl url = QUrl(infoUrl); QUrl url = QUrl(infoUrl);
qDebug() << "[Themes] Info URL:" << url << "Query:" << url.queryItems(); qDebug() << "[Themes] Info URL:" << url << "Query:" << url.queryItems();
if(RbSettings::value(RbSettings::CacheOffline).toBool())
getter->setCache(true);
getter->setFile(&themesInfo); getter->setFile(&themesInfo);
connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));