Commit f4ec2501 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use API style foo() or createFoo(), not getFoo()

Reviewers: #kdevelop, kfunk

Reviewed By: #kdevelop, kfunk

Subscribers: kfunk, kdevelop-devel

Tags: #kdevelop

Differential Revision: https://phabricator.kde.org/D14492
parent df9af2df
......@@ -106,7 +106,7 @@ public:
* @returns list of potential buddy documents or an empty list
* if non are available.
*/
virtual QVector<QUrl> getPotentialBuddies(const QUrl& url) const = 0;
virtual QVector<QUrl> potentialBuddies(const QUrl& url) const = 0;
/**
* @brief Registers a <i>IBuddyDocumentFinder</i> object for a mimetype.
......
......@@ -47,7 +47,7 @@ bool rangesConnect(const KTextEditor::Range& firstRange, const KTextEditor::Rang
return !firstRange.intersect(secondRange + KTextEditor::Range(0, -1, 0, +1)).isEmpty();
}
Declaration* getDeclarationForChangedRange(KTextEditor::Document* doc, const KTextEditor::Range& changed)
Declaration* declarationForChangedRange(KTextEditor::Document* doc, const KTextEditor::Range& changed)
{
const KTextEditor::Cursor cursor(changed.start());
Declaration* declaration = DUChainUtils::itemUnderCursor(doc->url(), cursor).declaration;
......@@ -154,7 +154,7 @@ void RenameAssistant::textChanged(KTextEditor::Document* doc, const KTextEditor:
|| d->m_newDeclarationRange->document() != indexedUrl) {
d->reset();
Declaration* declAtCursor = getDeclarationForChangedRange(doc, invocationRange);
Declaration* declAtCursor = declarationForChangedRange(doc, invocationRange);
if (!declAtCursor) {
// not editing a declaration
return;
......
......@@ -1637,7 +1637,7 @@ uint DUChain::newTopContextIndex() {
return ret;
}
}
static QAtomicInt& currentId( globalItemRepositoryRegistry().getCustomCounter(QStringLiteral("Top-Context Counter"), 1) );
static QAtomicInt& currentId( globalItemRepositoryRegistry().customCounter(QStringLiteral("Top-Context Counter"), 1) );
return currentId.fetchAndAddRelaxed(1);
}
......
......@@ -107,7 +107,7 @@ KTextEditor::Attribute::Ptr CodeHighlighting::attributeForType( Types type, Cont
if ( !a || color.isValid() ) {
a = KTextEditor::Attribute::Ptr(new KTextEditor::Attribute(*ColorCache::self()->defaultColors()->getAttribute(type)));
a = KTextEditor::Attribute::Ptr(new KTextEditor::Attribute(*ColorCache::self()->defaultColors()->attribute(type)));
if ( context == DefinitionContext || context == DeclarationContext ) {
if (ICore::self()->languageController()->completionSettings()->boldDeclarations()) {
......
......@@ -43,7 +43,7 @@ void ConfigurableHighlightingColors::setDefaultAttribute(KTextEditor::Attribute:
m_defaultAttribute = defaultAttrib;
}
KTextEditor::Attribute::Ptr ConfigurableHighlightingColors::getAttribute(int number) const
KTextEditor::Attribute::Ptr ConfigurableHighlightingColors::attribute(int number) const
{
return m_attributes[number];
}
......
......@@ -37,7 +37,7 @@ class KDEVPLATFORMLANGUAGE_EXPORT ConfigurableHighlightingColors {
void addAttribute(int number, KTextEditor::Attribute::Ptr attribute);
KTextEditor::Attribute::Ptr getAttribute(int number) const;
KTextEditor::Attribute::Ptr attribute(int number) const;
void setDefaultAttribute(KTextEditor::Attribute::Ptr defaultAttrib);
......
......@@ -46,7 +46,7 @@ public:
void emitProgress(const IFilterStrategy::Progress& progress);
QString joinCommandLine() const;
QString getJobName();
QString jobDisplayName() const;
template< typename T >
static void mergeEnvironment( QProcessEnvironment& dest, const T& src );
......@@ -149,9 +149,10 @@ void OutputExecuteJob::setPrivilegedExecutionCommand( const QStringList& command
void OutputExecuteJob::setJobName( const QString& name )
{
d->m_jobName = name;
QString jobName = d->getJobName();
setObjectName( jobName );
setTitle( jobName );
const QString jobDisplayName = d->jobDisplayName();
setObjectName(jobDisplayName);
setTitle(jobDisplayName);
}
QUrl OutputExecuteJob::workingDirectory() const
......@@ -530,7 +531,7 @@ QStringList OutputExecuteJobPrivate::effectiveCommandLine() const
}
}
QString OutputExecuteJobPrivate::getJobName()
QString OutputExecuteJobPrivate::jobDisplayName() const
{
const QString joinedCommandLine = joinCommandLine();
if( m_properties.testFlag( OutputExecuteJob::AppendProcessString ) ) {
......
......@@ -148,7 +148,7 @@ CompilerFilterStrategy::CompilerFilterStrategy(const QUrl& buildDir)
CompilerFilterStrategy::~CompilerFilterStrategy() = default;
QVector<QString> CompilerFilterStrategy::getCurrentDirs()
QVector<QString> CompilerFilterStrategy::currentDirs() const
{
QVector<QString> ret;
ret.reserve(d->m_currentDirs.size());
......
......@@ -68,7 +68,7 @@ public:
FilteredItem actionInLine(const QString& line) override;
QVector<QString> getCurrentDirs();
QVector<QString> currentDirs() const;
private:
const QScopedPointer<class CompilerFilterStrategyPrivate> d;
......
......@@ -427,8 +427,8 @@ void TestFilteringStrategy::testCompilerFilterstrategyUrlFromAction()
QUrl projecturl = QUrl::fromLocalFile( projectPath(pathType) );
CompilerFilterStrategy testee(projecturl);
FilteredItem item1 = testee.actionInLine(line);
int last = testee.getCurrentDirs().size() - 1;
QCOMPARE(testee.getCurrentDirs().at(last), expectedLastDir);
int last = testee.currentDirs().size() - 1;
QCOMPARE(testee.currentDirs().at(last), expectedLastDir);
}
void TestFilteringStrategy::benchMarkCompilerFilterAction()
......
......@@ -54,7 +54,7 @@ namespace {
/**
* Returns the parent folder item for a given item or the project root item if there is no parent.
*/
ProjectFolderItem* getParentFolder(ProjectBaseItem* item)
ProjectFolderItem* parentFolder(ProjectBaseItem* item)
{
if ( item->parent() ) {
return static_cast<ProjectFolderItem*>(item->parent());
......@@ -568,7 +568,7 @@ bool AbstractFileManagerPlugin::removeFilesAndFolders(const QList<ProjectBaseIte
{
Q_ASSERT(item->folder() || item->file());
ProjectFolderItem* parent = getParentFolder(item);
ProjectFolderItem* parent = parentFolder(item);
d->stopWatcher(parent);
success &= removeUrl(parent->project(), item->path().toUrl(), true);
......@@ -596,7 +596,7 @@ bool AbstractFileManagerPlugin::moveFilesAndFolders(const QList< ProjectBaseItem
{
Q_ASSERT(item->folder() || item->file());
ProjectFolderItem* oldParent = getParentFolder(item);
ProjectFolderItem* oldParent = parentFolder(item);
d->stopWatcher(oldParent);
d->stopWatcher(newParent);
......
......@@ -184,7 +184,7 @@ QMutex& ItemRepositoryRegistry::mutex()
return d->m_mutex;
}
QAtomicInt& ItemRepositoryRegistry::getCustomCounter(const QString& identity, int initialValue)
QAtomicInt& ItemRepositoryRegistry::customCounter(const QString& identity, int initialValue)
{
if(!d->m_customCounters.contains(identity))
d->m_customCounters.insert(identity, new QAtomicInt(initialValue));
......@@ -302,7 +302,7 @@ bool ItemRepositoryRegistryPrivate::open(const QString& path)
stream >> counterName;
int counterValue;
stream >> counterValue;
m_owner->getCustomCounter(counterName, 0) = counterValue;
m_owner->customCounter(counterName, 0) = counterValue;
}
}
......
......@@ -90,7 +90,7 @@ class KDEVPLATFORMSERIALIZATION_EXPORT ItemRepositoryRegistry {
/// same directory, possibly creating it.
/// @param identity The string used to identify a counter.
/// @param initialValue Value to initialize a previously inexistent counter with.
QAtomicInt& getCustomCounter(const QString& identity, int initialValue);
QAtomicInt& customCounter(const QString& identity, int initialValue);
/// @returns The global item-repository mutex.
/// @note Can be used to protect the initialization.
......
......@@ -1054,7 +1054,7 @@ bool DocumentController::openDocumentsSimple( QStringList urls )
Sublime::Area* area = Core::self()->uiControllerInternal()->activeArea();
Sublime::AreaIndex* areaIndex = area->rootIndex();
QList<Sublime::View*> topViews = static_cast<Sublime::MainWindow*>(Core::self()->uiControllerInternal()->activeMainWindow())->getTopViews();
QList<Sublime::View*> topViews = static_cast<Sublime::MainWindow*>(Core::self()->uiControllerInternal()->activeMainWindow())->topViews();
if(Sublime::View* activeView = Core::self()->uiControllerInternal()->activeSublimeWindow()->activeView())
areaIndex = area->indexOf(activeView);
......
......@@ -152,7 +152,7 @@ static void gotoPrevNextSplit(bool next)
if (!area)
return;
QList<Sublime::View*> topViews = ui->activeSublimeWindow()->getTopViews();
QList<Sublime::View*> topViews = ui->activeSublimeWindow()->topViews();
Sublime::View *activeView = ui->activeSublimeWindow()->activeView();
if (!activeView)
......
......@@ -40,7 +40,7 @@ struct URLInfo
QString extension;
};
URLInfo getUrlInfo(const QUrl& url)
URLInfo urlInfo(const QUrl& url)
{
URLInfo ret;
ret.isValid = false;
......@@ -167,7 +167,7 @@ bool OpenProjectDialog::execNativeDialog()
{
if (nativeDialog->exec()) {
QUrl selectedUrl = nativeDialog->selectedUrls().at(0);
if (getUrlInfo(selectedUrl).isValid) {
if (urlInfo(selectedUrl).isValid) {
// validate directory first to populate m_projectName and m_projectManager
validateOpenUrl(selectedUrl.adjusted(QUrl::RemoveFilename));
validateOpenUrl(selectedUrl);
......@@ -199,7 +199,7 @@ void OpenProjectDialog::validateSourcePage(bool valid)
void OpenProjectDialog::validateOpenUrl( const QUrl& url_ )
{
URLInfo urlInfo = getUrlInfo(url_);
URLInfo urlInfo = ::urlInfo(url_);
const QUrl url = url_.adjusted(QUrl::StripTrailingSlash);
......
......@@ -55,7 +55,7 @@ OpenProjectPage::OpenProjectPage( const QUrl& startUrl, const QStringList& filte
connect( fileWidget, &KFileWidget::accepted, this, &OpenProjectPage::accepted);
}
QUrl OpenProjectPage::getAbsoluteUrl( const QString& file ) const
QUrl OpenProjectPage::absoluteUrl(const QString& file) const
{
QUrl u(file);
if( u.isRelative() )
......@@ -104,7 +104,7 @@ void OpenProjectPage::opsEntered(const QUrl& url)
void OpenProjectPage::comboTextChanged( const QString& file )
{
emit urlSelected( getAbsoluteUrl( file ) );
emit urlSelected(absoluteUrl(file));
}
}
......
......@@ -42,7 +42,9 @@ private Q_SLOTS:
void dirChanged(const QUrl& url);
private:
QUrl getAbsoluteUrl(const QString&) const;
QUrl absoluteUrl(const QString& file) const;
private:
KFileWidget* fileWidget;
};
......
......@@ -289,7 +289,7 @@ public:
* an operation from all others going on at the same time. Use that
* number as the id string for your <i>progressItem</i> to ensure it is unique.
*/
static QString getUniqueID()
static QString createUniqueID()
{
return QString::number( ++uID );
}
......@@ -301,7 +301,7 @@ public:
*/
static ProgressItem *createProgressItem( const QString &label )
{
return instance()->createProgressItemImpl( nullptr, getUniqueID(), label,
return instance()->createProgressItemImpl( nullptr, createUniqueID(), label,
QString(), true, false );
}
......
......@@ -238,7 +238,7 @@ void StatusBar::showProgress( IStatus* status, int minimum, int maximum, int val
if (!m_progressItems.contains(status)) {
bool canBeCanceled = false;
m_progressItems[status] = m_progressController->createProgressItem(
ProgressManager::getUniqueID(), status->statusName(), QString(), canBeCanceled);;
ProgressManager::createUniqueID(), status->statusName(), QString(), canBeCanceled);
}
ProgressItem* i = m_progressItems[status];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment