cantata: update to 3.2.1.

This commit is contained in:
rooyca 2024-08-02 19:59:29 -05:00 committed by classabbyamp
parent cb77db9a85
commit eb567953ad
2 changed files with 775 additions and 15 deletions

View File

@ -0,0 +1,757 @@
From 740089b05a6dcb95ee442a2e370c2b795a518d97 Mon Sep 17 00:00:00 2001
From: Citlali del Rey <nullobsi@unix.dog>
Date: Wed, 7 Aug 2024 13:58:11 -0700
Subject: [PATCH 1/4] feat: add checkbox to initial settings ui
---
gui/initialsettingswizard.ui | 158 +++++++++++++++++++++--------------
1 file changed, 93 insertions(+), 65 deletions(-)
diff --git a/gui/initialsettingswizard.ui b/gui/initialsettingswizard.ui
index 91fd30ea..661fafe4 100644
--- a/gui/initialsettingswizard.ui
+++ b/gui/initialsettingswizard.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>668</width>
- <height>607</height>
+ <width>1007</width>
+ <height>855</height>
</rect>
</property>
<property name="windowTitle">
@@ -38,7 +38,6 @@
<widget class="QLabel" name="label">
<property name="font">
<font>
- <weight>75</weight>
<bold>true</bold>
</font>
</property>
@@ -50,10 +49,10 @@
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
+ <enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -69,20 +68,20 @@
<string>&lt;p&gt;Cantata is a feature-rich and user friendly client for Music Player Daemon (MPD). MPD is a flexible, powerful, server-side application for playing music.&lt;/p&gt;&lt;p&gt;For more information on MPD itself, please refer to the MPD website &lt;a href=&quot;http://www.musicpd.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.musicpd.org&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;This 'wizard' will guide you through the basic settings required for Cantata to function correctly.&lt;/p&gt;</string>
</property>
<property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
- <set>Qt::NoTextInteraction</set>
+ <set>Qt::TextInteractionFlag::NoTextInteraction</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -100,7 +99,6 @@
<widget class="QLabel" name="label_7">
<property name="font">
<font>
- <weight>75</weight>
<bold>true</bold>
</font>
</property>
@@ -108,17 +106,17 @@
<string>&lt;p&gt;Welcome to Cantata&lt;/p&gt;</string>
</property>
<property name="textInteractionFlags">
- <set>Qt::NoTextInteraction</set>
+ <set>Qt::TextInteractionFlag::NoTextInteraction</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_11">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
+ <enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -134,13 +132,13 @@
<string>&lt;p&gt;Cantata is a feature-rich and user friendly client for Music Player Daemon (MPD). MPD is a flexible, powerful, server-side application for playing music. MPD may be started either system-wide, or on a per-user basis.&lt;br/&gt;&lt;br/&gt;Please select how you would like to have Cantata initially connect to (or startup) MPD:&lt;/p&gt;</string>
</property>
<property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
- <set>Qt::NoTextInteraction</set>
+ <set>Qt::TextInteractionFlag::NoTextInteraction</set>
</property>
</widget>
</item>
@@ -172,7 +170,7 @@
<string>&lt;i&gt;Select this option if your music collection is shared between users, your MPD instance is running on another machine, you already have a personal MPD setup, or you wish to enable access from other clients (e.g. MPDroid). If you select this option then Cantata itself cannot control the starting and stopping of the MPD server. You will therefore need to ensure that MPD is already configured and running.&lt;/i&gt;</string>
</property>
<property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -185,10 +183,10 @@
<item row="2" column="2">
<spacer name="verticalSpacer_10">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
+ <enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -217,7 +215,7 @@
<string>&lt;i&gt;Select this option if your music collection is not shared with others, and you wish Cantata to configure and control the MPD instance. This setup will be exclusive to Cantata, and will &lt;b&gt;not&lt;/b&gt; be accessible to other MPD clients (e.g. MPDroid)&lt;/i&gt;</string>
</property>
<property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -233,17 +231,17 @@
<item>
<widget class="NoteLabel" name="musicFolderNoteLabel_2">
<property name="text">
- <string>If you wish to have an advanced MPD setup (e.g. multiple audio outputs, full DSD support, etc) then you &lt;b&gt;must&lt;/b&gt; choose 'Standard'</string>
+ <string>If you wish to have an advanced MPD setup (e.g. multiple audio outputs, full DSD support, etc) then you &lt;b&gt;must&lt;/b&gt; choose 'Standard'</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_13">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
+ <enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -259,20 +257,20 @@
<string>For more information on MPD itself, please refer to the MPD website &lt;a href=&quot;http://www.musicpd.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.musicpd.org&lt;/span&gt;&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;This 'wizard' will guide you through the basic settings required for Cantata to function correctly.</string>
</property>
<property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
- <set>Qt::NoTextInteraction</set>
+ <set>Qt::TextInteractionFlag::NoTextInteraction</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_12">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -286,6 +284,45 @@
</widget>
</widget>
</item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_7">
+ <item>
+ <widget class="QCheckBox" name="migrateDataBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Migrate data from older versions of Cantata</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="BuddyLabel" name="migrateDataBoxLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="mouseTracking">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>&lt;i&gt;Data from Cantata v2 has been detected on your computer. Leave this box checked to copy the old data and preserve your preferences.&lt;/i&gt;</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
<widget class="WizardPage" name="connectionPage">
@@ -313,7 +350,6 @@
<widget class="QLabel" name="label_3">
<property name="font">
<font>
- <weight>75</weight>
<bold>true</bold>
</font>
</property>
@@ -325,10 +361,10 @@
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
+ <enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -344,7 +380,7 @@
<string>The settings below are the basic settings required by Cantata. Please enter the relevant details, and use the 'Connect' button to test the connection.</string>
</property>
<property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -354,10 +390,10 @@
<item>
<spacer name="verticalSpacer_7">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
+ <enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -370,7 +406,7 @@
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
- <enum>QFormLayout::ExpandingFieldsGrow</enum>
+ <enum>QFormLayout::FieldGrowthPolicy::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="BuddyLabel" name="hostLabel">
@@ -384,9 +420,6 @@
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="hostLayout">
- <property name="margin">
- <number>0</number>
- </property>
<item>
<widget class="LineEdit" name="host"/>
</item>
@@ -418,7 +451,7 @@
<item row="1" column="1">
<widget class="LineEdit" name="password">
<property name="echoMode">
- <enum>QLineEdit::Password</enum>
+ <enum>QLineEdit::EchoMode::Password</enum>
</property>
</widget>
</item>
@@ -441,7 +474,6 @@
<widget class="QLabel" name="statusLabel">
<property name="font">
<font>
- <weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
@@ -450,7 +482,7 @@
<string/>
</property>
<property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ <set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
@@ -459,7 +491,7 @@
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -488,7 +520,7 @@
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -506,7 +538,6 @@
<widget class="QLabel" name="label_13">
<property name="font">
<font>
- <weight>75</weight>
<bold>true</bold>
</font>
</property>
@@ -518,10 +549,10 @@
<item row="1" column="1">
<spacer name="verticalSpacer_16">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
+ <enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -537,7 +568,7 @@
<string>Please choose the folder containing your music collection.</string>
</property>
<property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -547,10 +578,10 @@
<item row="3" column="1">
<spacer name="verticalSpacer_18">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
+ <enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -580,7 +611,6 @@
<widget class="QLabel" name="statusLabel_2">
<property name="font">
<font>
- <weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
@@ -593,7 +623,7 @@
<item row="6" column="1">
<spacer name="verticalSpacer_14">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -615,7 +645,6 @@
<widget class="QLabel" name="label_6f">
<property name="font">
<font>
- <weight>75</weight>
<bold>true</bold>
</font>
</property>
@@ -627,10 +656,10 @@
<item>
<spacer name="verticalSpacer_9f">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
+ <enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -646,23 +675,23 @@
<string>&lt;p&gt;Cantata can download missing covers, and store these either in the music folder or within your personal cache folder.&lt;/p&gt;</string>
</property>
<property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
- <set>Qt::NoTextInteraction</set>
+ <set>Qt::TextInteractionFlag::NoTextInteraction</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_7x">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
+ <enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -696,7 +725,7 @@
<item>
<spacer name="verticalSpacer_8f">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -714,7 +743,6 @@
<widget class="QLabel" name="label_6">
<property name="font">
<font>
- <weight>75</weight>
<bold>true</bold>
</font>
</property>
@@ -726,10 +754,10 @@
<item row="1" column="1">
<spacer name="verticalSpacer_9">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
+ <enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -745,23 +773,23 @@
<string>Cantata is now configured!&lt;br/&gt;&lt;br/&gt;Cantata's configuration dialog maybe used to customise Cantata's appearance, as well as to add extra MPD hosts, etc.</string>
</property>
<property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
- <set>Qt::NoTextInteraction</set>
+ <set>Qt::TextInteractionFlag::NoTextInteraction</set>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer_6x">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
+ <enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -781,10 +809,10 @@
<item row="5" column="1">
<spacer name="verticalSpacer_6y">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
+ <enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -797,7 +825,7 @@
<item row="6" column="0" colspan="2">
<spacer name="verticalSpacer_8">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
From fcba26faceb401f63cabe5469276f3f8e067f211 Mon Sep 17 00:00:00 2001
From: Citlali del Rey <nullobsi@unix.dog>
Date: Wed, 7 Aug 2024 14:10:42 -0700
Subject: [PATCH 2/4] feat: make initial wizard skip to end when migrating
---
gui/initialsettingswizard.cpp | 16 ++++++++++++++++
gui/initialsettingswizard.h | 1 +
2 files changed, 17 insertions(+)
diff --git a/gui/initialsettingswizard.cpp b/gui/initialsettingswizard.cpp
index 18cb09db..7ef1fcb9 100644
--- a/gui/initialsettingswizard.cpp
+++ b/gui/initialsettingswizard.cpp
@@ -255,4 +255,20 @@ void InitialSettingsWizard::reject()
QDialog::reject();
}
+int InitialSettingsWizard::nextId() const {
+ switch(currentId()) {
+ case PAGE_INTRO:
+ if (migrateDataBox->isChecked()) {
+ return PAGE_END;
+ }
+ return PAGE_CONNECTION;
+ case PAGE_CONNECTION:
+ return PAGE_COVERS;
+ case PAGE_COVERS:
+ return PAGE_END;
+ default:
+ return -1;
+ }
+}
+
#include "moc_initialsettingswizard.cpp"
diff --git a/gui/initialsettingswizard.h b/gui/initialsettingswizard.h
index 4c27a73f..90e80984 100644
--- a/gui/initialsettingswizard.h
+++ b/gui/initialsettingswizard.h
@@ -56,6 +56,7 @@ private Q_SLOTS:
#endif
private:
+ int nextId() const override;
#ifdef Avahi_FOUND
QPushButton* discoveryButton;
#endif
From 61bad5e01b184f4b83a6211979fa201c1a6b55ea Mon Sep 17 00:00:00 2001
From: Citlali del Rey <nullobsi@unix.dog>
Date: Wed, 7 Aug 2024 15:43:05 -0700
Subject: [PATCH 3/4] feat: #30 migrate data from older cantata versions
---
gui/initialsettingswizard.cpp | 96 ++++++++++++++++++++++++++++++-----
gui/main.cpp | 1 +
2 files changed, 85 insertions(+), 12 deletions(-)
diff --git a/gui/initialsettingswizard.cpp b/gui/initialsettingswizard.cpp
index 7ef1fcb9..07150cc0 100644
--- a/gui/initialsettingswizard.cpp
+++ b/gui/initialsettingswizard.cpp
@@ -35,9 +35,11 @@
#include "findmpddialog.h"
#endif
#include <QDir>
+#include <QProcess>
#include <QScreen>
#include <QStandardPaths>
#include <QTimer>
+#include <filesystem>
enum Pages {
PAGE_INTRO,
@@ -113,6 +115,26 @@ InitialSettingsWizard::InitialSettingsWizard(QWidget* p)
hostLayout->insertWidget(hostLayout->count(), discoveryButton);
connect(discoveryButton, &QPushButton::clicked, this, &InitialSettingsWizard::detectMPDs);
#endif
+
+ // Note that this type of migration is only relevant on Linux/other
+ // Unix systems.
+#if !Q_OS_WIN && !Q_OS_MACOS
+ auto oldConfig = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/cantata");
+
+ if (oldConfig.exists()) {
+ migrateDataBox->setChecked(true);
+ }
+ else {
+ migrateDataBox->setChecked(false);
+ migrateDataBox->setDisabled(true);
+ migrateDataBoxLabel->setDisabled(true);
+ migrateDataBoxLabel->setText(tr("Data from an older version of Cantata is missing or cannot be located."));
+ }
+#else
+ migrateDataBox->hide();
+ migrateDataBoxLabel->hide();
+ migrateDataBox->setChecked(false);
+#endif
}
InitialSettingsWizard::~InitialSettingsWizard()
@@ -200,6 +222,55 @@ void InitialSettingsWizard::pageChanged(int p)
fetchCovers->setChecked(Settings::self()->fetchCovers());
}
}
+ if (PAGE_END == p) {
+ // Perform data migration.
+ if (migrateDataBox->isChecked()) {
+ auto oldConfig = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/cantata");
+ auto oldCache = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/cantata");
+ auto oldData = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/cantata");
+
+ auto newConfig = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/Cantata");
+ auto newCache = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/Cantata");
+ auto newData = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/Cantata");
+
+ newConfig.removeRecursively();
+ newCache.removeRecursively();
+ newData.removeRecursively();
+
+ auto copyOpts = std::filesystem::copy_options::overwrite_existing | std::filesystem::copy_options::recursive;
+
+ try {
+ std::filesystem::copy(oldConfig.absolutePath().toStdString(), newConfig.absolutePath().toStdString(), copyOpts);
+ std::filesystem::rename(newConfig.absolutePath().toStdString() + "/cantata.conf", newConfig.absolutePath().toStdString() + "/Cantata.conf");
+ }
+ catch (std::filesystem::filesystem_error& e) {
+ qWarning() << "Failed to migrate config.";
+ qWarning() << e.what();
+ }
+
+ try {
+ std::filesystem::copy(oldCache.absolutePath().toStdString(), newCache.absolutePath().toStdString(), copyOpts);
+ }
+ catch (std::filesystem::filesystem_error& e) {
+ qWarning() << "Failed to migrate cache.";
+ qWarning() << e.what();
+ }
+
+ try {
+ std::filesystem::copy(oldData.absolutePath().toStdString(), newData.absolutePath().toStdString(), copyOpts);
+ }
+ catch (std::filesystem::filesystem_error& e) {
+ qWarning() << "Failed to migrate data.";
+ qWarning() << e.what();
+ }
+
+ auto app = QCoreApplication::applicationFilePath();
+ auto args = QCoreApplication::arguments();
+ auto pwd = QDir::currentPath();
+ QProcess::startDetached(app, args, pwd);
+ QCoreApplication::exit();
+ }
+ }
button(NextButton)->setEnabled(PAGE_END != p);
}
@@ -255,19 +326,20 @@ void InitialSettingsWizard::reject()
QDialog::reject();
}
-int InitialSettingsWizard::nextId() const {
- switch(currentId()) {
- case PAGE_INTRO:
- if (migrateDataBox->isChecked()) {
- return PAGE_END;
- }
- return PAGE_CONNECTION;
- case PAGE_CONNECTION:
- return PAGE_COVERS;
- case PAGE_COVERS:
+int InitialSettingsWizard::nextId() const
+{
+ switch (currentId()) {
+ case PAGE_INTRO:
+ if (migrateDataBox->isChecked()) {
return PAGE_END;
- default:
- return -1;
+ }
+ return PAGE_CONNECTION;
+ case PAGE_CONNECTION:
+ return PAGE_COVERS;
+ case PAGE_COVERS:
+ return PAGE_END;
+ default:
+ return -1;
}
}
diff --git a/gui/main.cpp b/gui/main.cpp
index 7994920d..9e688fb9 100644
--- a/gui/main.cpp
+++ b/gui/main.cpp
@@ -437,6 +437,7 @@ int main(int argc, char* argv[])
if (QDialog::Rejected == wz.exec()) {
return 0;
}
+ Settings::self()->save();
}
else if (cmdLineParser.isSet(collectionOption)) {
QString col = cmdLineParser.value(collectionOption);
From a9741e33aa022df6fc44312694d79bd859676242 Mon Sep 17 00:00:00 2001
From: Citlali del Rey <nullobsi@unix.dog>
Date: Wed, 7 Aug 2024 15:49:29 -0700
Subject: [PATCH 4/4] fix: malformed preprocessor directive
---
gui/initialsettingswizard.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gui/initialsettingswizard.cpp b/gui/initialsettingswizard.cpp
index 07150cc0..d54f9264 100644
--- a/gui/initialsettingswizard.cpp
+++ b/gui/initialsettingswizard.cpp
@@ -118,7 +118,7 @@ InitialSettingsWizard::InitialSettingsWizard(QWidget* p)
// Note that this type of migration is only relevant on Linux/other
// Unix systems.
-#if !Q_OS_WIN && !Q_OS_MACOS
+#if !defined(Q_OS_WIN) && !defined(Q_OS_MACOS)
auto oldConfig = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/cantata");
if (oldConfig.exists()) {

View File

@ -1,20 +1,23 @@
# Template file for 'cantata' # Template file for 'cantata'
pkgname=cantata pkgname=cantata
version=2.5.0 version=3.2.1
revision=2 revision=1
build_style=cmake build_style=cmake
hostmakedepends="pkg-config qt5-qmake qt5-host-tools qt5-tools" configure_args="-DENABLE_HTTP_STREAM_PLAYBACK=ON -DENABLE_LIBVLC=OFF
makedepends="qt5-devel qt5-tools-devel qt5-svg-devel qt5-xmlpatterns-devel -DENABLE_SIMPLE_MPD_SUPPORT=ON"
qt5-plugin-mysql qt5-plugin-pgsql qt5-plugin-sqlite qt5-plugin-odbc hostmakedepends="pkg-config qt6-tools qt6-base"
qt5-plugin-tds vlc-devel zlib-devel ffmpeg6-devel taglib-devel makedepends="qt6-multimedia-devel qt6-svg-devel"
taglib-extras-devel libmtp-devel mpg123-devel libcdparanoia-devel libcddb-devel depends="media-player-info avahi qt6-multimedia qt6-svg libmtp libcddb libmusicbrainz5 mpg123 udisks2"
speex-devel eudev-libudev-devel udisks2-devel libmusicbrainz5-devel
qt5-multimedia-devel libcdio-paranoia-devel"
depends="media-player-info qt5-plugin-sqlite"
short_desc="Qt client for the music player daemon (MPD)" short_desc="Qt client for the music player daemon (MPD)"
maintainer="LockeAnarchist <emanuel@openmailbox.org>" maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-3.0-or-later" license="GPL-3.0-or-later"
homepage="https://github.com/cdrummond/cantata" homepage="https://github.com/nullobsi/cantata"
changelog="https://raw.githubusercontent.com/CDrummond/cantata/master/ChangeLog" distfiles="https://github.com/nullobsi/cantata/archive/refs/tags/v${version}.tar.gz"
distfiles="https://github.com/CDrummond/cantata/releases/download/v${version}/${pkgname}-${version}.tar.bz2" checksum=ca38417f355a1eea475efcb73a383b433836caa74f542482d6b9e51a2fb70b0f
checksum=eb7e00ab3f567afaa02ea2c86e2fe811a475afab93182b95922c6eb126821724
CXXFLAGS="-Wno-error=sign-compare"
case "$XBPS_TARGET_MACHINE" in
aarch64*)
CXXFLAGS+=" -I${XBPS_CROSS_BASE}/usr/include/qt6" ;;
esac