diff options
| author | Peter Penz <[email protected]> | 2011-02-09 19:21:58 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-02-09 19:24:27 +0100 |
| commit | d3496b12310d9fec0e52e537c341e87fcaa2f8b5 (patch) | |
| tree | 590f58beeca31163e5b17950540601d8a5dec20e /src/panels | |
| parent | ceba0f6f6a07babac230d1f136d16d34629b4cf3 (diff) | |
Coding style update for pointer comparison
Most developers seem to prefer
if (ptr) ...
if (!ptr) ...
in comparison to
if (ptr != 0) ...
if (ptr == 0) ...
Adjusted the Dolphin-code to use the "most-prefered style" to make contributors happy.
Diffstat (limited to 'src/panels')
| -rw-r--r-- | src/panels/filter/filterpanel.cpp | 4 | ||||
| -rw-r--r-- | src/panels/folders/folderspanel.cpp | 14 | ||||
| -rw-r--r-- | src/panels/information/informationpanel.cpp | 2 | ||||
| -rw-r--r-- | src/panels/information/informationpanelcontent.cpp | 8 | ||||
| -rw-r--r-- | src/panels/information/phononwidget.cpp | 14 | ||||
| -rw-r--r-- | src/panels/terminal/terminalpanel.cpp | 10 |
6 files changed, 25 insertions, 27 deletions
diff --git a/src/panels/filter/filterpanel.cpp b/src/panels/filter/filterpanel.cpp index 12cf642db..e4d352ba6 100644 --- a/src/panels/filter/filterpanel.cpp +++ b/src/panels/filter/filterpanel.cpp @@ -95,7 +95,7 @@ void FilterPanel::showEvent(QShowEvent* event) QVBoxLayout* layout = new QVBoxLayout(this); layout->setMargin(0); - Q_ASSERT(m_facetWidget == 0); + Q_ASSERT(!m_facetWidget); m_facetWidget = new Nepomuk::Utils::FacetWidget(this); layout->addWidget(m_facetWidget, 1); @@ -133,7 +133,7 @@ void FilterPanel::showEvent(QShowEvent* event) m_facetWidget->addFacet(Nepomuk::Utils::Facet::createRatingFacet()); m_facetWidget->addFacet(Nepomuk::Utils::Facet::createTagFacet()); - Q_ASSERT(m_lastSetUrlStatJob == 0); + Q_ASSERT(!m_lastSetUrlStatJob); m_lastSetUrlStatJob = KIO::stat(url(), KIO::HideProgressInfo); connect(m_lastSetUrlStatJob, SIGNAL(result(KJob*)), this, SLOT(slotSetUrlStatFinished(KJob*))); diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index 4e4efed44..ccdf13dec 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -73,7 +73,7 @@ FoldersPanel::~FoldersPanel() void FoldersPanel::setShowHiddenFiles(bool show) { FoldersPanelSettings::setShowHiddenFiles(show); - if (m_dirLister != 0) { + if (m_dirLister) { m_dirLister->setShowingDotFiles(show); m_dirLister->openUrl(m_dirLister->url(), KDirLister::Reload); } @@ -118,7 +118,7 @@ bool FoldersPanel::urlChanged() return false; } - if (m_dirLister != 0) { + if (m_dirLister) { m_setLeafVisible = true; loadTree(url()); } @@ -133,7 +133,7 @@ void FoldersPanel::showEvent(QShowEvent* event) return; } - if (m_dirLister == 0) { + if (!m_dirLister) { // Postpone the creating of the dir lister to the first show event. // This assures that no performance and memory overhead is given when the TreeView is not // used at all (see FoldersPanel::setUrl()). @@ -146,18 +146,18 @@ void FoldersPanel::showEvent(QShowEvent* event) m_dirLister->setShowingDotFiles(FoldersPanelSettings::showHiddenFiles()); connect(m_dirLister, SIGNAL(completed()), this, SLOT(slotDirListerCompleted())); - Q_ASSERT(m_dolphinModel == 0); + Q_ASSERT(!m_dolphinModel); m_dolphinModel = new DolphinModel(this); m_dolphinModel->setDirLister(m_dirLister); m_dolphinModel->setDropsAllowed(DolphinModel::DropOnDirectory); connect(m_dolphinModel, SIGNAL(expand(const QModelIndex&)), this, SLOT(expandToDir(const QModelIndex&))); - Q_ASSERT(m_proxyModel == 0); + Q_ASSERT(!m_proxyModel); m_proxyModel = new DolphinSortFilterProxyModel(this); m_proxyModel->setSourceModel(m_dolphinModel); - Q_ASSERT(m_treeView == 0); + Q_ASSERT(!m_treeView); m_treeView = new PanelTreeView(this); m_treeView->setModel(m_proxyModel); m_proxyModel->setSorting(DolphinView::SortByName); @@ -278,7 +278,7 @@ void FoldersPanel::slotVerticalScrollBarMoved(int value) void FoldersPanel::loadTree(const KUrl& url) { - Q_ASSERT(m_dirLister != 0); + Q_ASSERT(m_dirLister); m_leafDir = url; KUrl baseUrl; diff --git a/src/panels/information/informationpanel.cpp b/src/panels/information/informationpanel.cpp index f1530c72c..9bfb711c6 100644 --- a/src/panels/information/informationpanel.cpp +++ b/src/panels/information/informationpanel.cpp @@ -52,7 +52,7 @@ void InformationPanel::setSelection(const KFileItemList& selection) return; } - if ((selection.count() == 0) && (m_selection.count() == 0)) { + if (selection.isEmpty() && m_selection.isEmpty()) { // The selection has not really changed, only the current index. // QItemSelectionModel emits a signal in this case and it is less // expensive doing the check this way instead of patching diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp index b820be0a0..08121e78a 100644 --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -192,7 +192,7 @@ void InformationPanelContent::showItem(const KFileItem& item) } } - if (m_metaDataWidget != 0) { + if (m_metaDataWidget) { m_metaDataWidget->show(); m_metaDataWidget->setItems(KFileItemList() << item); } @@ -234,7 +234,7 @@ void InformationPanelContent::showItems(const KFileItemList& items) m_preview->setPixmap(icon); setNameLabelText(i18ncp("@info", "%1 item selected", "%1 items selected", items.count())); - if (m_metaDataWidget != 0) { + if (m_metaDataWidget) { m_metaDataWidget->setItems(items); } @@ -289,7 +289,7 @@ void InformationPanelContent::configureSettings(const QList<QAction*>& customCon // Open the popup and adjust the settings for the // selected action. QAction* action = popup.exec(QCursor::pos()); - if (action == 0) { + if (!action) { return; } @@ -418,7 +418,7 @@ void InformationPanelContent::adjustWidgetSizes(int width) // The metadata widget also contains a text widget which may return // a large preferred width. - if (m_metaDataWidget != 0) { + if (m_metaDataWidget) { m_metaDataWidget->setMaximumWidth(maxWidth); } diff --git a/src/panels/information/phononwidget.cpp b/src/panels/information/phononwidget.cpp index b6da339ea..5accf4d87 100644 --- a/src/panels/information/phononwidget.cpp +++ b/src/panels/information/phononwidget.cpp @@ -118,7 +118,7 @@ void PhononWidget::showEvent(QShowEvent *event) return; } - if (m_topLayout == 0) { + if (!m_topLayout) { m_topLayout = new QVBoxLayout(this); m_topLayout->setMargin(0); m_topLayout->setSpacing(KDialog::spacingHint()); @@ -185,7 +185,7 @@ void PhononWidget::play() { switch (m_mode) { case Audio: - if (m_audioMedia == 0) { + if (!m_audioMedia) { m_audioMedia = Phonon::createPlayer(Phonon::MusicCategory, m_url); m_audioMedia->setParent(this); } @@ -195,7 +195,7 @@ void PhononWidget::play() break; case Video: - if (m_videoPlayer == 0) { + if (!m_videoPlayer) { m_videoPlayer = new EmbeddedVideoPlayer(Phonon::VideoCategory, this); m_topLayout->insertWidget(0, m_videoPlayer); } @@ -209,7 +209,7 @@ void PhononWidget::play() break; } - Q_ASSERT(m_media != 0); + Q_ASSERT(m_media); connect(m_media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(stateChanged(Phonon::State))); m_seekSlider->setMediaObject(m_media); @@ -219,7 +219,7 @@ void PhononWidget::play() void PhononWidget::stop() { - if (m_media != 0) { + if (m_media) { m_media->stop(); disconnect(m_media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(stateChanged(Phonon::State))); @@ -229,14 +229,14 @@ void PhononWidget::stop() m_playButton->show(); } - if (m_videoPlayer != 0) { + if (m_videoPlayer) { m_videoPlayer->hide(); } } void PhononWidget::applyVideoSize() { - if ((m_videoPlayer != 0) && m_videoSize.isValid()) { + if ((m_videoPlayer) && m_videoSize.isValid()) { m_videoPlayer->setSizeHint(m_videoSize); } } diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index d928380d8..61d80cbfa 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -58,9 +58,7 @@ bool TerminalPanel::urlChanged() return false; } - const bool sendInput = (m_terminal != 0) - && (m_terminal->foregroundProcessId() == -1) - && isVisible(); + const bool sendInput = m_terminal && (m_terminal->foregroundProcessId() == -1) && isVisible(); if (sendInput) { changeDir(url()); } @@ -75,18 +73,18 @@ void TerminalPanel::showEvent(QShowEvent* event) return; } - if (m_terminal == 0) { + if (!m_terminal) { m_clearTerminal = true; KPluginFactory* factory = KPluginLoader("libkonsolepart").factory(); KParts::ReadOnlyPart* part = factory ? (factory->create<KParts::ReadOnlyPart>(this)) : 0; - if (part != 0) { + if (part) { connect(part, SIGNAL(destroyed(QObject*)), this, SLOT(terminalExited())); m_terminalWidget = part->widget(); m_layout->addWidget(m_terminalWidget); m_terminal = qobject_cast<TerminalInterfaceV2 *>(part); } } - if (m_terminal != 0) { + if (m_terminal) { m_terminal->showShellInDir(url().toLocalFile()); changeDir(url()); m_terminalWidget->setFocus(); |
