1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2025-01-29 16:49:27 +01:00

FancyTabWidget: Move functions

This commit is contained in:
Jonas Kvinge 2024-11-03 04:42:44 +01:00
parent b7165e0124
commit 7cfb175a45
2 changed files with 30 additions and 30 deletions

View File

@ -87,33 +87,6 @@ void FancyTabWidget::AddTab(QWidget *widget_view, const QString &name, const QIc
}
bool FancyTabWidget::EnableTab(QWidget *widget_view) {
if (!tabs_.contains(widget_view)) return false;
FancyTabData *tab = tabs_.value(widget_view);
if (QTabWidget::indexOf(tab->page()) >= 0) return true;
(void)InsertTab(count(), tab);
return true;
}
bool FancyTabWidget::DisableTab(QWidget *widget_view) {
if (!tabs_.contains(widget_view)) return false;
FancyTabData *tab = tabs_.value(widget_view);
int idx = QTabWidget::indexOf(tab->page());
if (idx < 0) return false;
removeTab(idx);
return true;
}
void FancyTabWidget::LoadSettings(const QString &settings_group) {
Settings s;
@ -250,6 +223,33 @@ int FancyTabWidget::InsertTab(const int idx, QWidget *page, const QIcon &icon, c
return QTabWidget::insertTab(idx, page, icon, label);
}
bool FancyTabWidget::EnableTab(QWidget *widget_view) {
if (!tabs_.contains(widget_view)) return false;
FancyTabData *tab = tabs_.value(widget_view);
if (QTabWidget::indexOf(tab->page()) >= 0) return true;
(void)InsertTab(count(), tab);
return true;
}
bool FancyTabWidget::DisableTab(QWidget *widget_view) {
if (!tabs_.contains(widget_view)) return false;
FancyTabData *tab = tabs_.value(widget_view);
int idx = QTabWidget::indexOf(tab->page());
if (idx < 0) return false;
removeTab(idx);
return true;
}
void FancyTabWidget::AddSpacer() {
QWidget *spacer = new QWidget(this);

View File

@ -58,9 +58,6 @@ class FancyTabWidget : public QTabWidget {
void AddTab(QWidget *widget_view, const QString &name, const QIcon &icon, const QString &label);
bool EnableTab(QWidget *widget_view);
bool DisableTab(QWidget *widget_view);
void LoadSettings(const QString &settings_group);
void SaveSettings(const QString &settings_group);
void ReloadSettings();
@ -68,6 +65,9 @@ class FancyTabWidget : public QTabWidget {
int InsertTab(const int preffered_index, FancyTabData *tab);
int InsertTab(const int idx, QWidget *page, const QIcon &icon, const QString &label);
bool EnableTab(QWidget *widget_view);
bool DisableTab(QWidget *widget_view);
void AddSpacer();
void AddBottomWidget(QWidget *widget_view);
void SetBackgroundPixmap(const QPixmap &pixmap);