Skip to content

Commit

Permalink
Reduce dependency on Main Window
Browse files Browse the repository at this point in the history
PR #21753.
  • Loading branch information
Chocobo1 authored Nov 6, 2024
1 parent 75d1ac8 commit 3da9444
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/gui/search/searchwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
#include <QDebug>
#include <QEvent>
#include <QList>
#include <QMessageBox>
#include <QMenu>
#include <QMessageBox>
#include <QMouseEvent>
#include <QObject>
#include <QRegularExpression>
Expand Down Expand Up @@ -84,10 +84,9 @@ namespace
}
}

SearchWidget::SearchWidget(IGUIApplication *app, MainWindow *mainWindow)
: GUIApplicationComponent(app, mainWindow)
SearchWidget::SearchWidget(IGUIApplication *app, QWidget *parent)
: GUIApplicationComponent(app, parent)
, m_ui {new Ui::SearchWidget()}
, m_mainWindow {mainWindow}
{
m_ui->setupUi(this);
m_ui->tabWidget->tabBar()->installEventFilter(this);
Expand Down Expand Up @@ -175,6 +174,7 @@ bool SearchWidget::eventFilter(QObject *object, QEvent *event)
}
return false;
}

return QWidget::eventFilter(object, event);
}

Expand Down Expand Up @@ -373,7 +373,7 @@ void SearchWidget::tabStatusChanged(QWidget *tab)
{
Q_ASSERT(m_activeSearchTab->status() != SearchJobWidget::Status::Ongoing);

if (app()->desktopIntegration()->isNotificationsEnabled() && (m_mainWindow->currentTabWidget() != this))
if (app()->desktopIntegration()->isNotificationsEnabled() && (app()->mainWindow()->currentTabWidget() != this))
{
if (m_activeSearchTab->status() == SearchJobWidget::Status::Error)
app()->desktopIntegration()->showNotification(tr("Search Engine"), tr("Search has failed"));
Expand Down
6 changes: 1 addition & 5 deletions src/gui/search/searchwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,14 @@

#pragma once

#include <QList>
#include <QPointer>
#include <QWidget>

#include "gui/guiapplicationcomponent.h"

class QEvent;
class QObject;
class QTabWidget;

class MainWindow;
class SearchJobWidget;

namespace Ui
Expand All @@ -54,7 +51,7 @@ class SearchWidget : public GUIApplicationComponent<QWidget>
Q_DISABLE_COPY_MOVE(SearchWidget)

public:
explicit SearchWidget(IGUIApplication *app, MainWindow *mainWindow);
explicit SearchWidget(IGUIApplication *app, QWidget *parent);
~SearchWidget() override;

void giveFocusToSearchInput();
Expand Down Expand Up @@ -83,6 +80,5 @@ private slots:
Ui::SearchWidget *m_ui = nullptr;
QPointer<SearchJobWidget> m_currentSearchTab; // Selected tab
QPointer<SearchJobWidget> m_activeSearchTab; // Tab with running search
MainWindow *m_mainWindow = nullptr;
bool m_isNewQueryString = false;
};

0 comments on commit 3da9444

Please sign in to comment.