Fix crash

This commit is contained in:
Jonas Kvinge 2018-06-11 22:35:46 +02:00
parent bc78c3f3cb
commit c4e64b591d
6 changed files with 25 additions and 25 deletions

View File

@ -3,7 +3,7 @@ set(STRAWBERRY_VERSION_MINOR 1)
set(STRAWBERRY_VERSION_PATCH 6)
#set(STRAWBERRY_VERSION_PRERELEASE rc1)
set(INCLUDE_GIT_REVISION OFF)
set(INCLUDE_GIT_REVISION ON)
set(majorminorpatch "${STRAWBERRY_VERSION_MAJOR}.${STRAWBERRY_VERSION_MINOR}.${STRAWBERRY_VERSION_PATCH}")

View File

@ -5,7 +5,7 @@
}
#playlist[default_background_enabled = "true"] {
background-image: url(:/pictures/strawbs-transparent.png);
background-image: url(:pictures/strawbs-transparent.png);
background-attachment: fixed;
background-position: bottom right;
background-repeat: none;

View File

@ -219,16 +219,15 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
StyleHelper::setBaseColor(palette().color(QPalette::Highlight).darker());
// Add tabs to the fancy tab widget
ui_->tabs->AddTab(status_view_, IconLoader::Load("strawberry"), tr("Status"));
ui_->tabs->AddTab(collection_view_, IconLoader::Load("vinyl"), tr("Collection"));
ui_->tabs->AddTab(file_view_, IconLoader::Load("document-open"), tr("Files"));
ui_->tabs->AddTab(playlist_list_, IconLoader::Load("view-media-playlist"), tr("Playlists"));
ui_->tabs->AddTab(device_view_, IconLoader::Load("device"), tr("Devices"));
ui_->tabs->addTab(status_view_, IconLoader::Load("strawberry"), tr("Status"));
ui_->tabs->addTab(collection_view_, IconLoader::Load("vinyl"), tr("Collection"));
ui_->tabs->addTab(file_view_, IconLoader::Load("document-open"), tr("Files"));
ui_->tabs->addTab(playlist_list_, IconLoader::Load("view-media-playlist"), tr("Playlists"));
ui_->tabs->addTab(device_view_, IconLoader::Load("device"), tr("Devices"));
//ui_->tabs->AddSpacer();
// Add the now playing widget to the fancy tab widget
ui_->tabs->AddBottomWidget(ui_->now_playing);
ui_->tabs->addBottomWidget(ui_->now_playing);
//ui_->tabs->SetBackgroundPixmap(QPixmap(":/pictures/strawberry-background.png"));
@ -643,7 +642,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
if (!ui_->splitter->restoreState(settings_.value("splitter_state").toByteArray())) {
ui_->splitter->setSizes(QList<int>() << 300 << width() - 300);
}
ui_->tabs->SetCurrentIndex(settings_.value("current_tab", 1 /* Collection tab */ ).toInt());
ui_->tabs->setCurrentIndex(settings_.value("current_tab", 1 /* Collection tab */ ).toInt());
FancyTabWidget::Mode default_mode = FancyTabWidget::Mode_LargeSidebar;
ui_->tabs->SetMode(FancyTabWidget::Mode(settings_.value("tab_mode", default_mode).toInt()));
file_view_->SetPath(settings_.value("file_path", QDir::homePath()).toString());
@ -842,7 +841,7 @@ void MainWindow::resizeEvent(QResizeEvent*) { SaveGeometry(); }
void MainWindow::TabSwitched() {
if (ui_->tabs->current_index() > 0)
if (ui_->tabs->currentIndex() > 0)
ui_->now_playing->SetEnabled();
else
ui_->now_playing->SetDisabled();
@ -860,7 +859,7 @@ void MainWindow::SaveGeometry() {
settings_.setValue("geometry", saveGeometry());
}
settings_.setValue("splitter_state", ui_->splitter->saveState());
settings_.setValue("current_tab", ui_->tabs->current_index());
settings_.setValue("current_tab", ui_->tabs->currentIndex());
settings_.setValue("tab_mode", ui_->tabs->mode());
}
@ -2229,7 +2228,7 @@ void MainWindow::HandleNotificationPreview(OSD::Behaviour type, QString line1, Q
}
void MainWindow::FocusCollectionTab() {
ui_->tabs->SetCurrentWidget(collection_view_);
ui_->tabs->setCurrentWidget(collection_view_);
}
void MainWindow::ShowConsole() {

View File

@ -401,6 +401,7 @@ void FancyTabBar::mousePressEvent(QMouseEvent *e)
}
void FancyTabBar::addTab(const QIcon& icon, const QString& label) {
FancyTab *tab = new FancyTab(this);
tab->icon = icon;
tab->text = label;
@ -551,7 +552,7 @@ FancyTabWidget::FancyTabWidget(QWidget* parent)
setLayout(main_layout);
}
void FancyTabWidget::AddTab(QWidget* tab, const QIcon& icon, const QString& label) {
void FancyTabWidget::addTab(QWidget* tab, const QIcon& icon, const QString& label) {
stack_->addWidget(tab);
items_ << Item(icon, label);
}
@ -594,11 +595,11 @@ void FancyTabWidget::paintEvent(QPaintEvent*) {
painter.drawLine(rect.bottomLeft(), rect.bottomRight());
}
int FancyTabWidget::current_index() const {
int FancyTabWidget::currentIndex() const {
return stack_->currentIndex();
}
void FancyTabWidget::SetCurrentIndex(int index) {
void FancyTabWidget::setCurrentIndex(int index) {
if (FancyTabBar* bar = qobject_cast<FancyTabBar*>(tab_bar_)) {
bar->setCurrentIndex(index);
} else if (QTabBar* bar = qobject_cast<QTabBar*>(tab_bar_)) {
@ -608,8 +609,8 @@ void FancyTabWidget::SetCurrentIndex(int index) {
}
}
void FancyTabWidget::SetCurrentWidget(QWidget* widget) {
SetCurrentIndex(stack_->indexOf(widget));
void FancyTabWidget::setCurrentWidget(QWidget* widget) {
setCurrentIndex(stack_->indexOf(widget));
}
void FancyTabWidget::ShowWidget(int index) {
@ -617,7 +618,7 @@ void FancyTabWidget::ShowWidget(int index) {
emit CurrentChanged(index);
}
void FancyTabWidget::AddBottomWidget(QWidget* widget) {
void FancyTabWidget::addBottomWidget(QWidget* widget) {
top_layout_->addWidget(widget);
}

View File

@ -191,18 +191,18 @@ class FancyTabWidget : public QWidget {
int spacer_size_;
};
void AddTab(QWidget *tab, const QIcon &icon, const QString &label);
void addTab(QWidget *tab, const QIcon &icon, const QString &label);
void AddSpacer(int size = 40);
void SetBackgroundPixmap(const QPixmap &pixmap);
void AddBottomWidget(QWidget *widget);
void addBottomWidget(QWidget *widget);
int current_index() const;
int currentIndex() const;
Mode mode() const { return mode_; }
public slots:
void SetCurrentIndex(int index);
void SetCurrentWidget(QWidget *widget);
void setCurrentIndex(int index);
void setCurrentWidget(QWidget *widget);
void SetMode(Mode mode);
void SetMode(int mode) { SetMode(Mode(mode)); }

View File

@ -150,7 +150,7 @@ void StatusView::CreateWidget() {
//qLog(Debug) << __PRETTY_FUNCTION__;
setLayout(layout_);
setStyleSheet("background-color: white;");
//setStyleSheet("background-color: white;");
layout_->setSizeConstraint(QLayout::SetMinAndMaxSize);
layout_->setContentsMargins(0, 0, 0, 0);