rbutil: Modernize code to use C++11 nullptr.

Change-Id: I112cf95122a896cdb30a823b4c1f49831273dc7e
This commit is contained in:
Dominik Riebeling 2020-11-19 20:36:57 +01:00
parent f608de723c
commit 12764781c6
58 changed files with 111 additions and 111 deletions

View file

@ -250,7 +250,7 @@ void Autodetection::mergePatcher(void)
// try ipodpatcher
// initialize sector buffer. Needed.
struct ipod_t ipod;
ipod.sectorbuf = NULL;
ipod.sectorbuf = nullptr;
ipod_alloc_buffer(&ipod, BUFFER_SIZE);
n = ipod_scan(&ipod);
// FIXME: handle more than one Ipod connected in ipodpatcher.

View file

@ -32,7 +32,7 @@ class Autodetection :public QObject
Q_OBJECT
public:
Autodetection(QObject* parent=0);
Autodetection(QObject* parent=nullptr);
enum PlayerStatus {
PlayerOk,

View file

@ -93,7 +93,7 @@ void BootloaderInstallAms::installStage2(void)
rb_packed = load_rockbox_file(bootfile.toLocal8Bit().data(), &model,
&bootloader_size,&rb_packedsize,
errstr,sizeof(errstr));
if (rb_packed == NULL)
if (rb_packed == nullptr)
{
LOG_ERROR() << "could not load bootloader: " << bootfile;
emit logItem(errstr, LOGERROR);
@ -106,7 +106,7 @@ void BootloaderInstallAms::installStage2(void)
buf = load_of_file(m_offile.toLocal8Bit().data(), model, &len, &sum,
&firmware_size, &of_packed ,&of_packedsize,
errstr, sizeof(errstr));
if (buf == NULL)
if (buf == nullptr)
{
LOG_ERROR() << "could not load OF: " << m_offile;
emit logItem(errstr, LOGERROR);

View file

@ -246,7 +246,7 @@ bool BootloaderInstallBase::setOfFile(QString of, QStringList blfile)
delete zu;
// if ZIP failed, try CAB
if(util == 0)
if(util == nullptr)
{
MsPackUtil *msu = new MsPackUtil(this);
if(msu->open(of))

View file

@ -57,7 +57,7 @@ void BootloaderThreadBSPatch::run(void)
BootloaderInstallBSPatch::BootloaderInstallBSPatch(QObject *parent)
: BootloaderInstallBase(parent)
{
m_thread = NULL;
m_thread = nullptr;
}
QString BootloaderInstallBSPatch::ofHint()

View file

@ -27,7 +27,7 @@ class BootloaderInstallChinaChip : public BootloaderInstallBase
Q_OBJECT
public:
BootloaderInstallChinaChip(QObject *parent = 0);
BootloaderInstallChinaChip(QObject *parent = nullptr);
bool install(void);
bool uninstall(void);
BootloaderInstallBase::BootloaderType installed(void);

View file

@ -73,7 +73,7 @@ BootloaderInstallBase* BootloaderInstallHelper::createBootloaderInstaller(QObjec
return new BootloaderInstallBSPatch(parent);
}
else {
return NULL;
return nullptr;
}
}

View file

@ -32,11 +32,11 @@ struct md5s {
struct md5s md5sums[] = {
#include "irivertools/h100sums.h"
{ 0, 0 },
{ nullptr, nullptr },
#include "irivertools/h120sums.h"
{ 0, 0 },
{ nullptr, nullptr },
#include "irivertools/h300sums.h"
{ 0, 0 }
{ nullptr, nullptr }
};
@ -86,7 +86,7 @@ bool BootloaderInstallHex::install(void)
m_model = 4;
// 3: h300, 2: h120, 1: h100, 0:invalid
while(i--) {
if(md5sums[i].orig == 0)
if(md5sums[i].orig == nullptr)
m_model--;
if(!qstrcmp(md5sums[i].orig, hash.toLatin1()))
break;

View file

@ -31,7 +31,7 @@ class BootloaderInstallHex : public BootloaderInstallBase
Q_OBJECT
public:
BootloaderInstallHex(QObject *parent = 0);
BootloaderInstallHex(QObject *parent = nullptr);
bool install(void);
bool uninstall(void);
BootloaderInstallBase::BootloaderType installed(void);

View file

@ -63,7 +63,7 @@ void BootloaderThreadImx::run(void)
BootloaderInstallImx::BootloaderInstallImx(QObject *parent)
: BootloaderInstallBase(parent)
{
m_thread = NULL;
m_thread = nullptr;
}

View file

@ -45,7 +45,7 @@ BootloaderInstallIpod::~BootloaderInstallIpod()
bool BootloaderInstallIpod::install(void)
{
if(ipod.sectorbuf == NULL) {
if(ipod.sectorbuf == nullptr) {
emit logItem(tr("Error: can't allocate buffer memory!"), LOGERROR);
emit done(true);
return false;

View file

@ -46,7 +46,7 @@ BootloaderInstallSansa::~BootloaderInstallSansa()
*/
bool BootloaderInstallSansa::install(void)
{
if(sansa.sectorbuf == NULL) {
if(sansa.sectorbuf == nullptr) {
emit logItem(tr("Error: can't allocate buffer memory!"), LOGERROR);
return false;
emit done(true);
@ -88,7 +88,7 @@ bool BootloaderInstallSansa::install(void)
*/
void BootloaderInstallSansa::installStage2(void)
{
unsigned char* buf = NULL;
unsigned char* buf = nullptr;
unsigned int len;
emit logItem(tr("Installing Rockbox bootloader"), LOGINFO);

View file

@ -30,7 +30,7 @@ class BootloaderInstallSansa : public BootloaderInstallBase
Q_OBJECT
public:
BootloaderInstallSansa(QObject *parent = 0);
BootloaderInstallSansa(QObject *parent = nullptr);
~BootloaderInstallSansa();
bool install(void);
bool uninstall(void);

View file

@ -57,7 +57,7 @@ bool BootloaderInstallTcc::install(void)
void BootloaderInstallTcc::installStage2(void)
{
unsigned char *of_buf, *boot_buf = NULL, *patched_buf = NULL;
unsigned char *of_buf, *boot_buf = nullptr, *patched_buf = nullptr;
int n, of_size, boot_size, patched_size;
char errstr[200];
bool ret = false;
@ -76,7 +76,7 @@ void BootloaderInstallTcc::installStage2(void)
/* Load original firmware file */
of_buf = file_read(m_offile.toLocal8Bit().data(), &of_size);
if (of_buf == NULL)
if (of_buf == nullptr)
{
emit logItem(errstr, LOGERROR);
emit logItem(tr("Could not load %1").arg(m_offile), LOGERROR);
@ -93,7 +93,7 @@ void BootloaderInstallTcc::installStage2(void)
/* Load bootloader file */
boot_buf = file_read(bootfile.toLocal8Bit().data(), &boot_size);
if (boot_buf == NULL)
if (boot_buf == nullptr)
{
emit logItem(errstr, LOGERROR);
emit logItem(tr("Could not load %1").arg(bootfile), LOGERROR);
@ -105,7 +105,7 @@ void BootloaderInstallTcc::installStage2(void)
patched_buf = patch_firmware_tcc(of_buf, of_size, boot_buf, boot_size,
&patched_size);
if (patched_buf == NULL)
if (patched_buf == nullptr)
{
emit logItem(errstr, LOGERROR);
emit logItem(tr("Could not patch firmware"), LOGERROR);

View file

@ -34,7 +34,7 @@ class EncoderExe : public EncoderBase
Q_OBJECT
public:
EncoderExe(QString name,QObject *parent = NULL);
EncoderExe(QString name,QObject *parent = nullptr);
bool encode(QString input,QString output);
bool start();
bool stop() {return true;}

View file

@ -83,11 +83,11 @@ bool EncoderRbSpeex::encode(QString input,QString output)
char errstr[512];
FILE *fin,*fout;
if ((fin = fopen(input.toLocal8Bit(), "rb")) == NULL) {
if ((fin = fopen(input.toLocal8Bit(), "rb")) == nullptr) {
LOG_ERROR() << "Error: could not open input file\n";
return false;
}
if ((fout = fopen(output.toLocal8Bit(), "wb")) == NULL) {
if ((fout = fopen(output.toLocal8Bit(), "wb")) == nullptr) {
LOG_ERROR() << "Error: could not open output file\n";
fclose(fin);
return false;

View file

@ -34,7 +34,7 @@ class EncoderRbSpeex : public EncoderBase
Q_OBJECT
public:
EncoderRbSpeex(QObject *parent = NULL);
EncoderRbSpeex(QObject *parent = nullptr);
bool encode(QString input,QString output);
bool start();
bool stop() {return true;}

View file

@ -32,7 +32,7 @@ class HttpGet : public QObject
Q_OBJECT
public:
HttpGet(QObject *parent = 0);
HttpGet(QObject *parent = nullptr);
void getFile(const QUrl &url);
void setProxy(const QUrl &url);

View file

@ -24,8 +24,8 @@
MsPackUtil::MsPackUtil(QObject* parent)
:ArchiveUtil(parent)
{
m_cabd = mspack_create_cab_decompressor(NULL);
m_cabinet = NULL;
m_cabd = mspack_create_cab_decompressor(nullptr);
m_cabinet = nullptr;
if(!m_cabd)
LOG_ERROR() << "CAB decompressor creation failed!";
}
@ -41,20 +41,20 @@ bool MsPackUtil::open(QString& mspackfile)
{
close();
if(m_cabd == NULL)
if(m_cabd == nullptr)
{
LOG_ERROR() << "No CAB decompressor available: cannot open file!";
return false;
}
m_cabinet = m_cabd->search(m_cabd, QFile::encodeName(mspackfile).constData());
return m_cabinet != NULL;
return m_cabinet != nullptr;
}
bool MsPackUtil::close(void)
{
if(m_cabd && m_cabinet)
m_cabd->close(m_cabd, m_cabinet);
m_cabinet = NULL;
m_cabinet = nullptr;
return true;
}
@ -76,7 +76,7 @@ bool MsPackUtil::extractArchive(const QString& dest, QString file)
else if(!file.isEmpty())
singleoutfile = dest;
struct mscabd_file *f = m_cabinet->files;
if(f == NULL)
if(f == nullptr)
{
LOG_WARNING() << "CAB doesn't contain file" << file;
return true;

View file

@ -82,11 +82,11 @@ const static struct {
};
//! pointer to setting object to NULL
QSettings* RbSettings::userSettings = NULL;
QSettings* RbSettings::userSettings = nullptr;
void RbSettings::ensureRbSettingsExists()
{
if(userSettings == NULL)
if(userSettings == nullptr)
{
// portable installation:
// check for a configuration file in the program folder.
@ -96,13 +96,13 @@ void RbSettings::ensureRbSettingsExists()
if(config.isFile())
{
userSettings = new QSettings(QCoreApplication::instance()->applicationDirPath()
+ "/RockboxUtility.ini", QSettings::IniFormat, NULL);
+ "/RockboxUtility.ini", QSettings::IniFormat, nullptr);
LOG_INFO() << "configuration: portable";
}
else
{
userSettings = new QSettings(QSettings::IniFormat,
QSettings::UserScope, "rockbox.org", "RockboxUtility",NULL);
QSettings::UserScope, "rockbox.org", "RockboxUtility",nullptr);
LOG_INFO() << "configuration: system";
}
}
@ -123,7 +123,7 @@ void RbSettings::sync()
{
char* realuser = getenv("SUDO_UID");
char* realgroup = getenv("SUDO_GID");
if(realuser != NULL && realgroup != NULL)
if(realuser != nullptr && realgroup != nullptr)
{
int realuid = atoi(realuser);
int realgid = atoi(realgroup);

View file

@ -242,18 +242,18 @@ QMultiMap<uint32_t, QString> System::listUsbDevices(void)
LOG_INFO() << "Searching for USB devices";
#if defined(Q_OS_LINUX)
libusb_device **devs;
if(libusb_init(NULL) != 0) {
if(libusb_init(nullptr) != 0) {
LOG_ERROR() << "Initializing libusb-1 failed.";
return usbids;
}
if(libusb_get_device_list(NULL, &devs) < 1) {
if(libusb_get_device_list(nullptr, &devs) < 1) {
LOG_ERROR() << "Error getting device list.";
return usbids;
}
libusb_device *dev;
int i = 0;
while((dev = devs[i++]) != NULL) {
while((dev = devs[i++]) != nullptr) {
QString name;
unsigned char buf[256];
uint32_t id;
@ -279,7 +279,7 @@ QMultiMap<uint32_t, QString> System::listUsbDevices(void)
}
libusb_free_device_list(devs, 1);
libusb_exit(NULL);
libusb_exit(nullptr);
#endif
#if defined(Q_OS_MACX)

View file

@ -200,7 +200,7 @@ QMap<int, QStringList> SystemInfo::usbIdMap(enum MapType type)
int j = ids.size();
while(j--) {
QStringList l;
int id = ids.at(j).toInt(0, 16);
int id = ids.at(j).toInt(nullptr, 16);
if(id == 0) {
continue;
}

View file

@ -230,7 +230,7 @@ bool TalkFileCreator::copyTalkFiles(QString* errString)
int m_progress = 0;
emit logProgress(m_progress,progressMax);
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, nullptr);
installlog.beginGroup("talkfiles");
for(int i=0; i < m_talkList.size(); i++)

View file

@ -69,7 +69,7 @@ void TTSBase::initTTSList()
TTSBase* TTSBase::getTTS(QObject* parent,QString ttsName)
{
TTSBase* tts = 0;
TTSBase* tts = nullptr;
#if defined(Q_OS_WIN)
if(ttsName == "sapi")
tts = new TTSSapi(parent);

View file

@ -28,7 +28,7 @@ class TTSEspeak : public TTSExes
{
Q_OBJECT
public:
TTSEspeak(QObject* parent=NULL) : TTSExes(parent)
TTSEspeak(QObject* parent=nullptr) : TTSExes(parent)
{
m_name = "espeak";

View file

@ -28,7 +28,7 @@ class TTSEspeakNG : public TTSExes
{
Q_OBJECT
public:
TTSEspeakNG(QObject* parent=NULL) : TTSExes(parent)
TTSEspeakNG(QObject* parent=nullptr) : TTSExes(parent)
{
m_name = "espeak-ng";

View file

@ -34,7 +34,7 @@ class TTSExes : public TTSBase
Q_OBJECT
public:
TTSExes(QObject* parent=NULL);
TTSExes(QObject* parent=nullptr);
TTSStatus voice(QString text, QString wavfile, QString *errStr);
bool start(QString *errStr);
bool stop() {return true;}

View file

@ -36,7 +36,7 @@ class TTSFestival : public TTSBase
Q_OBJECT
public:
TTSFestival(QObject* parent=NULL) : TTSBase(parent) {}
TTSFestival(QObject* parent=nullptr) : TTSBase(parent) {}
~TTSFestival();
bool start(QString *errStr);
bool stop();

View file

@ -28,7 +28,7 @@ class TTSFlite : public TTSExes
{
Q_OBJECT
public:
TTSFlite(QObject* parent=NULL) : TTSExes(parent)
TTSFlite(QObject* parent=nullptr) : TTSExes(parent)
{
m_name = "flite";

View file

@ -28,7 +28,7 @@ class TTSMimic : public TTSExes
{
Q_OBJECT
public:
TTSMimic(QObject* parent=NULL) : TTSExes(parent)
TTSMimic(QObject* parent=nullptr) : TTSExes(parent)
{
m_name = "mimic";

View file

@ -28,7 +28,7 @@ class TTSMssp: public TTSSapi
{
Q_OBJECT
public:
TTSMssp(QObject* parent=NULL) : TTSSapi(parent)
TTSMssp(QObject* parent=nullptr) : TTSSapi(parent)
{
m_TTSTemplate = "cscript //nologo \"%exe\" "
"/language:%lang /voice:\"%voice\" "

View file

@ -124,7 +124,7 @@ bool TTSSapi::start(QString *errStr)
execstring.replace("%speed",m_TTSSpeed);
LOG_INFO() << "Start:" << execstring;
voicescript = new QProcess(NULL);
voicescript = new QProcess(nullptr);
//connect(voicescript,SIGNAL(readyReadStandardError()),this,SLOT(error()));
voicescript->start(execstring);
LOG_INFO() << "wait for process";
@ -190,7 +190,7 @@ QStringList TTSSapi::getVoiceList(QString language)
execstring.replace("%lang",language);
LOG_INFO() << "Start:" << execstring;
voicescript = new QProcess(NULL);
voicescript = new QProcess(nullptr);
voicescript->start(execstring);
LOG_INFO() << "wait for process";
if(!voicescript->waitForStarted()) {

View file

@ -36,7 +36,7 @@ class TTSSapi : public TTSBase
Q_OBJECT
public:
TTSSapi(QObject* parent=NULL);
TTSSapi(QObject* parent=nullptr);
TTSStatus voice(QString text,QString wavfile, QString *errStr);
bool start(QString *errStr);

View file

@ -28,7 +28,7 @@ class TTSSapi4: public TTSSapi
{
Q_OBJECT
public:
TTSSapi4(QObject* parent=NULL) : TTSSapi(parent)
TTSSapi4(QObject* parent=nullptr) : TTSSapi(parent)
{
m_TTSTemplate = "cscript //nologo \"%exe\" "
"/language:%lang /voice:\"%voice\" "

View file

@ -28,7 +28,7 @@ class TTSSwift : public TTSExes
{
Q_OBJECT
public:
TTSSwift(QObject* parent=NULL) : TTSExes(parent)
TTSSwift(QObject* parent=nullptr) : TTSExes(parent)
{
m_name = "swift";
m_TTSTemplate = "\"%exe\" %options -o \"%wavfile\" -- \"%text\"";

View file

@ -112,7 +112,7 @@ void Uninstaller::uninstall(void)
QStringList Uninstaller::getAllSections()
{
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, nullptr);
QStringList allSections = installlog.childGroups();
allSections.removeAt(allSections.lastIndexOf("Bootloader"));
return allSections;

View file

@ -300,7 +300,7 @@ void VoiceFileCreator::create(void)
//make voicefile
emit logItem(tr("Creating voicefiles..."),LOGINFO);
FILE* ids2 = fopen(m_filename.toLocal8Bit(), "r");
if (ids2 == NULL)
if (ids2 == nullptr)
{
cleanup();
emit logItem(tr("Error opening downloaded file"),LOGERROR);
@ -310,7 +310,7 @@ void VoiceFileCreator::create(void)
FILE* output = fopen(QString(m_mountpoint + "/.rockbox/langs/" + m_lang
+ ".voice").toLocal8Bit(), "wb");
if (output == NULL)
if (output == nullptr)
{
cleanup();
fclose(ids2);
@ -327,7 +327,7 @@ void VoiceFileCreator::create(void)
cleanup();
// Add Voice file to the install log
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, nullptr);
installlog.beginGroup(QString("Voice (self created, %1)").arg(m_lang));
installlog.setValue("/.rockbox/langs/" + m_lang + ".voice", m_versionstring);
installlog.endGroup();

View file

@ -24,7 +24,7 @@
ZipInstaller::ZipInstaller(QObject* parent) :
QObject(parent),
m_unzip(true), m_usecache(false), m_getter(0)
m_unzip(true), m_usecache(false), m_getter(nullptr)
{
}
@ -87,7 +87,7 @@ void ZipInstaller::installStart()
m_file = m_downloadFile->fileName();
m_downloadFile->close();
// get the real file.
if(m_getter != 0) m_getter->deleteLater();
if(m_getter != nullptr) m_getter->deleteLater();
m_getter = new HttpGet(this);
if(m_usecache) {
m_getter->setCache(true);
@ -188,7 +188,7 @@ void ZipInstaller::downloadDone(bool error)
}
emit logItem(tr("Creating installation log"),LOGINFO);
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, nullptr);
installlog.beginGroup(m_logsection);
for(int i = 0; i < zipContents.size(); i++)

View file

@ -29,7 +29,7 @@
ZipUtil::ZipUtil(QObject* parent) : ArchiveUtil(parent)
{
m_zip = NULL;
m_zip = nullptr;
}
@ -65,7 +65,7 @@ bool ZipUtil::close(void)
error = m_zip->getZipError();
}
delete m_zip;
m_zip = NULL;
m_zip = nullptr;
return (error == UNZ_OK) ? true : false;
}

View file

@ -370,7 +370,7 @@ void Config::setDevices()
QStringList brands = manuf.uniqueKeys();
QTreeWidgetItem *w;
QTreeWidgetItem *w2;
QTreeWidgetItem *w3 = 0;
QTreeWidgetItem *w3 = nullptr;
QString selected = RbSettings::value(RbSettings::Platform).toString();
for(int c = 0; c < brands.size(); c++) {
@ -408,7 +408,7 @@ void Config::setDevices()
while(widgetitem);
// add new items
ui.treeDevices->insertTopLevelItems(0, items);
if(w3 != 0) {
if(w3 != nullptr) {
ui.treeDevices->setCurrentItem(w3); // hilight old selection
ui.treeDevices->scrollToItem(w3);
}

View file

@ -30,7 +30,7 @@ class Config : public QDialog
{
Q_OBJECT
public:
Config(QWidget *parent = 0,int index=0);
Config(QWidget *parent = nullptr,int index=0);
signals:
void settingsUpdated(void);

View file

@ -44,8 +44,8 @@ EncTtsCfgGui::EncTtsCfgGui(QDialog* parent, EncTtsSettingInterface* iface, QStri
m_busyDlg= new QProgressDialog("", "", 0, 0,this);
m_busyDlg->setWindowTitle(tr("Waiting for engine..."));
m_busyDlg->setModal(true);
m_busyDlg->setLabel(0);
m_busyDlg->setCancelButton(0);
m_busyDlg->setLabel(nullptr);
m_busyDlg->setCancelButton(nullptr);
m_busyDlg->hide();
connect(iface,SIGNAL(busy()),this,SLOT(showBusy()));
connect(iface,SIGNAL(busyEnd()),this,SLOT(hideBusy()));
@ -74,7 +74,7 @@ void EncTtsCfgGui::setUpWindow()
gridLayout->addWidget(widget, i, 1);
widget->setLayoutDirection(Qt::LeftToRight);
QWidget *btn = createButton(m_settingsList.at(i));
if(btn != NULL)
if(btn != nullptr)
{
gridLayout->addWidget(btn, i, 2);
}
@ -113,7 +113,7 @@ void EncTtsCfgGui::setUpWindow()
QWidget* EncTtsCfgGui::createWidgets(EncTtsSetting* setting)
{
// value display
QWidget* value = NULL;
QWidget* value = nullptr;
switch(setting->type())
{
case EncTtsSetting::eDOUBLE:
@ -181,7 +181,7 @@ QWidget* EncTtsCfgGui::createWidgets(EncTtsSetting* setting)
}
// remember widget
if(value != NULL)
if(value != nullptr)
{
m_settingsWidgetsMap.insert(setting,value);
connect(setting,SIGNAL(updateGui()),this,SLOT(updateWidget()));
@ -208,14 +208,14 @@ QWidget* EncTtsCfgGui::createButton(EncTtsSetting* setting)
return refreshbtn;
}
else
return NULL;
return nullptr;
}
void EncTtsCfgGui::updateSetting()
{
//cast and get the sender widget
QWidget* widget = qobject_cast<QWidget*>(QObject::sender());
if(widget == NULL) return;
if(widget == nullptr) return;
// get the corresponding setting
EncTtsSetting* setting = m_settingsWidgetsMap.key(widget);
@ -264,7 +264,7 @@ void EncTtsCfgGui::updateWidget()
{
// get sender setting
EncTtsSetting* setting = qobject_cast<EncTtsSetting*>(QObject::sender());
if(setting == NULL) return;
if(setting == nullptr) return;
// get corresponding widget
QWidget* widget = m_settingsWidgetsMap.value(setting);
@ -370,7 +370,7 @@ void EncTtsCfgGui::browse(QObject* settingObj)
{
// cast top setting
EncTtsSetting* setting= qobject_cast<EncTtsSetting*>(settingObj);
if(setting == NULL) return;
if(setting == nullptr) return;
//current path
QString curPath = setting->current().toString();

View file

@ -29,7 +29,7 @@ class BackupDialog : public QDialog
{
Q_OBJECT
public:
BackupDialog(QWidget* parent = 0);
BackupDialog(QWidget* parent = nullptr);
private slots:
void changeBackupPath(void);

View file

@ -26,7 +26,7 @@ class Changelog : public QDialog
{
Q_OBJECT
public:
Changelog(QWidget *parent = 0);
Changelog(QWidget *parent = nullptr);
public slots:
void accept(void);

View file

@ -22,7 +22,7 @@ class ComboBoxViewDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
ComboBoxViewDelegate(QObject* parent = 0) : QStyledItemDelegate(parent) { }
ComboBoxViewDelegate(QObject* parent = nullptr) : QStyledItemDelegate(parent) { }
void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const;

View file

@ -26,7 +26,7 @@ class InfoWidget : public QWidget
{
Q_OBJECT
public:
InfoWidget(QWidget *parent = 0);
InfoWidget(QWidget *parent = nullptr);
public slots:
void updateInfo(void);

View file

@ -26,7 +26,7 @@ class ManualWidget : public QWidget
{
Q_OBJECT
public:
ManualWidget(QWidget *parent = 0);
ManualWidget(QWidget *parent = nullptr);
public slots:
void downloadManual(void);

View file

@ -45,9 +45,9 @@ SelectiveInstallWidget::SelectiveInstallWidget(QWidget* parent) : QWidget(parent
RockboxInfo info(m_mountpoint);
ui.bootloaderCheckbox->setChecked(!info.success());
m_logger = NULL;
m_zipinstaller = NULL;
m_themesinstaller = NULL;
m_logger = nullptr;
m_zipinstaller = nullptr;
m_themesinstaller = nullptr;
connect(ui.installButton, SIGNAL(clicked()), this, SLOT(startInstall()));
connect(this, SIGNAL(installSkipped(bool)), this, SLOT(continueInstall(bool)));
@ -84,9 +84,9 @@ void SelectiveInstallWidget::updateVersion(void)
m_blmethod = SystemInfo::platformValue(
SystemInfo::BootloaderMethod, m_target).toString();
if(m_logger != NULL) {
if(m_logger != nullptr) {
delete m_logger;
m_logger = NULL;
m_logger = nullptr;
}
// re-populate all version items
@ -166,7 +166,7 @@ void SelectiveInstallWidget::startInstall(void)
saveSettings();
m_installStage = 0;
if(m_logger != NULL) delete m_logger;
if(m_logger != nullptr) delete m_logger;
m_logger = new ProgressLoggerGui(this);
QString warning = Utils::checkEnvironment(false);
if(!warning.isEmpty())
@ -238,7 +238,7 @@ void SelectiveInstallWidget::installBootloader(void)
BootloaderInstallBase *bl =
BootloaderInstallHelper::createBootloaderInstaller(this,
SystemInfo::platformValue(SystemInfo::BootloaderMethod).toString());
if(bl == NULL) {
if(bl == nullptr) {
m_logger->addItem(tr("No install method known."), LOGERROR);
m_logger->setFinished();
return;
@ -393,7 +393,7 @@ void SelectiveInstallWidget::installRockbox(void)
ServerInfo::RelCandidateUrl, m_target).toString();
//! install build
if(m_zipinstaller != NULL) m_zipinstaller->deleteLater();
if(m_zipinstaller != nullptr) m_zipinstaller->deleteLater();
m_zipinstaller = new ZipInstaller(this);
m_zipinstaller->setUrl(url);
m_zipinstaller->setLogSection("Rockbox (Base)");
@ -437,7 +437,7 @@ void SelectiveInstallWidget::installFonts(void)
fontsurl.replace("%RELEASEVER%", relversion);
// create new zip installer
if(m_zipinstaller != NULL) m_zipinstaller->deleteLater();
if(m_zipinstaller != nullptr) m_zipinstaller->deleteLater();
m_zipinstaller = new ZipInstaller(this);
m_zipinstaller->setUrl(fontsurl);
m_zipinstaller->setLogSection("Fonts");
@ -460,7 +460,7 @@ void SelectiveInstallWidget::installFonts(void)
void SelectiveInstallWidget::customizeThemes(void)
{
if(m_themesinstaller == NULL)
if(m_themesinstaller == nullptr)
m_themesinstaller = new ThemesInstallWindow(this);
m_themesinstaller->setSelectOnly(true);
@ -472,7 +472,7 @@ void SelectiveInstallWidget::installThemes(void)
{
if(ui.themesCheckbox->isChecked()) {
LOG_INFO() << "installing themes";
if(m_themesinstaller == NULL)
if(m_themesinstaller == nullptr)
m_themesinstaller = new ThemesInstallWindow(this);
connect(m_themesinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool)));
@ -526,7 +526,7 @@ void SelectiveInstallWidget::installGamefiles(void)
LOG_INFO() << "installing gamefiles";
// create new zip installer
if(m_zipinstaller != NULL) m_zipinstaller->deleteLater();
if(m_zipinstaller != nullptr) m_zipinstaller->deleteLater();
m_zipinstaller = new ZipInstaller(this);
m_zipinstaller->setUrl(gameUrls);

View file

@ -29,7 +29,7 @@ class SelectiveInstallWidget : public QWidget
{
Q_OBJECT
public:
SelectiveInstallWidget(QWidget* parent = 0);
SelectiveInstallWidget(QWidget* parent = nullptr);
public slots:
void updateVersion(void);

View file

@ -32,7 +32,7 @@ class InstallTalkWindow : public QDialog
{
Q_OBJECT
public:
InstallTalkWindow(QWidget *parent = 0);
InstallTalkWindow(QWidget *parent = nullptr);
public slots:
void accept(void);

View file

@ -65,7 +65,7 @@ int main( int argc, char ** argv ) {
// check for a configuration file in the program folder.
QSettings *user;
if(QFileInfo(absolutePath + "/RockboxUtility.ini").isFile())
user = new QSettings(absolutePath + "/RockboxUtility.ini", QSettings::IniFormat, 0);
user = new QSettings(absolutePath + "/RockboxUtility.ini", QSettings::IniFormat, nullptr);
else user = new QSettings(QSettings::IniFormat, QSettings::UserScope, "rockbox.org", "RockboxUtility");
QString applang = QLocale::system().name();
@ -98,7 +98,7 @@ int main( int argc, char ** argv ) {
QList<QTranslator*> translators;
translators.append(&translator);
translators.append(&qttrans);
RbUtilQt window(0);
RbUtilQt window(nullptr);
RbUtilQt::translators = translators;
window.show();

View file

@ -33,7 +33,7 @@ class PreviewDlg : public QDialog
Q_OBJECT
public:
PreviewDlg(QWidget *parent = 0);
PreviewDlg(QWidget *parent = nullptr);
void setPixmap(QPixmap p);
void setText(QString text);
@ -54,7 +54,7 @@ class PreviewLabel : public QLabel
Q_OBJECT
public:
PreviewLabel(QWidget * parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
PreviewLabel(QWidget * parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
void setPixmap(QPixmap p);
void setText(QString text);

View file

@ -161,7 +161,7 @@ void ProgressLoggerGui::saveErrorLog()
int i=0;
loggerTexts = "";
while(dp.listProgress->item(i) != NULL)
while(dp.listProgress->item(i) != nullptr)
{
loggerTexts.append(dp.listProgress->item(i)->text());
loggerTexts.append("\n");

View file

@ -371,7 +371,7 @@ void RbUtilQt::updateSettings()
" or review your settings."));
configDialog();
}
else if(chkConfig(0)) {
else if(chkConfig(nullptr)) {
QApplication::processEvents();
QMessageBox::critical(this, tr("Configuration error"),
tr("Your configuration is invalid. This is most likely due "
@ -400,7 +400,7 @@ void RbUtilQt::updateDevice()
ui.actionRemove_bootloader->setEnabled(bootloaderUninstallable);
/* Disable the whole tab widget if configuration is invalid */
bool configurationValid = !chkConfig(0);
bool configurationValid = !chkConfig(nullptr);
ui.tabWidget->setEnabled(configurationValid);
ui.menuA_ctions->setEnabled(configurationValid);
@ -562,7 +562,7 @@ void RbUtilQt::uninstallBootloader(void)
= BootloaderInstallHelper::createBootloaderInstaller(this,
SystemInfo::platformValue(SystemInfo::BootloaderMethod).toString());
if(bl == NULL) {
if(bl == nullptr) {
logger->addItem(tr("No uninstall method for this target known."), LOGERROR);
logger->setFinished();
return;

View file

@ -42,9 +42,9 @@ class RbUtilQt : public QMainWindow
Q_OBJECT
public:
RbUtilQt(QWidget *parent = 0);
RbUtilQt(QWidget *parent = nullptr);
static QList<QTranslator*> translators;
static bool chkConfig(QWidget *parent = 0);
static bool chkConfig(QWidget *parent = nullptr);
private:
ManualWidget *manual;

View file

@ -34,7 +34,7 @@ class Sysinfo : public QDialog
InfoHtml,
InfoText,
};
Sysinfo(QWidget *parent = 0);
Sysinfo(QWidget *parent = nullptr);
static QString getInfo(InfoType type = InfoHtml);
private:

View file

@ -63,7 +63,7 @@ ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent)
igetter.setCache(infocachedir);
}
logger = NULL;
logger = nullptr;
}
ThemesInstallWindow::~ThemesInstallWindow()
@ -347,7 +347,7 @@ void ThemesInstallWindow::install()
}
LOG_INFO() << "installing:" << themes;
if(logger == NULL)
if(logger == nullptr)
logger = new ProgressLoggerGui(this);
logger->show();
QString mountPoint = RbSettings::value(RbSettings::Mountpoint).toString();

View file

@ -31,7 +31,7 @@ class UninstallWindow : public QDialog
{
Q_OBJECT
public:
UninstallWindow(QWidget *parent = 0);
UninstallWindow(QWidget *parent = nullptr);
public slots:
void accept(void);