console: Add a mechanism to allow components to add pages
Add a MainWindow signal that is emitted when a debug console is created. Relay that signal to the Application. Add an AddPage method to the Console class that allows components to populate pages when they receive the signal.
This commit is contained in:
parent
2b99d32bee
commit
0ee64a32f6
@ -32,6 +32,7 @@ class QSettings;
|
|||||||
class AlbumCoverLoader;
|
class AlbumCoverLoader;
|
||||||
class Appearance;
|
class Appearance;
|
||||||
class ApplicationImpl;
|
class ApplicationImpl;
|
||||||
|
class Console;
|
||||||
class CoverProviders;
|
class CoverProviders;
|
||||||
class CurrentArtLoader;
|
class CurrentArtLoader;
|
||||||
class Database;
|
class Database;
|
||||||
@ -121,6 +122,8 @@ class Application : public QObject {
|
|||||||
void SaveSettings(QSettings* settings);
|
void SaveSettings(QSettings* settings);
|
||||||
void SettingsDialogRequested(SettingsDialog::Page page);
|
void SettingsDialogRequested(SettingsDialog::Page page);
|
||||||
|
|
||||||
|
void NewDebugConsole(Console* console);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SaveSettings_();
|
void SaveSettings_();
|
||||||
|
|
||||||
|
@ -77,3 +77,7 @@ QObject* Console::FindTopLevelObject(QString& name) {
|
|||||||
if (obj->objectName() == name) return obj;
|
if (obj->objectName() == name) return obj;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Console::AddPage(QWidget* page, const QString& label) {
|
||||||
|
ui_.tabWidget->addTab(page, label);
|
||||||
|
}
|
||||||
|
@ -12,6 +12,8 @@ class Console : public QDialog {
|
|||||||
public:
|
public:
|
||||||
Console(Application* app, QWidget* parent = nullptr);
|
Console(Application* app, QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
void AddPage(QWidget* page, const QString& label);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// Database
|
// Database
|
||||||
void RunQuery();
|
void RunQuery();
|
||||||
|
@ -487,6 +487,10 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd,
|
|||||||
connect(ui_->action_view_stream_details, SIGNAL(triggered()),
|
connect(ui_->action_view_stream_details, SIGNAL(triggered()),
|
||||||
SLOT(DiscoverStreamDetails()));
|
SLOT(DiscoverStreamDetails()));
|
||||||
|
|
||||||
|
// Relay this signal to the Application
|
||||||
|
connect(this, SIGNAL(NewDebugConsole(Console*)), app_,
|
||||||
|
SIGNAL(NewDebugConsole(Console*)));
|
||||||
|
|
||||||
background_streams_->AddAction("Rain", ui_->action_rain);
|
background_streams_->AddAction("Rain", ui_->action_rain);
|
||||||
background_streams_->AddAction("Hypnotoad", ui_->action_hypnotoad);
|
background_streams_->AddAction("Hypnotoad", ui_->action_hypnotoad);
|
||||||
background_streams_->AddAction("Make it so!", ui_->action_enterprise);
|
background_streams_->AddAction("Make it so!", ui_->action_enterprise);
|
||||||
@ -2741,7 +2745,11 @@ StreamDiscoverer* MainWindow::CreateStreamDiscoverer() {
|
|||||||
return discoverer;
|
return discoverer;
|
||||||
}
|
}
|
||||||
|
|
||||||
Console* MainWindow::CreateDebugConsole() { return new Console(app_, this); }
|
Console* MainWindow::CreateDebugConsole() {
|
||||||
|
Console* console = new Console(app_, this);
|
||||||
|
emit NewDebugConsole(console);
|
||||||
|
return console;
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::ShowAboutDialog() { about_dialog_->show(); }
|
void MainWindow::ShowAboutDialog() { about_dialog_->show(); }
|
||||||
|
|
||||||
|
@ -152,6 +152,8 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||||||
void StopAfterToggled(bool stop);
|
void StopAfterToggled(bool stop);
|
||||||
|
|
||||||
void IntroPointReached();
|
void IntroPointReached();
|
||||||
|
|
||||||
|
void NewDebugConsole(Console* console);
|
||||||
private slots:
|
private slots:
|
||||||
void FilePathChanged(const QString& path);
|
void FilePathChanged(const QString& path);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user