Shortcut for "add"

This commit is contained in:
2017-10-22 16:10:06 +02:00
parent 2cd19d8808
commit 9bd2b5552b
8 changed files with 227 additions and 86 deletions
+35 -4
View File
@@ -75,7 +75,8 @@ cMainWindow::cMainWindow(QWidget *parent) :
m_lpMessageDialog(0),
m_lpUpdateThread(0),
m_lpPicturesThread(0),
m_bProcessing(false)
m_bProcessing(false),
m_lpShortcut(0)
{
m_timer.start();
@@ -85,7 +86,7 @@ cMainWindow::cMainWindow(QWidget *parent) :
lpDialog->show();
ui->setupUi(this);
ui->m_lpMainTab->setCurrentWidget(0);
ui->m_lpMainTab->setCurrentIndex(0);
m_lpSeriesListModel = new QStandardItemModel(0, 3);
initDB();
@@ -142,10 +143,16 @@ cMainWindow::cMainWindow(QWidget *parent) :
connect(ui->m_lpSeriesList1->verticalScrollBar(), &QScrollBar::valueChanged, this, &cMainWindow::scrollbarValueChanged1);
connect(ui->m_lpSeriesList2->verticalScrollBar(), &QScrollBar::valueChanged, this, &cMainWindow::scrollbarValueChanged2);
m_lpShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_A), this, SLOT(onActionAddGlobal()));
m_lpShortcut->setAutoRepeat(false);
}
cMainWindow::~cMainWindow()
{
if(m_lpShortcut)
delete m_lpShortcut;
delete ui;
}
@@ -392,8 +399,11 @@ void cMainWindow::displaySeries()
{
m_lpSeriesListModel->clear();
qint16 iMin = m_serieList.minSeason();
qint16 iMax = m_serieList.maxSeason();
qint16 iMin = m_serieList.minSeason();
qint16 iMax = m_serieList.maxSeason();
qint16 iSeries = 0;
qint16 iEpisodes = 0;
m_lpSeriesListModel->setColumnCount(iMax-iMin+2);
@@ -417,6 +427,8 @@ void cMainWindow::displaySeries()
for(int serie = 0;serie < m_serieList.count();serie++)
{
iSeries++;
QList<QStandardItem*> lpItems;
for(int z = 0;z < header.count();z++)
@@ -452,6 +464,8 @@ void cMainWindow::displaySeries()
for(int y = 0;y < lpSeason->episodeList().count();y++)
{
iEpisodes++;
if(lpSeason->episodeList().at(y)->state() == cEpisode::StateInit)
{
if(szInit.isEmpty())
@@ -598,10 +612,15 @@ void cMainWindow::displaySeries()
ui->m_lpSeriesList2->setColumnHidden(0, true);
ui->m_lpSeriesList2->setColumnHidden(1, true);
ui->m_lpSeriesList2->setColumnHidden(2, true);
ui->m_lpSeriesCount->setText(QString("%1").arg(iSeries));
ui->m_lpEpisodesCount->setText(QString("%1").arg(iEpisodes));
}
void cMainWindow::displayMovies()
{
qint16 iMovies = 0;
m_lpMoviesListModel->clear();
m_lpMoviesListModel->setColumnCount(1);
@@ -615,6 +634,8 @@ void cMainWindow::displayMovies()
for(int x = 0;x < m_movieList.count();x++)
{
iMovies++;
cMovie* lpMovie = m_movieList.at(x);
if(lpMovie->belongsToCollection() != szOldCollection)
@@ -637,6 +658,8 @@ void cMainWindow::displayMovies()
else
m_lpMoviesListModel->appendRow(lpItem);
}
ui->m_lpMoviesCount->setText(QString("%1").arg(iMovies));
}
void cMainWindow::on_m_lpSeriesList1_customContextMenuRequested(const QPoint &pos)
@@ -856,6 +879,14 @@ bool cMainWindow::runMovieEdit(cMovie *lpMovie)
return(true);
}
void cMainWindow::onActionAddGlobal()
{
if(ui->m_lpMainTab->currentIndex() == 0)
onActionAdd();
else
onActionMovieAdd();
}
void cMainWindow::onActionAdd()
{
cSearch* lpSearch = new cSearch(this);
+6
View File
@@ -21,6 +21,8 @@
#include <QTreeView>
#include <QShortcut>
namespace Ui {
class cMainWindow;
@@ -66,6 +68,8 @@ private slots:
void onActionMovieGotoIMDB();
void onActionMovieLoadPictures();
void onActionAddGlobal();
void updateMessage(const QString& szMessage, const qint32 &iProgress);
void updateAppendMessage(const QString& szMessage);
void updateDone();
@@ -99,6 +103,8 @@ private:
bool m_bProcessing;
QShortcut* m_lpShortcut;
void initDB();
void loadDB();
void loadSeriesDB();
+165 -81
View File
@@ -26,87 +26,140 @@
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QSplitter" name="m_lpSplitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="handleWidth">
<number>0</number>
</property>
<widget class="QTreeView" name="m_lpSeriesList1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<attribute name="headerMinimumSectionSize">
<number>37</number>
</attribute>
<attribute name="headerStretchLastSection">
<bool>false</bool>
</attribute>
</widget>
<widget class="QTreeView" name="m_lpSeriesList2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>4</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
</widget>
</widget>
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,0">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QSplitter" name="m_lpSplitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="handleWidth">
<number>0</number>
</property>
<widget class="QTreeView" name="m_lpSeriesList1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<attribute name="headerMinimumSectionSize">
<number>37</number>
</attribute>
<attribute name="headerStretchLastSection">
<bool>false</bool>
</attribute>
</widget>
<widget class="QTreeView" name="m_lpSeriesList2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>4</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Series:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_lpSeriesCount">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Episodes:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_lpEpisodesCount">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<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>
</layout>
</item>
</layout>
</widget>
@@ -140,6 +193,37 @@
</attribute>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Movies:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_lpMoviesCount">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<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>
</layout>
</widget>
</widget>
+8
View File
@@ -19,6 +19,8 @@ cMovieSearch::cMovieSearch(QWidget *parent) :
ui->m_lpTabWidget->setCurrentIndex(0);
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
ui->m_lpSearch->setFocus();
ui->m_lpSearchButton->setDefault(true);
}
cMovieSearch::~cMovieSearch()
@@ -145,3 +147,9 @@ void cMovieSearch::setButtonBox()
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
}
void cMovieSearch::on_m_lpResults_doubleClicked(const QModelIndex &index)
{
if(index.isValid())
accept();
}
+2
View File
@@ -30,6 +30,8 @@ private slots:
void on_m_lpResults_clicked(const QModelIndex &index);
void on_m_lpResults_doubleClicked(const QModelIndex &index);
private:
Ui::cMovieSearch *ui;
+8
View File
@@ -18,6 +18,8 @@ cSearch::cSearch(QWidget *parent) :
ui->m_lpTabWidget->setCurrentIndex(0);
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
ui->m_lpSearch->setFocus();
ui->m_lpSearchButton->setDefault(true);
}
cSearch::~cSearch()
@@ -129,3 +131,9 @@ void cSearch::setButtonBox()
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
}
void cSearch::on_m_lpResults_doubleClicked(const QModelIndex &index)
{
if(index.isValid())
accept();
}
+2
View File
@@ -29,6 +29,8 @@ private slots:
void on_m_lpPlaceholderName_textChanged(const QString &arg1);
void on_m_lpYear_valueChanged(int arg1);
void on_m_lpResults_doubleClicked(const QModelIndex &index);
private:
Ui::cSearch *ui;
+1 -1
View File
@@ -27,7 +27,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="m_lpTabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="Search">
<attribute name="title">