Skip to content

Commit

Permalink
CD favorites. GH #308.
Browse files Browse the repository at this point in the history
  • Loading branch information
textbrowser committed Jul 18, 2023
1 parent 31b2f0b commit e5550be
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 3 deletions.
Binary file modified Data/BiblioteQ.sqlite
Binary file not shown.
5 changes: 5 additions & 0 deletions Documentation/Release-Notes.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<html>
<body>
<u>Release Notes</u>
<p>July 20, 2023.</p>
<ul>
<li>Database Enumerations defaults: CDs. Favorites are prepared
for new CDs and searches. <b>GitHub ticket #308.</b></li>
</ul>
<p>July 15, 2023.</p>
<ul>
<li>Database Enumerations defaults: books. Favorites are prepared
Expand Down
15 changes: 15 additions & 0 deletions Source/biblioteq_cd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include <QFileDialog>
#include <QScrollBar>
#include <QSettings>
#include <QShortcut>
#include <QSqlField>
#include <QSqlRecord>
Expand Down Expand Up @@ -367,6 +368,7 @@ void biblioteq_cd::insert(void)
setWindowTitle(tr("BiblioteQ: Create Music CD Entry"));
m_engWindowTitle = "Create";
cd.id->setFocus();
prepareFavorites();
storeData(this);
#ifdef Q_OS_ANDROID
showMaximized();
Expand Down Expand Up @@ -656,6 +658,18 @@ void biblioteq_cd::modify(const int state)
raise();
}

void biblioteq_cd::prepareFavorites(void)
{
QSettings settings;

cd.format->setCurrentIndex
(cd.format->findText(settings.value("cd_formats_favorite").
toString().trimmed()));

if(cd.format->currentIndex() < 0)
cd.format->setCurrentIndex(0);
}

void biblioteq_cd::search(const QString &field, const QString &value)
{
m_composer_action->setVisible(true);
Expand Down Expand Up @@ -700,6 +714,7 @@ void biblioteq_cd::search(const QString &field, const QString &value)
cd.format->setCurrentIndex(0);
cd.accession_number->clear();
m_engWindowTitle = "Search";
prepareFavorites();

if(field.isEmpty() && value.isEmpty())
{
Expand Down
1 change: 1 addition & 0 deletions Source/biblioteq_cd.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class biblioteq_cd: public QMainWindow, public biblioteq_item
Ui_tracksDialog trd;
void changeEvent(QEvent *event);
void closeEvent(QCloseEvent *event);
void prepareFavorites(void);

private slots:
void setGlobalFonts(const QFont &font);
Expand Down
7 changes: 6 additions & 1 deletion Source/biblioteq_dbenumerations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ void biblioteq_dbenumerations::clear(void)
m_ui.bc_favorite->clear();
m_ui.bo_favorite->clear();
m_ui.bta_favorite->clear();
m_ui.cdf_favorite->clear();

foreach(auto listwidget, findChildren<QListWidget *> ())
listwidget->clear();
Expand Down Expand Up @@ -322,6 +323,7 @@ void biblioteq_dbenumerations::populateWidgets(void)
}
else if(str == "cd_formats")
{
combobox = m_ui.cdf_favorite;
list = biblioteq_misc_functions::getCDFormats
(qmain->getDB(), errorstr);
listwidget = m_ui.cdFormatsList;
Expand Down Expand Up @@ -883,7 +885,10 @@ void biblioteq_dbenumerations::slotSave(void)
listwidget = m_ui.bookTargetAudiences;
}
else if(tables.at(i) == "cd_formats")
listwidget = m_ui.cdFormatsList;
{
combobox = m_ui.cdf_favorite;
listwidget = m_ui.cdFormatsList;
}
else if(tables.at(i) == "dvd_aspect_ratios")
listwidget = m_ui.dvdAspectRatiosList;
else if(tables.at(i) == "dvd_ratings")
Expand Down
36 changes: 34 additions & 2 deletions UI/biblioteq_dbenumerations.ui
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-558</y>
<y>-770</y>
<width>497</width>
<height>3658</height>
<height>3702</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
Expand Down Expand Up @@ -740,6 +740,37 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_21">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Favorite</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cdf_favorite">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_34">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QListWidget" name="cdFormatsList">
<property name="minimumSize">
Expand Down Expand Up @@ -2176,6 +2207,7 @@
<tabstop>bookTargetAudiences</tabstop>
<tabstop>addBookTargetAudience</tabstop>
<tabstop>removeBookTargetAudience</tabstop>
<tabstop>cdf_favorite</tabstop>
<tabstop>cdFormatsList</tabstop>
<tabstop>addCdFormat</tabstop>
<tabstop>removeCdFormat</tabstop>
Expand Down

0 comments on commit e5550be

Please sign in to comment.