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_ #ifndef AUTODETECTION_H_
#define AUTODETECTION_H_ #define AUTODETECTION_H_
#include <QtGui> #include <QtCore>
extern "C" { extern "C" {
// Ipodpatcher // Ipodpatcher

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -20,7 +20,8 @@
#ifndef RBSETTINGS_H #ifndef RBSETTINGS_H
#define RBSETTINGS_H #define RBSETTINGS_H
#include <QtGui> #include <QtCore>
class QSettings; class QSettings;
class RbSettings : public QObject class RbSettings : public QObject
@ -95,8 +96,6 @@ class RbSettings : public QObject
QString curResolution(); QString curResolution();
int curTargetId(); int curTargetId();
void setOfPath(QString path); void setOfPath(QString path);
void setCachePath(QString path); void setCachePath(QString path);
void setBuild(QString build); void setBuild(QString build);
@ -124,10 +123,6 @@ class RbSettings : public QObject
void setEncoderVolume(QString enc,double v); void setEncoderVolume(QString enc,double v);
void setEncoderNarrowband(QString enc,bool nb); void setEncoderNarrowband(QString enc,bool nb);
private: private:
QSettings *devices; QSettings *devices;
QSettings *userSettings; QSettings *userSettings;

View file

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

View file

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

View file

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

View file

@ -126,7 +126,7 @@ void VoiceFileCreator::downloadDone(bool error)
return; return;
} }
else m_logger->addItem(tr("Download finished."),LOGOK); else m_logger->addItem(tr("Download finished."),LOGOK);
QApplication::processEvents(); QCoreApplication::processEvents();
m_logger->setProgressMax(0); m_logger->setProgressMax(0);
@ -167,7 +167,7 @@ void VoiceFileCreator::downloadDone(bool error)
return; return;
} }
QApplication::processEvents(); QCoreApplication::processEvents();
connect(m_logger,SIGNAL(aborted()),this,SLOT(abort())); connect(m_logger,SIGNAL(aborted()),this,SLOT(abort()));
//read in downloaded file //read in downloaded file
@ -243,7 +243,7 @@ void VoiceFileCreator::downloadDone(bool error)
if(toSpeak == "") continue; if(toSpeak == "") continue;
m_logger->addItem(tr("creating ")+toSpeak,LOGINFO); m_logger->addItem(tr("creating ")+toSpeak,LOGINFO);
QApplication::processEvents(); QCoreApplication::processEvents();
m_tts->voice(toSpeak,wavname); // generate wav m_tts->voice(toSpeak,wavname); // generate wav
} }

View file

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