Untie rbutil core logic from QtGui for cli:

- include QtCore instead of QtGui if possible
- replace qApp with QCoreApplication::instance(), as qApp is only defined for QtGui
- use QCoreApplication instead of QApplication for inherited static members.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16274 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2008-02-10 18:25:49 +00:00
parent 7b8f4a534d
commit ee09cb7f0d
18 changed files with 37 additions and 36 deletions

View file

@ -21,7 +21,7 @@
#ifndef AUTODETECTION_H_
#define AUTODETECTION_H_
#include <QtGui>
#include <QtCore>
extern "C" {
// Ipodpatcher

View file

@ -18,10 +18,10 @@
****************************************************************************/
#include "encoders.h"
#include "browsedirtree.h"
#ifndef CONSOLE
#include "encodersgui.h"
#include "browsedirtree.h"
#else
#include "encodersguicli.h"
#endif

View file

@ -20,7 +20,7 @@
#ifndef ENCODERS_H
#define ENCODERS_H
#include <QtGui>
#include <QtCore>
#include "rbsettings.h"

View file

@ -198,7 +198,7 @@ bool BootloaderInstaller::downloadInfo()
infoDownloaded=false;
infoError = false;
while(!infoDownloaded )
QApplication::processEvents();
QCoreApplication::processEvents();
return !infoError;
}
@ -222,8 +222,10 @@ void BootloaderInstaller::infoRequestFinished(int id, bool error)
QString errorString;
errorString = tr("Network error: %1. Please check your network and proxy settings.")
.arg(infodownloader->errorString());
#ifndef CONSOLE
if(error) QMessageBox::about(NULL, "Network Error", errorString);
qDebug() << "downloadDone:" << id << error;
#endif
qDebug() << "downloadDone:" << id << error;
infoError = true;
infoDownloaded = true;

View file

@ -20,7 +20,11 @@
#ifndef INSTALLBOOTLOADER_H
#define INSTALLBOOTLOADER_H
#ifndef CONSOLE
#include <QtGui>
#else
#include <QtCore>
#endif
#include "progressloggerinterface.h"
#include "httpget.h"

View file

@ -126,13 +126,13 @@ void ZipInstaller::downloadDone(bool error)
return;
}
else m_dp->addItem(tr("Download finished."),LOGOK);
QApplication::processEvents();
QCoreApplication::processEvents();
if(m_unzip) {
// unzip downloaded file
qDebug() << "about to unzip the downloaded file" << m_file << "to" << m_mountpoint;
m_dp->addItem(tr("Extracting file."),LOGINFO);
QApplication::processEvents();
QCoreApplication::processEvents();
qDebug() << "file to unzip: " << m_file;
UnZip::ErrorCode ec;

View file

@ -23,7 +23,7 @@
#include <QtGui>
#include <QtCore>
#include <QtNetwork>
#include "progressloggerinterface.h"

View file

@ -22,7 +22,7 @@
#ifndef IRIVERTOOLS_H_INCLUDED
#define IRIVERTOOLS_H_INCLUDED
#include <QtGui>
#include <QtCore>
#include "md5sum.h"
#include "progressloggerinterface.h"

View file

@ -31,7 +31,7 @@
#define uint32 unsigned long int
#endif
#include <QtGui>
#include <QtCore>
typedef struct
{

View file

@ -29,7 +29,7 @@ Q_IMPORT_PLUGIN(qtaccessiblewidgets)
int main( int argc, char ** argv ) {
QApplication app( argc, argv );
QString absolutePath = qApp->applicationDirPath();
QString absolutePath = QCoreApplication::instance()->applicationDirPath();
// portable installation:
// check for a configuration file in the program folder.
QSettings *user;

View file

@ -20,7 +20,7 @@
#ifndef PROGRESSLOGGERINTERFACE_H
#define PROGRESSLOGGERINTERFACE_H
#include <QtGui>
#include <QtCore>
enum {
LOGNOICON, LOGOK, LOGINFO, LOGWARNING, LOGERROR

View file

@ -28,10 +28,10 @@ void RbSettings::open()
// portable installation:
// check for a configuration file in the program folder.
QFileInfo config;
config.setFile(qApp->applicationDirPath() + "/RockboxUtility.ini");
config.setFile(QCoreApplication::instance()->applicationDirPath() + "/RockboxUtility.ini");
if(config.isFile())
{
userSettings = new QSettings(qApp->applicationDirPath() + "/RockboxUtility.ini",
userSettings = new QSettings(QCoreApplication::instance()->applicationDirPath() + "/RockboxUtility.ini",
QSettings::IniFormat, this);
qDebug() << "config: portable";
}

View file

@ -20,7 +20,8 @@
#ifndef RBSETTINGS_H
#define RBSETTINGS_H
#include <QtGui>
#include <QtCore>
class QSettings;
class RbSettings : public QObject
@ -79,7 +80,7 @@ class RbSettings : public QObject
QString name(QString plattform);
QString brand(QString plattform);
QStringList allLanguages();
bool curNeedsBootloader();
QString curBrand();
QString curName();
@ -94,9 +95,7 @@ class RbSettings : public QObject
QString curTTS();
QString curResolution();
int curTargetId();
void setOfPath(QString path);
void setCachePath(QString path);
void setBuild(QString build);
@ -123,11 +122,7 @@ class RbSettings : public QObject
void setEncoderComplexity(QString enc, int c);
void setEncoderVolume(QString enc,double v);
void setEncoderNarrowband(QString enc,bool nb);
private:
QSettings *devices;
QSettings *userSettings;

View file

@ -55,7 +55,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
return false;
}
QApplication::processEvents();
QCoreApplication::processEvents();
connect(logger,SIGNAL(aborted()),this,SLOT(abort()));
m_logger->setProgressMax(0);
@ -78,7 +78,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
return false;
}
QApplication::processEvents();
QCoreApplication::processEvents();
QFileInfo fileInf = it.fileInfo();
QString toSpeak;
QString filename;
@ -144,7 +144,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
return false;
}
QApplication::processEvents();
QCoreApplication::processEvents();
}
m_logger->addItem(tr("Encoding of %1").arg(toSpeak),LOGINFO);
if(!m_enc->encode(wavfilename,filename))
@ -156,7 +156,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
return false;
}
QApplication::processEvents();
QCoreApplication::processEvents();
}
//! remove the intermedia wav file, if requested

View file

@ -21,7 +21,7 @@
#ifndef TALKFILE_H
#define TALKFILE_H
#include <QtGui>
#include <QtCore>
#include "progressloggerinterface.h"
#include "encoders.h"

View file

@ -23,7 +23,7 @@
#include "rbsettings.h"
#include <QtGui>
#include <QtCore>
#ifndef CONSOLE
#include "ttsgui.h"

View file

@ -126,7 +126,7 @@ void VoiceFileCreator::downloadDone(bool error)
return;
}
else m_logger->addItem(tr("Download finished."),LOGOK);
QApplication::processEvents();
QCoreApplication::processEvents();
m_logger->setProgressMax(0);
@ -167,7 +167,7 @@ void VoiceFileCreator::downloadDone(bool error)
return;
}
QApplication::processEvents();
QCoreApplication::processEvents();
connect(m_logger,SIGNAL(aborted()),this,SLOT(abort()));
//read in downloaded file
@ -242,8 +242,8 @@ void VoiceFileCreator::downloadDone(bool error)
{
if(toSpeak == "") continue;
m_logger->addItem(tr("creating ")+toSpeak,LOGINFO);
QApplication::processEvents();
m_logger->addItem(tr("creating ")+toSpeak,LOGINFO);
QCoreApplication::processEvents();
m_tts->voice(toSpeak,wavname); // generate wav
}
@ -257,7 +257,7 @@ void VoiceFileCreator::downloadDone(bool error)
// remove the wav file
QFile::remove(wavname);
// remember the mp3 file for later removing
mp3files << encodedname;
mp3files << encodedname;
}

View file

@ -21,7 +21,7 @@
#ifndef VOICEFILE_H
#define VOICEFILE_H
#include <QtGui>
#include <QtCore>
#include "progressloggerinterface.h"
#include "encoders.h"