diff options
| author | Tannin <devnull@localhost> | 2014-11-28 11:19:20 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2014-11-28 11:19:20 +0100 |
| commit | 99de80e7224f2491fb7518e32f195ad6a912b624 (patch) | |
| tree | ef8f1d3ba16b7681beaae5cf67d0f5671e486061 /src/mainwindow.cpp | |
| parent | 78f628e0af2f2df562c40ac1424b432b6a969055 (diff) | |
replaced all uses of NULL with nullptr
fixed a few placed where NULL was used as a number or boolean
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 160 |
1 files changed, 80 insertions, 80 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d4a7f4fc..0fdbdfad 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -336,7 +336,7 @@ MainWindow::~MainWindow() void MainWindow::disconnectPlugins()
{
- if (ui->actionTool->menu() != NULL) {
+ if (ui->actionTool->menu() != nullptr) {
ui->actionTool->menu()->clear();
}
}
@@ -432,11 +432,11 @@ static QModelIndex mapToModel(const QAbstractItemModel *targetModel, QModelIndex QModelIndex result = idx;
const QAbstractItemModel *model = idx.model();
while (model != targetModel) {
- if (model == NULL) {
+ if (model == nullptr) {
return QModelIndex();
}
const QAbstractProxyModel *proxyModel = qobject_cast<const QAbstractProxyModel*>(model);
- if (proxyModel == NULL) {
+ if (proxyModel == nullptr) {
return QModelIndex();
}
result = proxyModel->mapToSource(result);
@@ -484,7 +484,7 @@ void MainWindow::updateToolBar() QWidget *widget = ui->toolBar->widgetForAction(ui->actionTool);
QToolButton *toolBtn = qobject_cast<QToolButton*>(widget);
- if (toolBtn->menu() == NULL) {
+ if (toolBtn->menu() == nullptr) {
actionToToolButton(ui->actionTool);
}
@@ -600,7 +600,7 @@ void MainWindow::createHelpWidget() {
QToolButton *toolBtn = qobject_cast<QToolButton*>(ui->toolBar->widgetForAction(ui->actionHelp));
QMenu *buttonMenu = toolBtn->menu();
- if (buttonMenu == NULL) {
+ if (buttonMenu == nullptr) {
return;
}
buttonMenu->clear();
@@ -838,14 +838,14 @@ SaveGameGamebryo *MainWindow::getSaveGame(QListWidgetItem *item) return saveGame;
} catch (const std::exception &e) {
reportError(tr("failed to read savegame: %1").arg(e.what()));
- return NULL;
+ return nullptr;
}
}
void MainWindow::displaySaveGameInfo(const SaveGameGamebryo *save, QPoint pos)
{
- if (m_CurrentSaveView == NULL) {
+ if (m_CurrentSaveView == nullptr) {
m_CurrentSaveView = new SaveGameInfoWidgetGamebryo(save, m_OrganizerCore.pluginList(), this);
} else {
m_CurrentSaveView->setSave(save);
@@ -874,11 +874,11 @@ void MainWindow::displaySaveGameInfo(const SaveGameGamebryo *save, QPoint pos) void MainWindow::saveSelectionChanged(QListWidgetItem *newItem)
{
- if (newItem == NULL) {
+ if (newItem == nullptr) {
hideSaveGameInfo();
- } else if ((m_CurrentSaveView == NULL) || (newItem != m_CurrentSaveView->property("displayItem").value<void*>())) {
+ } else if ((m_CurrentSaveView == nullptr) || (newItem != m_CurrentSaveView->property("displayItem").value<void*>())) {
const SaveGameGamebryo *save = getSaveGame(newItem);
- if (save != NULL) {
+ if (save != nullptr) {
displaySaveGameInfo(save, QCursor::pos());
m_CurrentSaveView->setProperty("displayItem", qVariantFromValue((void*)newItem));
}
@@ -889,10 +889,10 @@ void MainWindow::saveSelectionChanged(QListWidgetItem *newItem) void MainWindow::hideSaveGameInfo()
{
- if (m_CurrentSaveView != NULL) {
+ if (m_CurrentSaveView != nullptr) {
disconnect(m_CurrentSaveView, SIGNAL(closeSaveInfo()), this, SLOT(hideSaveGameInfo()));
m_CurrentSaveView->deleteLater();
- m_CurrentSaveView = NULL;
+ m_CurrentSaveView = nullptr;
}
}
@@ -928,7 +928,7 @@ void MainWindow::modPagePluginInvoke() m_IntegratedBrowser.setWindowTitle(plugin->displayName());
m_IntegratedBrowser.openUrl(plugin->pageURL());
} else {
- ::ShellExecuteW(NULL, L"open", ToWString(plugin->pageURL().toString()).c_str(), NULL, NULL, SW_SHOWNORMAL);
+ ::ShellExecuteW(nullptr, L"open", ToWString(plugin->pageURL().toString()).c_str(), nullptr, nullptr, SW_SHOWNORMAL);
}
}
@@ -948,7 +948,7 @@ void MainWindow::registerPluginTool(IPluginTool *tool) void MainWindow::registerModPage(IPluginModPage *modPage)
{
// turn the browser action into a drop-down menu if necessary
- if (ui->actionNexus->menu() == NULL) {
+ if (ui->actionNexus->menu() == nullptr) {
QAction *nexusAction = ui->actionNexus;
// TODO: use a different icon for nexus!
ui->actionNexus = new QAction(nexusAction->icon(), tr("Browse Mod Page"), ui->toolBar);
@@ -973,7 +973,7 @@ void MainWindow::registerModPage(IPluginModPage *modPage) void MainWindow::startExeAction()
{
QAction *action = qobject_cast<QAction*>(sender());
- if (action != NULL) {
+ if (action != nullptr) {
Executable selectedExecutable = action->data().value<Executable>();
m_OrganizerCore.spawnBinary(
selectedExecutable.m_BinaryInfo,
@@ -1016,7 +1016,7 @@ void MainWindow::on_profileBox_currentIndexChanged(int index) m_OldProfileIndex = index;
if ((previousIndex != -1) &&
- (m_OrganizerCore.currentProfile() != NULL) &&
+ (m_OrganizerCore.currentProfile() != nullptr) &&
m_OrganizerCore.currentProfile()->exists()) {
m_OrganizerCore.saveCurrentLists();
}
@@ -1155,7 +1155,7 @@ void MainWindow::expandDataTreeItem(QTreeWidgetItem *item) std::wstring virtualPath = (path + L"\\").substr(6) + ToWString(item->text(0));
DirectoryEntry *dir = m_OrganizerCore.directoryStructure()->findSubDirectoryRecursive(virtualPath);
- if (dir != NULL) {
+ if (dir != nullptr) {
updateTo(item, path, *dir, conflictsOnly);
} else {
qWarning("failed to update view of %ls", path.c_str());
@@ -1227,7 +1227,7 @@ extern QPixmap qt_pixmapFromWinHICON(HICON icon); QIcon MainWindow::iconForExecutable(const QString &filePath)
{
HICON winIcon;
- UINT res = ::ExtractIconExW(ToWString(filePath).c_str(), 0, &winIcon, NULL, 1);
+ UINT res = ::ExtractIconExW(ToWString(filePath).c_str(), 0, &winIcon, nullptr, 1);
if (res == 1) {
QIcon result = QIcon(qt_pixmapFromWinHICON(winIcon));
::DestroyIcon(winIcon);
@@ -1397,7 +1397,7 @@ void MainWindow::updateBSAList(const QStringList &defaultArchives, const QString modName = modInfo->name();
}
QList<QTreeWidgetItem*> items = ui->bsaList->findItems(modName, Qt::MatchFixedString);
- QTreeWidgetItem *subItem = NULL;
+ QTreeWidgetItem *subItem = nullptr;
if (items.length() > 0) {
subItem = items.at(0);
} else {
@@ -1648,14 +1648,14 @@ static HRESULT CreateShortcut(LPCWSTR targetFileName, LPCWSTR arguments, LPCWSTR currentDirectory)
{
HRESULT result = E_INVALIDARG;
- if ((targetFileName != NULL) && (wcslen(targetFileName) > 0) &&
- (arguments != NULL) &&
- (linkFileName != NULL) && (strlen(linkFileName) > 0) &&
- (description != NULL) &&
- (currentDirectory != NULL)) {
+ if ((targetFileName != nullptr) && (wcslen(targetFileName) > 0) &&
+ (arguments != nullptr) &&
+ (linkFileName != nullptr) && (strlen(linkFileName) > 0) &&
+ (description != nullptr) &&
+ (currentDirectory != nullptr)) {
IShellLink* shellLink;
- result = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
+ result = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
IID_IShellLink, (LPVOID*)&shellLink);
if (!SUCCEEDED(result)) {
@@ -1755,19 +1755,19 @@ void MainWindow::helpTriggered() void MainWindow::wikiTriggered()
{
-// ::ShellExecuteW(NULL, L"open", L"http://issue.tannin.eu/tbg/wiki/Modorganizer%3AMainPage", NULL, NULL, SW_SHOWNORMAL);
- ::ShellExecuteW(NULL, L"open", L"http://wiki.step-project.com/Guide:Mod_Organizer", NULL, NULL, SW_SHOWNORMAL);
+// ::ShellExecuteW(nullptr, L"open", L"http://issue.tannin.eu/tbg/wiki/Modorganizer%3AMainPage", nullptr, nullptr, SW_SHOWNORMAL);
+ ::ShellExecuteW(nullptr, L"open", L"http://wiki.step-project.com/Guide:Mod_Organizer", nullptr, nullptr, SW_SHOWNORMAL);
}
void MainWindow::issueTriggered()
{
- ::ShellExecuteW(NULL, L"open", L"http://issue.tannin.eu/tbg", NULL, NULL, SW_SHOWNORMAL);
+ ::ShellExecuteW(nullptr, L"open", L"http://issue.tannin.eu/tbg", nullptr, nullptr, SW_SHOWNORMAL);
}
void MainWindow::tutorialTriggered()
{
QAction *tutorialAction = qobject_cast<QAction*>(sender());
- if (tutorialAction != NULL) {
+ if (tutorialAction != nullptr) {
if (QMessageBox::question(this, tr("Start Tutorial?"),
tr("You're about to start a tutorial. For technical reasons it's not possible to end "
"the tutorial early. Continue?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
@@ -1870,7 +1870,7 @@ void MainWindow::modorder_changed() ModInfo::Ptr modInfo = ModInfo::getByIndex(current.data(Qt::UserRole + 1).toInt());
modInfo->doConflictCheck();
m_OrganizerCore.modList()->setOverwriteMarkers(modInfo->getModOverwrite(), modInfo->getModOverwritten());
- if (m_ModListSortProxy != NULL) {
+ if (m_ModListSortProxy != nullptr) {
m_ModListSortProxy->invalidate();
}
ui->modList->verticalScrollBar()->repaint();
@@ -2007,7 +2007,7 @@ void MainWindow::modlistChanged(int) void MainWindow::fileMoved(const QString &filePath, const QString &oldOriginName, const QString &newOriginName)
{
const FileEntry::Ptr filePtr = m_OrganizerCore.directoryStructure()->findFile(ToWString(filePath));
- if (filePtr.get() != NULL) {
+ if (filePtr.get() != nullptr) {
try {
if (m_OrganizerCore.directoryStructure()->originExists(ToWString(newOriginName))) {
FilesOrigin &newOrigin = m_OrganizerCore.directoryStructure()->getOriginByName(ToWString(newOriginName));
@@ -2035,7 +2035,7 @@ QTreeWidgetItem *MainWindow::addFilterItem(QTreeWidgetItem *root, const QString QTreeWidgetItem *item = new QTreeWidgetItem(QStringList(name));
item->setData(0, Qt::UserRole, categoryID);
item->setData(0, Qt::UserRole + 1, type);
- if (root != NULL) {
+ if (root != nullptr) {
root->addChild(item);
} else {
ui->categoriesList->addTopLevelItem(item);
@@ -2046,7 +2046,7 @@ QTreeWidgetItem *MainWindow::addFilterItem(QTreeWidgetItem *root, const QString void MainWindow::addContentFilters()
{
for (unsigned i = 0; i < ModInfo::NUM_CONTENT_TYPES; ++i) {
- addFilterItem(NULL, tr("<Contains %1>").arg(ModInfo::getContentTypeName(i)), i, ModListSortProxy::TYPE_CONTENT);
+ addFilterItem(nullptr, tr("<Contains %1>").arg(ModInfo::getContentTypeName(i)), i, ModListSortProxy::TYPE_CONTENT);
}
}
@@ -2079,14 +2079,14 @@ void MainWindow::refreshFilters() }
ui->categoriesList->clear();
- addFilterItem(NULL, tr("<Checked>"), CategoryFactory::CATEGORY_SPECIAL_CHECKED, ModListSortProxy::TYPE_SPECIAL);
- addFilterItem(NULL, tr("<Unchecked>"), CategoryFactory::CATEGORY_SPECIAL_UNCHECKED, ModListSortProxy::TYPE_SPECIAL);
- addFilterItem(NULL, tr("<Update>"), CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE, ModListSortProxy::TYPE_SPECIAL);
- addFilterItem(NULL, tr("<Managed by MO>"), CategoryFactory::CATEGORY_SPECIAL_MANAGED, ModListSortProxy::TYPE_SPECIAL);
- addFilterItem(NULL, tr("<Managed outside MO>"), CategoryFactory::CATEGORY_SPECIAL_UNMANAGED, ModListSortProxy::TYPE_SPECIAL);
- addFilterItem(NULL, tr("<No category>"), CategoryFactory::CATEGORY_SPECIAL_NOCATEGORY, ModListSortProxy::TYPE_SPECIAL);
- addFilterItem(NULL, tr("<Conflicted>"), CategoryFactory::CATEGORY_SPECIAL_CONFLICT, ModListSortProxy::TYPE_SPECIAL);
- addFilterItem(NULL, tr("<Not Endorsed>"), CategoryFactory::CATEGORY_SPECIAL_NOTENDORSED, ModListSortProxy::TYPE_SPECIAL);
+ addFilterItem(nullptr, tr("<Checked>"), CategoryFactory::CATEGORY_SPECIAL_CHECKED, ModListSortProxy::TYPE_SPECIAL);
+ addFilterItem(nullptr, tr("<Unchecked>"), CategoryFactory::CATEGORY_SPECIAL_UNCHECKED, ModListSortProxy::TYPE_SPECIAL);
+ addFilterItem(nullptr, tr("<Update>"), CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE, ModListSortProxy::TYPE_SPECIAL);
+ addFilterItem(nullptr, tr("<Managed by MO>"), CategoryFactory::CATEGORY_SPECIAL_MANAGED, ModListSortProxy::TYPE_SPECIAL);
+ addFilterItem(nullptr, tr("<Managed outside MO>"), CategoryFactory::CATEGORY_SPECIAL_UNMANAGED, ModListSortProxy::TYPE_SPECIAL);
+ addFilterItem(nullptr, tr("<No category>"), CategoryFactory::CATEGORY_SPECIAL_NOCATEGORY, ModListSortProxy::TYPE_SPECIAL);
+ addFilterItem(nullptr, tr("<Conflicted>"), CategoryFactory::CATEGORY_SPECIAL_CONFLICT, ModListSortProxy::TYPE_SPECIAL);
+ addFilterItem(nullptr, tr("<Not Endorsed>"), CategoryFactory::CATEGORY_SPECIAL_NOTENDORSED, ModListSortProxy::TYPE_SPECIAL);
addContentFilters();
@@ -2103,7 +2103,7 @@ void MainWindow::refreshFilters() }
}
- addCategoryFilters(NULL, categoriesUsed, 0);
+ addCategoryFilters(nullptr, categoriesUsed, 0);
foreach (const QString &item, selectedItems) {
QList<QTreeWidgetItem*> matches = ui->categoriesList->findItems(item, Qt::MatchFixedString | Qt::MatchRecursive);
@@ -2166,7 +2166,7 @@ void MainWindow::modlistSelectionChanged(const QModelIndex ¤t, const QMode } else {
m_OrganizerCore.modList()->setOverwriteMarkers(std::set<unsigned int>(), std::set<unsigned int>());
}
- if ((m_ModListSortProxy != NULL)
+ if ((m_ModListSortProxy != nullptr)
&& !m_ModListSortProxy->beingInvalidated()) {
m_ModListSortProxy->invalidate();
}
@@ -2322,7 +2322,7 @@ void MainWindow::windowTutorialFinished(const QString &windowName) void MainWindow::overwriteClosed(int)
{
OverwriteInfoDialog *dialog = this->findChild<OverwriteInfoDialog*>("__overwriteDialog");
- if (dialog != NULL) {
+ if (dialog != nullptr) {
m_OrganizerCore.modList()->modInfoChanged(dialog->modInfo());
dialog->deleteLater();
}
@@ -2336,7 +2336,7 @@ void MainWindow::displayModInformation(ModInfo::Ptr modInfo, unsigned int index, if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_OVERWRITE) != flags.end()) {
QDialog *dialog = this->findChild<QDialog*>("__overwriteDialog");
try {
- if (dialog == NULL) {
+ if (dialog == nullptr) {
dialog = new OverwriteInfoDialog(modInfo, this);
dialog->setObjectName("__overwriteDialog");
} else {
@@ -2483,7 +2483,7 @@ void MainWindow::openExplorer_clicked() {
ModInfo::Ptr modInfo = ModInfo::getByIndex(m_ContextRow);
- ::ShellExecuteW(NULL, L"explore", ToWString(modInfo->absolutePath()).c_str(), NULL, NULL, SW_SHOWNORMAL);
+ ::ShellExecuteW(nullptr, L"explore", ToWString(modInfo->absolutePath()).c_str(), nullptr, nullptr, SW_SHOWNORMAL);
}
void MainWindow::information_clicked()
@@ -2523,13 +2523,13 @@ void MainWindow::createModFromOverwrite() }
}
- if (m_OrganizerCore.getMod(name) != NULL) {
+ if (m_OrganizerCore.getMod(name) != nullptr) {
reportError(tr("A mod with this name already exists"));
return;
}
IModInterface *newMod = m_OrganizerCore.createMod(name);
- if (newMod == NULL) {
+ if (newMod == nullptr) {
return;
}
@@ -2610,11 +2610,11 @@ void MainWindow::replaceCategoriesFromMenu(QMenu *menu, int modRow) {
ModInfo::Ptr modInfo = ModInfo::getByIndex(modRow);
foreach (QAction* action, menu->actions()) {
- if (action->menu() != NULL) {
+ if (action->menu() != nullptr) {
replaceCategoriesFromMenu(action->menu(), modRow);
} else {
QWidgetAction *widgetAction = qobject_cast<QWidgetAction*>(action);
- if (widgetAction != NULL) {
+ if (widgetAction != nullptr) {
QCheckBox *checkbox = qobject_cast<QCheckBox*>(widgetAction->defaultWidget());
modInfo->setCategory(widgetAction->data().toInt(), checkbox->isChecked());
}
@@ -2627,11 +2627,11 @@ void MainWindow::addRemoveCategoriesFromMenu(QMenu *menu, int modRow, int refere if (referenceRow != -1 && referenceRow != modRow) {
ModInfo::Ptr editedModInfo = ModInfo::getByIndex(referenceRow);
foreach (QAction* action, menu->actions()) {
- if (action->menu() != NULL) {
+ if (action->menu() != nullptr) {
addRemoveCategoriesFromMenu(action->menu(), modRow, referenceRow);
} else {
QWidgetAction *widgetAction = qobject_cast<QWidgetAction*>(action);
- if (widgetAction != NULL) {
+ if (widgetAction != nullptr) {
QCheckBox *checkbox = qobject_cast<QCheckBox*>(widgetAction->defaultWidget());
int categoryId = widgetAction->data().toInt();
bool checkedBefore = editedModInfo->categorySet(categoryId);
@@ -2651,7 +2651,7 @@ void MainWindow::addRemoveCategoriesFromMenu(QMenu *menu, int modRow, int refere void MainWindow::addRemoveCategories_MenuHandler() {
QMenu *menu = qobject_cast<QMenu*>(sender());
- if (menu == NULL) {
+ if (menu == nullptr) {
qCritical("not a menu?");
return;
}
@@ -2688,7 +2688,7 @@ void MainWindow::addRemoveCategories_MenuHandler() { void MainWindow::replaceCategories_MenuHandler() {
QMenu *menu = qobject_cast<QMenu*>(sender());
- if (menu == NULL) {
+ if (menu == nullptr) {
qCritical("not a menu?");
return;
}
@@ -2726,14 +2726,14 @@ void MainWindow::replaceCategories_MenuHandler() { void MainWindow::savePrimaryCategory()
{
QMenu *menu = qobject_cast<QMenu*>(sender());
- if (menu == NULL) {
+ if (menu == nullptr) {
qCritical("not a menu?");
return;
}
foreach (QAction* action, menu->actions()) {
QWidgetAction *widgetAction = qobject_cast<QWidgetAction*>(action);
- if (widgetAction != NULL) {
+ if (widgetAction != nullptr) {
QRadioButton *btn = qobject_cast<QRadioButton*>(widgetAction->defaultWidget());
if (btn->isChecked()) {
QModelIndexList selected = ui->modList->selectionModel()->selectedRows();
@@ -2854,7 +2854,7 @@ void MainWindow::addPrimaryCategoryCandidates(QMenu *primaryCategoryMenu, ModInf void MainWindow::addPrimaryCategoryCandidates()
{
QMenu *menu = qobject_cast<QMenu*>(sender());
- if (menu == NULL) {
+ if (menu == nullptr) {
qCritical("not a menu?");
return;
}
@@ -2866,7 +2866,7 @@ void MainWindow::addPrimaryCategoryCandidates() void MainWindow::enableVisibleMods()
{
- if (QMessageBox::question(NULL, tr("Confirm"), tr("Really enable all visible mods?"),
+ if (QMessageBox::question(nullptr, tr("Confirm"), tr("Really enable all visible mods?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
m_ModListSortProxy->enableAllVisible();
}
@@ -2874,7 +2874,7 @@ void MainWindow::enableVisibleMods() void MainWindow::disableVisibleMods()
{
- if (QMessageBox::question(NULL, tr("Confirm"), tr("Really disable all visible mods?"),
+ if (QMessageBox::question(nullptr, tr("Confirm"), tr("Really disable all visible mods?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
m_ModListSortProxy->disableAllVisible();
}
@@ -2967,7 +2967,7 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos) m_ContextIdx = mapToModel(m_OrganizerCore.modList(), modList->indexAt(pos));
m_ContextRow = m_ContextIdx.row();
- QMenu *menu = NULL;
+ QMenu *menu = nullptr;
QMenu *allMods = modListContextMenu();
if (m_ContextRow == -1) {
// no selection
@@ -3121,7 +3121,7 @@ void MainWindow::fixMods_clicked() {
QListWidgetItem *selectedItem = ui->savegameList->currentItem();
- if (selectedItem == NULL)
+ if (selectedItem == nullptr)
return;
// if required, parse the save game
@@ -3345,20 +3345,20 @@ void MainWindow::on_actionSettings_triggered() void MainWindow::on_actionNexus_triggered()
{
- ::ShellExecuteW(NULL, L"open", GameInfo::instance().getNexusPage(false).c_str(), NULL, NULL, SW_SHOWNORMAL);
+ ::ShellExecuteW(nullptr, L"open", GameInfo::instance().getNexusPage(false).c_str(), nullptr, nullptr, SW_SHOWNORMAL);
}
void MainWindow::nexusLinkActivated(const QString &link)
{
- ::ShellExecuteW(NULL, L"open", ToWString(link).c_str(), NULL, NULL, SW_SHOWNORMAL);
+ ::ShellExecuteW(nullptr, L"open", ToWString(link).c_str(), nullptr, nullptr, SW_SHOWNORMAL);
ui->tabWidget->setCurrentIndex(4);
}
void MainWindow::linkClicked(const QString &url)
{
- ::ShellExecuteW(NULL, L"open", ToWString(url).c_str(), NULL, NULL, SW_SHOWNORMAL);
+ ::ShellExecuteW(nullptr, L"open", ToWString(url).c_str(), nullptr, nullptr, SW_SHOWNORMAL);
}
@@ -3470,7 +3470,7 @@ int MainWindow::getBinaryExecuteInfo(const QFileInfo &targetInfo, { // try to find java automatically
WCHAR buffer[MAX_PATH];
- if (::FindExecutableW(targetPathW.c_str(), NULL, buffer) > (HINSTANCE)32) {
+ if (::FindExecutableW(targetPathW.c_str(), nullptr, buffer) > (HINSTANCE)32) {
DWORD binaryType = 0UL;
if (!::GetBinaryTypeW(targetPathW.c_str(), &binaryType)) {
qDebug("failed to determine binary type of \"%ls\": %lu", targetPathW.c_str(), ::GetLastError());
@@ -3507,7 +3507,7 @@ int MainWindow::getBinaryExecuteInfo(const QFileInfo &targetInfo, void MainWindow::addAsExecutable()
{
- if (m_ContextItem != NULL) {
+ if (m_ContextItem != nullptr) {
QFileInfo targetInfo(m_ContextItem->data(0, Qt::UserRole).toString());
QFileInfo binaryInfo;
QString arguments;
@@ -3605,9 +3605,9 @@ void MainWindow::previewDataFile() offset = fileName.indexOf("/", offset);
fileName = fileName.mid(offset + 1);
- const FileEntry::Ptr file = m_OrganizerCore.directoryStructure()->searchFile(ToWString(fileName), NULL);
+ const FileEntry::Ptr file = m_OrganizerCore.directoryStructure()->searchFile(ToWString(fileName), nullptr);
- if (file.get() == NULL) {
+ if (file.get() == nullptr) {
reportError(tr("file not found: %1").arg(fileName));
return;
}
@@ -3641,7 +3641,7 @@ void MainWindow::previewDataFile() void MainWindow::openDataFile()
{
- if (m_ContextItem != NULL) {
+ if (m_ContextItem != nullptr) {
QFileInfo targetInfo(m_ContextItem->data(0, Qt::UserRole).toString());
QFileInfo binaryInfo;
QString arguments;
@@ -3650,7 +3650,7 @@ void MainWindow::openDataFile() m_OrganizerCore.spawnBinaryDirect(binaryInfo, arguments, m_OrganizerCore.currentProfile()->getName(), targetInfo.absolutePath(), "");
} break;
case 2: {
- ::ShellExecuteW(NULL, L"open", ToWString(targetInfo.absoluteFilePath()).c_str(), NULL, NULL, SW_SHOWNORMAL);
+ ::ShellExecuteW(nullptr, L"open", ToWString(targetInfo.absoluteFilePath()).c_str(), nullptr, nullptr, SW_SHOWNORMAL);
} break;
default: {
// nop
@@ -3702,7 +3702,7 @@ void MainWindow::on_dataTree_customContextMenuRequested(const QPoint &pos) m_ContextItem = dataTree->itemAt(pos.x(), pos.y());
QMenu menu;
- if ((m_ContextItem != NULL) && (m_ContextItem->childCount() == 0)) {
+ if ((m_ContextItem != nullptr) && (m_ContextItem->childCount() == 0)) {
menu.addAction(tr("Open/Execute"), this, SLOT(openDataFile()));
menu.addAction(tr("Add as Executable"), this, SLOT(addAsExecutable()));
@@ -3984,9 +3984,9 @@ void MainWindow::displayColumnSelection(const QPoint &pos) int i = 1;
foreach (const QAction *action, menu.actions()) {
const QWidgetAction *widgetAction = qobject_cast<const QWidgetAction*>(action);
- if (widgetAction != NULL) {
+ if (widgetAction != nullptr) {
const QCheckBox *checkBox = qobject_cast<const QCheckBox*>(widgetAction->defaultWidget());
- if (checkBox != NULL) {
+ if (checkBox != nullptr) {
ui->modList->header()->setSectionHidden(i, !checkBox->isChecked());
}
}
@@ -4109,7 +4109,7 @@ void MainWindow::removeFromToolbar() void MainWindow::toolBar_customContextMenuRequested(const QPoint &point)
{
QAction *action = ui->toolBar->actionAt(point);
- if (action != NULL) {
+ if (action != nullptr) {
if (action->objectName().startsWith("custom_")) {
m_ContextAction = action;
QMenu menu;
@@ -4161,10 +4161,10 @@ void MainWindow::on_espList_customContextMenuRequested(const QPoint &pos) void MainWindow::on_groupCombo_currentIndexChanged(int index)
{
- if (m_ModListSortProxy == NULL) {
+ if (m_ModListSortProxy == nullptr) {
return;
}
- QAbstractProxyModel *newModel = NULL;
+ QAbstractProxyModel *newModel = nullptr;
switch (index) {
case 1: {
newModel = new QtGroupingProxy(m_OrganizerCore.modList(), QModelIndex(), ModList::COL_CATEGORY, Qt::UserRole,
@@ -4176,11 +4176,11 @@ void MainWindow::on_groupCombo_currentIndexChanged(int index) Qt::UserRole + 2);
} break;
default: {
- newModel = NULL;
+ newModel = nullptr;
} break;
}
- if (newModel != NULL) {
+ if (newModel != nullptr) {
#ifdef TEST_MODELS
new ModelTest(newModel, this);
#endif // TEST_MODELS
@@ -4220,7 +4220,7 @@ void MainWindow::createStdoutPipe(HANDLE *stdOutRead, HANDLE *stdOutWrite) SECURITY_ATTRIBUTES secAttributes;
secAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
secAttributes.bInheritHandle = TRUE;
- secAttributes.lpSecurityDescriptor = NULL;
+ secAttributes.lpSecurityDescriptor = nullptr;
if (!::CreatePipe(stdOutRead, stdOutWrite, &secAttributes, 0)) {
qCritical("failed to create stdout reroute");
@@ -4242,7 +4242,7 @@ std::string MainWindow::readFromPipe(HANDLE stdOutRead) DWORD read = 1;
while (read > 0) {
- if (!::ReadFile(stdOutRead, buffer, chunkSize, &read, NULL)) {
+ if (!::ReadFile(stdOutRead, buffer, chunkSize, &read, nullptr)) {
break;
}
if (read > 0) {
|
