Skip to content

Commit

Permalink
Replaced uses of Qt keywords with the respective Q_* macros
Browse files Browse the repository at this point in the history
  • Loading branch information
jaakristioja committed May 25, 2020
1 parent 6e3ee49 commit ae1988b
Show file tree
Hide file tree
Showing 128 changed files with 326 additions and 324 deletions.
2 changes: 1 addition & 1 deletion src/backend/bookshelfmodel/btbookshelffiltermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class BtBookshelfFilterModel: public QSortFilterProxyModel {
return m_categoryFilter;
}

public slots:
public Q_SLOTS:
void setEnabled(bool enable);

// Name filter:
Expand Down
2 changes: 1 addition & 1 deletion src/backend/bookshelfmodel/btbookshelfmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,5 +221,5 @@ void BtBookshelfModel::moduleDataChanged(CSwordModuleInfo * module) {
BT_ASSERT(m_data.count(module) == 1);

QModelIndex i(index(m_data.indexOf(module), 0));
emit dataChanged(i, i);
Q_EMIT dataChanged(i, i);
}
2 changes: 1 addition & 1 deletion src/backend/bookshelfmodel/btbookshelfmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class BtBookshelfModel: public QAbstractListModel {
return m_data;
}

protected slots:
protected Q_SLOTS:

/**
Slot DIRECTLY called by CSwordModuleInfo when the hidden status of the respective
Expand Down
16 changes: 8 additions & 8 deletions src/backend/bookshelfmodel/btbookshelftreemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,16 @@ bool BtBookshelfTreeModel::setData(const QModelIndex & itemIndex,
for (;;) {
if (item->checkState() != newState) {
item->setCheckState(newState);
emit dataChanged(p.second, p.second);
Q_EMIT dataChanged(p.second, p.second);
if (item->type() == Item::ITEM_MODULE) {
ModuleItem & mItem = *static_cast<ModuleItem *>(item);
CSwordModuleInfo & mInfo = mItem.moduleInfo();
if (newState == Qt::Checked) {
m_checkedModulesCache.insert(&mInfo);
emit moduleChecked(&mInfo, true);
Q_EMIT moduleChecked(&mInfo, true);
} else {
m_checkedModulesCache.remove(&mInfo);
emit moduleChecked(&mInfo, false);
Q_EMIT moduleChecked(&mInfo, false);
}
} else {
const QList<Item *> & children = item->children();
Expand Down Expand Up @@ -320,7 +320,7 @@ void BtBookshelfTreeModel::setGroupingOrder(const Grouping & groupingOrder,
}

if (emitSignal)
emit groupingOrderChanged(groupingOrder);
Q_EMIT groupingOrderChanged(groupingOrder);
}

void BtBookshelfTreeModel::setCheckable(bool checkable) {
Expand Down Expand Up @@ -349,7 +349,7 @@ void BtBookshelfTreeModel::resetData() {
queue.append(QModelIndex());
do {
QModelIndex parent(queue.takeFirst());
emit dataChanged(index(0, 0, parent),
Q_EMIT dataChanged(index(0, 0, parent),
index(rowCount(parent) - 1, columnCount() - 1, parent));
for (int i = 0; i < rowCount(parent); i++) {
const QModelIndex childIndex(index(i, 0, parent));
Expand Down Expand Up @@ -515,7 +515,7 @@ void BtBookshelfTreeModel::resetParentCheckStates(QModelIndex parentIndex) {
break;

parentItem.setCheckState(newState);
emit dataChanged(parentIndex, parentIndex);
Q_EMIT dataChanged(parentIndex, parentIndex);
} // for ( ; parentIndex.isValid(); parentIndex = parentIndex.parent())
}

Expand All @@ -535,15 +535,15 @@ void BtBookshelfTreeModel::moduleDataChanged(const QModelIndex & topLeft,
QModelIndex itemIndex(getIndex(*m_modules[&module]));
BT_ASSERT(itemIndex.isValid());

emit dataChanged(itemIndex, itemIndex);
Q_EMIT dataChanged(itemIndex, itemIndex);

/*
Also emit signals for parent items because the change might alter them
as well, e.g. isHidden()
*/
do {
itemIndex = itemIndex.parent();
emit dataChanged(itemIndex, itemIndex);
Q_EMIT dataChanged(itemIndex, itemIndex);
} while (itemIndex.isValid());
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/backend/bookshelfmodel/btbookshelftreemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class BtBookshelfTreeModel: public QAbstractItemModel {
return m_checkedModulesCache;
}

public slots:
public Q_SLOTS:

void setSourceModel(QAbstractItemModel * sourceModel);
void setGroupingOrder(const BtBookshelfTreeModel::Grouping & groupingOrder,
Expand All @@ -140,7 +140,7 @@ public slots:
}
void setCheckedModules(BtConstModuleSet const & modules);

signals:
Q_SIGNALS:

void groupingOrderChanged(BtBookshelfTreeModel::Grouping newGrouping);
void moduleChecked(CSwordModuleInfo * module, bool checked);
Expand All @@ -149,7 +149,7 @@ public slots:

void resetData();

protected slots:
protected Q_SLOTS:

void moduleDataChanged(const QModelIndex & topLeft,
const QModelIndex & bottomRight);
Expand Down
4 changes: 2 additions & 2 deletions src/backend/btbookmarksmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ void BtBookmarksModel::sortItems(QModelIndex const & parent,
parents.append(f);

Q_FOREACH(BookmarkFolder * const f, parents) {
emit layoutAboutToBeChanged();
Q_EMIT layoutAboutToBeChanged();

QModelIndexList indexes;
for(int i = 0; i < f->children().size(); ++i)
Expand All @@ -980,7 +980,7 @@ void BtBookmarksModel::sortItems(QModelIndex const & parent,
if(iii == indexes[ii].internalPointer())
changePersistentIndex(createIndex(ii, 0, iii), createIndex(i, 0, iii));
}
emit layoutChanged();
Q_EMIT layoutChanged();

d->needSave();
}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/btbookmarksmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class BtBookmarksModel: public QAbstractItemModel {
*/
QHash<int, QByteArray> roleNames() const override;

public slots:
public Q_SLOTS:

/**
\brief Save bookmarks or specified branch to file.
Expand Down
4 changes: 2 additions & 2 deletions src/backend/btinstallmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void BtInstallMgr::statusUpdate(double dltotal, double dlnow) {
const int filePercent = calculateIntPercentage(dlnow, dltotal);

//qApp->processEvents();
emit percentCompleted(totalPercent, filePercent);
Q_EMIT percentCompleted(totalPercent, filePercent);
}


Expand All @@ -96,7 +96,7 @@ void BtInstallMgr::preStatus(long totalBytes,
BT_ASSERT(completedBytes <= totalBytes);
if (m_firstCallOfPreStatus) {
m_firstCallOfPreStatus = false;
emit downloadStarted();
Q_EMIT downloadStarted();
}
m_completedBytes = completedBytes;
m_totalBytes = totalBytes;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/btinstallmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class BtInstallMgr

bool isUserDisclaimerConfirmed() const override;

signals:
Q_SIGNALS:

/**
Download status. Percent of total and file.
Expand Down
14 changes: 7 additions & 7 deletions src/backend/btinstallthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void BtInstallThread::run() {
}

void BtInstallThread::installModule() {
emit preparingInstall(m_currentModuleIndex);
Q_EMIT preparingInstall(m_currentModuleIndex);

const CSwordModuleInfo * const module = m_modules.at(m_currentModuleIndex);

Expand All @@ -83,32 +83,32 @@ void BtInstallThread::installModule() {
module->name().toLatin1(),
&installSource);
if (status == 0) {
emit statusUpdated(m_currentModuleIndex, 100);
Q_EMIT statusUpdated(m_currentModuleIndex, 100);
} else {
qWarning() << "Error with install: " << status
<< "module:" << module->name();
}
emit installCompleted(m_currentModuleIndex, status == 0);
Q_EMIT installCompleted(m_currentModuleIndex, status == 0);
} else { // Local source
int status = m_iMgr.installModule(&lMgr,
installSource.directory.c_str(),
module->name().toLatin1());
if (status == 0) {
emit statusUpdated(m_currentModuleIndex, 100);
Q_EMIT statusUpdated(m_currentModuleIndex, 100);
} else if (status != -1) {
qWarning() << "Error with install: " << status
<< "module:" << module->name();
}
emit installCompleted(m_currentModuleIndex, status == 0);
Q_EMIT installCompleted(m_currentModuleIndex, status == 0);
}
}

void BtInstallThread::slotManagerStatusUpdated(int totalProgress, int /*fileProgress*/) {
emit statusUpdated(m_currentModuleIndex, totalProgress);
Q_EMIT statusUpdated(m_currentModuleIndex, totalProgress);
}

void BtInstallThread::slotDownloadStarted() {
emit downloadStarted(m_currentModuleIndex);
Q_EMIT downloadStarted(m_currentModuleIndex);
}

bool BtInstallThread::removeModule() {
Expand Down
4 changes: 2 additions & 2 deletions src/backend/btinstallthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class BtInstallThread: public QThread {
void stopInstall()
{ m_stopRequested.store(true, std::memory_order_relaxed); }

signals:
Q_SIGNALS:

/** Emitted when starting the installation. */
void preparingInstall(int moduleIndex);
Expand All @@ -73,7 +73,7 @@ class BtInstallThread: public QThread {
void installModule();
bool removeModule();

private slots:
private Q_SLOTS:

void slotDownloadStarted();
void slotManagerStatusUpdated(int totalProgress, int fileProgress);
Expand Down
4 changes: 2 additions & 2 deletions src/backend/btsignal.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class BtSignal: public QObject {
/**
Immediately emits the beforeChanged() signal.
*/
inline void emitSignal() { emit signal(); }
inline void emitSignal() { Q_EMIT signal(); }

signals:
Q_SIGNALS:

void signal();

Expand Down
23 changes: 12 additions & 11 deletions src/backend/btsourcesthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@


void BtSourcesThread::run() {
emit percentComplete(0);
emit showMessage(tr("Getting Library List"));
Q_EMIT percentComplete(0);
Q_EMIT showMessage(tr("Getting Library List"));
if (BtInstallMgr().refreshRemoteSourceConfiguration())
qWarning("InstallMgr: getting remote list returned an error.");
emit percentComplete(10);
Q_EMIT percentComplete(10);

if (shouldStop()) {
emit showMessage(tr("Updating stopped"));
Q_EMIT showMessage(tr("Updating stopped"));
return;
}

Expand All @@ -40,24 +40,25 @@ void BtSourcesThread::run() {
BtInstallMgr iMgr;
for (int i = 0; i < sourceCount; ++i) {
if (shouldStop()) {
emit showMessage(tr("Updating stopped"));
Q_EMIT showMessage(tr("Updating stopped"));
return;
}
QString const & sourceName = sourceNames[i];
emit showMessage(tr("Updating remote library \"%1\"").arg(sourceName));
Q_EMIT showMessage(
tr("Updating remote library \"%1\"").arg(sourceName));
{
sword::InstallSource source = BtInstallBackend::source(sourceName);
if (iMgr.refreshRemoteSource(&source)) {
failedSources[numFailedSources] = i;
++numFailedSources;
}
}
emit percentComplete(
Q_EMIT percentComplete(
static_cast<int>(10 + 90 * ((i + 1.0) / sourceCount)));
}
emit percentComplete(100);
Q_EMIT percentComplete(100);
if (numFailedSources <= 0) {
emit showMessage(tr("Remote libraries have been updated."));
Q_EMIT showMessage(tr("Remote libraries have been updated."));
m_finishedSuccessfully.store(true, std::memory_order_release);
} else {
QString msg = tr("The following remote libraries failed to update: ");
Expand All @@ -66,8 +67,8 @@ void BtSourcesThread::run() {
if (++i >= numFailedSources)
break;
msg += ", ";
};
emit showMessage(std::move(msg));
}
Q_EMIT showMessage(std::move(msg));
m_finishedSuccessfully.store(true, std::memory_order_release);
}
}
2 changes: 1 addition & 1 deletion src/backend/btsourcesthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class BtSourcesThread: public QThread {
inline bool finishedSuccessfully() const noexcept
{ return m_finishedSuccessfully.load(std::memory_order_acquire); }

signals:
Q_SIGNALS:

void percentComplete(int percent);
void showMessage(QString const & msg);
Expand Down
14 changes: 7 additions & 7 deletions src/backend/drivers/cswordmoduleinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ bool CSwordModuleInfo::unlock(const QString & unlockKey) {
/// \todo write to Sword config as well

if (unlockKeyIsValid() != unlocked)
emit unlockedChanged(!unlocked);
Q_EMIT unlockedChanged(!unlocked);
return true;
}

Expand Down Expand Up @@ -341,7 +341,7 @@ void CSwordModuleInfo::buildIndex() {
verseSpan = static_cast<CSwordLexiconModuleInfo *>(this)->entries().size();
}

emit indexingProgress(0);
Q_EMIT indexingProgress(0);

sword::SWKey * const key = m_module.getKey();
sword::VerseKey * const vk = dynamic_cast<sword::VerseKey *>(key);
Expand Down Expand Up @@ -481,9 +481,9 @@ void CSwordModuleInfo::buildIndex() {

if (verseIndex % 200 == 0) {
if (verseSpan == 0) { // Prevent division by zero
emit indexingProgress(0);
Q_EMIT indexingProgress(0);
} else {
emit indexingProgress(
Q_EMIT indexingProgress(
static_cast<int>(
(100 * (verseIndex - verseLowIndex))
/ verseSpan));
Expand All @@ -508,7 +508,7 @@ void CSwordModuleInfo::buildIndex() {
module_config.setValue("module-version",
config(CSwordModuleInfo::ModuleVersion));
module_config.setValue("index-version", INDEX_VERSION);
emit hasIndexChanged(true);
Q_EMIT hasIndexChanged(true);
}
// } catch (CLuceneError & e) {
} catch (...) {
Expand All @@ -522,7 +522,7 @@ void CSwordModuleInfo::buildIndex() {

void CSwordModuleInfo::deleteIndex() {
deleteIndexForModule(m_cachedName);
emit hasIndexChanged(false);
Q_EMIT hasIndexChanged(false);
}

void CSwordModuleInfo::deleteIndexForModule(const QString & name) {
Expand Down Expand Up @@ -1054,6 +1054,6 @@ bool CSwordModuleInfo::setHidden(bool hide) {
hiddenModules.removeOne(m_cachedName);
}
btConfig().setValue("state/hiddenModules", hiddenModules);
emit hiddenChanged(hide);
Q_EMIT hiddenChanged(hide);
return true;
}
4 changes: 2 additions & 2 deletions src/backend/drivers/cswordmoduleinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ wrong, or if the config file was write protected return false.
*/
static QString englishCategoryName(const CSwordModuleInfo::Category & category);

public slots:
public Q_SLOTS:

inline void cancelIndexing(std::memory_order const memoryOrder =
std::memory_order_relaxed) noexcept
Expand All @@ -430,7 +430,7 @@ public slots:
bool hasImportantFilterOption() const;
void setImportantFilterOptions(bool enable);

signals:
Q_SIGNALS:

void hasIndexChanged(bool hasIndex);
void hiddenChanged(bool hidden);
Expand Down
Loading

0 comments on commit ae1988b

Please sign in to comment.