Remove unneeded `this`

This commit is contained in:
Jonas Kvinge 2021-09-13 20:49:33 +02:00
parent d78ee3d62b
commit d5b0794b00
20 changed files with 40 additions and 40 deletions

View File

@ -53,17 +53,17 @@ struct QueryOptions {
QString filter() const { return filter_; }
void set_filter(const QString &filter) {
this->filter_ = filter;
this->query_mode_ = QueryMode_All;
filter_ = filter;
query_mode_ = QueryMode_All;
}
int max_age() const { return max_age_; }
void set_max_age(int max_age) { this->max_age_ = max_age; }
void set_max_age(int max_age) { max_age_ = max_age; }
QueryMode query_mode() const { return query_mode_; }
void set_query_mode(QueryMode query_mode) {
this->query_mode_ = query_mode;
this->filter_ = QString();
query_mode_ = query_mode;
filter_ = QString();
}
private:

View File

@ -548,7 +548,7 @@ bool Database::IntegrityCheck(const QSqlDatabase &db) {
void Database::DoBackup() {
QSqlDatabase db(this->Connect());
QSqlDatabase db(Connect());
if (!db.isOpen()) return;

View File

@ -1429,8 +1429,8 @@ void Song::BindToQuery(SqlQuery *query) const {
query->BindValue(":art_automatic", d->art_automatic_.isValid() ? d->art_automatic_.toString(QUrl::FullyEncoded) : "");
query->BindValue(":art_manual", d->art_manual_.isValid() ? d->art_manual_.toString(QUrl::FullyEncoded) : "");
query->BindValue(":effective_albumartist", strval(this->effective_albumartist()));
query->BindValue(":effective_originalyear", intval(this->effective_originalyear()));
query->BindValue(":effective_albumartist", strval(effective_albumartist()));
query->BindValue(":effective_originalyear", intval(effective_originalyear()));
query->BindValue(":cue_path", d->cue_path_);

View File

@ -40,7 +40,7 @@
About::About(QWidget *parent) : QDialog(parent) {
ui_.setupUi(this);
setWindowFlags(this->windowFlags()|Qt::WindowStaysOnTopHint);
setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint);
setWindowTitle(tr("About Strawberry"));
strawberry_authors_ \

View File

@ -36,7 +36,7 @@
SnapDialog::SnapDialog(QWidget *parent) : QDialog(parent), ui_(new Ui_SnapDialog) {
ui_->setupUi(this);
setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint);
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
setWindowTitle(tr("Strawberry is running as a Snap"));
QString text;

View File

@ -43,7 +43,7 @@ class InternetServices : public QObject {
InternetService *ServiceBySource(const Song::Source source) const;
template <typename T>
T *Service() {
return static_cast<T*>(this->ServiceBySource(T::kSource));
return static_cast<T*>(ServiceBySource(T::kSource));
}
void AddService(InternetService *service);

View File

@ -458,7 +458,7 @@ void OSDPretty::Reposition() {
// On windows, enable blurbehind on the masked area
#ifdef Q_OS_WIN
Utilities::enableBlurBehindWindow(this->windowHandle(), QRegion(mask));
Utilities::enableBlurBehindWindow(windowHandle(), QRegion(mask));
#endif
}

View File

@ -109,7 +109,7 @@ void Queue::SourceDataChanged(const QModelIndex &top_left, const QModelIndex &bo
emit dataChanged(proxy_index, proxy_index);
}
emit ItemCountChanged(this->ItemCount());
emit ItemCountChanged(ItemCount());
}
@ -128,7 +128,7 @@ void Queue::SourceLayoutChanged() {
signal_item_count_changed_ = QObject::connect(this, &Queue::ItemCountChanged, this, &Queue::UpdateTotalLength);
emit ItemCountChanged(this->ItemCount());
emit ItemCountChanged(ItemCount());
}
@ -250,8 +250,8 @@ void Queue::UpdateTotalLength() {
void Queue::UpdateSummaryText() {
QString summary;
int tracks = this->ItemCount();
quint64 nanoseconds = this->GetTotalLength();
int tracks = ItemCount();
quint64 nanoseconds = GetTotalLength();
summary += tracks == 1 ? tr("1 track") : tr("%1 tracks").arg(tracks);

View File

@ -48,7 +48,7 @@ class RadioServices : public QObject {
template <typename T>
T *Service() {
return static_cast<T*>(this->ServiceBySource(T::source));
return static_cast<T*>(ServiceBySource(T::source));
}
void ReloadSettings();

View File

@ -59,7 +59,7 @@ class AudioScrobbler : public QObject {
template <typename T>
T *Service() {
return qobject_cast<T*>(this->ServiceByName(T::kName));
return qobject_cast<T*>(ServiceByName(T::kName));
}
public slots:

View File

@ -48,7 +48,7 @@ class ScrobblerServices : public QObject {
ScrobblerService *ServiceByName(const QString &name);
template <typename T>
T *Service() {
return qobject_cast<T*>(this->ServiceByName(T::kName));
return qobject_cast<T*>(ServiceByName(T::kName));
}
private:

View File

@ -257,7 +257,7 @@ void CoversSettingsPage::AuthenticationSuccess() {
if (!provider) return;
DisconnectAuthentication(provider);
if (!this->isVisible() || !ui_->providers->currentItem() || ui_->providers->currentItem()->text() != provider->name()) return;
if (!isVisible() || !ui_->providers->currentItem() || ui_->providers->currentItem()->text() != provider->name()) return;
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
ui_->button_authenticate->setEnabled(true);
@ -270,7 +270,7 @@ void CoversSettingsPage::AuthenticationFailure(const QStringList &errors) {
if (!provider) return;
DisconnectAuthentication(provider);
if (!this->isVisible() || !ui_->providers->currentItem() || ui_->providers->currentItem()->text() != provider->name()) return;
if (!isVisible() || !ui_->providers->currentItem() || ui_->providers->currentItem()->text() != provider->name()) return;
QMessageBox::warning(this, tr("Authentication failed"), errors.join("\n"));

View File

@ -237,7 +237,7 @@ void LyricsSettingsPage::AuthenticationSuccess() {
if (!provider) return;
DisconnectAuthentication(provider);
if (!this->isVisible() || !ui_->providers->currentItem() || ui_->providers->currentItem()->text() != provider->name()) return;
if (!isVisible() || !ui_->providers->currentItem() || ui_->providers->currentItem()->text() != provider->name()) return;
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
ui_->button_authenticate->setEnabled(true);
@ -250,7 +250,7 @@ void LyricsSettingsPage::AuthenticationFailure(const QStringList &errors) {
if (!provider) return;
DisconnectAuthentication(provider);
if (!this->isVisible() || !ui_->providers->currentItem() || ui_->providers->currentItem()->text() != provider->name()) return;
if (!isVisible() || !ui_->providers->currentItem() || ui_->providers->currentItem()->text() != provider->name()) return;
QMessageBox::warning(this, tr("Authentication failed"), errors.join("\n"));

View File

@ -163,7 +163,7 @@ void QobuzSettingsPage::LogoutClicked() {
void QobuzSettingsPage::LoginSuccess() {
if (!this->isVisible()) return;
if (!isVisible()) return;
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
ui_->button_login->setEnabled(true);
@ -171,7 +171,7 @@ void QobuzSettingsPage::LoginSuccess() {
void QobuzSettingsPage::LoginFailure(const QString &failure_reason) {
if (!this->isVisible()) return;
if (!isVisible()) return;
QMessageBox::warning(this, tr("Authentication failed"), failure_reason);
}

View File

@ -151,7 +151,7 @@ bool SubsonicSettingsPage::eventFilter(QObject *object, QEvent *event) {
void SubsonicSettingsPage::TestSuccess() {
if (!this->isVisible()) return;
if (!isVisible()) return;
ui_->button_test->setEnabled(true);
QMessageBox::information(this, tr("Test successful!"), tr("Test successful!"));
@ -160,7 +160,7 @@ void SubsonicSettingsPage::TestSuccess() {
void SubsonicSettingsPage::TestFailure(const QString &failure_reason) {
if (!this->isVisible()) return;
if (!isVisible()) return;
ui_->button_test->setEnabled(true);
QMessageBox::warning(this, tr("Test failed!"), failure_reason);

View File

@ -207,7 +207,7 @@ void TidalSettingsPage::LogoutClicked() {
void TidalSettingsPage::LoginSuccess() {
if (!this->isVisible()) return;
if (!isVisible()) return;
ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
ui_->button_login->setEnabled(true);
@ -215,7 +215,7 @@ void TidalSettingsPage::LoginSuccess() {
void TidalSettingsPage::LoginFailure(const QString &failure_reason) {
if (!this->isVisible()) return;
if (!isVisible()) return;
QMessageBox::warning(this, tr("Authentication failed"), failure_reason);
ui_->button_login->setEnabled(true);

View File

@ -299,9 +299,9 @@ QMimeData *SmartPlaylistsModel::mimeData(const QModelIndexList &indexes) const {
PlaylistGeneratorPtr generator = CreateGenerator(indexes.first());
if (!generator) return nullptr;
PlaylistGeneratorMimeData *data = new PlaylistGeneratorMimeData(generator);
data->setData(kSmartPlaylistsMimeType, QByteArray());
data->name_for_new_playlist_ = this->data(indexes.first()).toString();
return data;
PlaylistGeneratorMimeData *mimedata = new PlaylistGeneratorMimeData(generator);
mimedata->setData(kSmartPlaylistsMimeType, QByteArray());
mimedata->name_for_new_playlist_ = data(indexes.first()).toString();
return mimedata;
}

View File

@ -264,9 +264,9 @@ void GroupedIconView::paintEvent(QPaintEvent *e) {
const QAbstractItemModel *itemModel = model();
const QItemSelectionModel *selections = selectionModel();
const bool focus = (hasFocus() || viewport()->hasFocus()) && current.isValid();
const QStyle::State state = option.state;
const QAbstractItemView::State viewState = this->state();
const bool enabled = (state & QStyle::State_Enabled) != 0;
const QStyle::State opt_state = option.state;
const QAbstractItemView::State viewState = state();
const bool enabled = (opt_state & QStyle::State_Enabled) != 0;
int maxSize = (flow() == TopToBottom) ? viewport()->size().width() - 2 * spacing() : viewport()->size().height() - 2 * spacing();
@ -285,7 +285,7 @@ void GroupedIconView::paintEvent(QPaintEvent *e) {
option.rect.setHeight(qMin(maxSize, option.rect.height()));
}
option.state = state;
option.state = opt_state;
if (selections && selections->isSelected(*it))
option.state |= QStyle::State_Selected;
if (enabled) {

View File

@ -25,7 +25,7 @@ class QSearchField : public QWidget {
void setFocus(Qt::FocusReason);
public slots:
void setText(const QString &text);
void setText(const QString &new_text);
void setPlaceholderText(const QString &text);
void clear();
void selectAll();

View File

@ -111,11 +111,11 @@ void QSearchField::setIconSize(const int iconsize) {
}
void QSearchField::setText(const QString &text) {
void QSearchField::setText(const QString &new_text) {
Q_ASSERT(pimpl && pimpl->clearbutton_ && pimpl->lineedit_);
if (!(pimpl && pimpl->clearbutton_ && pimpl->lineedit_)) return;
if (text != this->text()) pimpl->lineedit_->setText(text);
if (new_text != text()) pimpl->lineedit_->setText(new_text);
}