diff --git a/cmainwindow.cpp b/cmainwindow.cpp index b7313f5..c4e5d38 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -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 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); diff --git a/cmainwindow.h b/cmainwindow.h index 17cdd1d..c2c718c 100644 --- a/cmainwindow.h +++ b/cmainwindow.h @@ -21,6 +21,8 @@ #include +#include + 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(); diff --git a/cmainwindow.ui b/cmainwindow.ui index 5da6c0e..8f9652c 100644 --- a/cmainwindow.ui +++ b/cmainwindow.ui @@ -26,87 +26,140 @@ - - - Qt::Horizontal - - - 0 - - - - - 1 - 0 - - - - Qt::CustomContextMenu - - - Qt::LeftToRight - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOn - - - QAbstractItemView::NoEditTriggers - - - true - - - QAbstractItemView::ExtendedSelection - - - false - - - true - - - 37 - - - false - - - - - - 4 - 0 - - - - Qt::CustomContextMenu - - - Qt::ScrollBarAsNeeded - - - Qt::ScrollBarAlwaysOn - - - QAbstractItemView::NoEditTriggers - - - true - - - QAbstractItemView::ExtendedSelection - - - false - - - true - - - + + + + + + + Qt::Horizontal + + + 0 + + + + + 1 + 0 + + + + Qt::CustomContextMenu + + + Qt::LeftToRight + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOn + + + QAbstractItemView::NoEditTriggers + + + true + + + QAbstractItemView::ExtendedSelection + + + false + + + true + + + 37 + + + false + + + + + + 4 + 0 + + + + Qt::CustomContextMenu + + + Qt::ScrollBarAsNeeded + + + Qt::ScrollBarAlwaysOn + + + QAbstractItemView::NoEditTriggers + + + true + + + QAbstractItemView::ExtendedSelection + + + false + + + true + + + + + + + + + + + + Series: + + + + + + + 0 + + + + + + + Episodes: + + + + + + + 0 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + @@ -140,6 +193,37 @@ + + + + + + Movies: + + + + + + + 0 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + diff --git a/cmoviesearch.cpp b/cmoviesearch.cpp index dfdfe77..2195171 100644 --- a/cmoviesearch.cpp +++ b/cmoviesearch.cpp @@ -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(); +} diff --git a/cmoviesearch.h b/cmoviesearch.h index 2e29268..f0d386a 100644 --- a/cmoviesearch.h +++ b/cmoviesearch.h @@ -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; diff --git a/csearch.cpp b/csearch.cpp index 1fea3b3..550d682 100644 --- a/csearch.cpp +++ b/csearch.cpp @@ -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(); +} diff --git a/csearch.h b/csearch.h index 087b357..490698e 100644 --- a/csearch.h +++ b/csearch.h @@ -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; diff --git a/csearch.ui b/csearch.ui index d2ea5d4..7ed8a4d 100644 --- a/csearch.ui +++ b/csearch.ui @@ -27,7 +27,7 @@ - 1 + 0