From 2dbfe0e530717316ff39dce6c0d41332d1d797d0 Mon Sep 17 00:00:00 2001 From: birkeh Date: Sun, 23 Oct 2016 21:22:41 +0200 Subject: [PATCH] Init --- ckodilibrary.cpp | 11 ++ ckodilibrary.h | 4 + ckodivideolibrary.cpp | 14 ++ ckodivideolibrary.h | 4 + cmainwindow.cpp | 1 + cmoviewidget.cpp | 32 ++++- cmoviewidget.h | 14 +- cmoviewidget.ui | 18 +-- cmyvideos.cpp | 10 ++ cmyvideos.h | 3 + hchn44uj.r5o.txt | 15 ++ qtKodiDB.pro.user | 318 ++++++++++++++++++++++++++++++++++++++++++ 12 files changed, 428 insertions(+), 16 deletions(-) create mode 100644 hchn44uj.r5o.txt create mode 100644 qtKodiDB.pro.user diff --git a/ckodilibrary.cpp b/ckodilibrary.cpp index 5830686..c1ae0a1 100644 --- a/ckodilibrary.cpp +++ b/ckodilibrary.cpp @@ -65,3 +65,14 @@ bool cKodiLibrary::init() return(iVideoCount != 0); } + +cKodiVideoLibrary* cKodiLibrary::videoLibrary() +{ + return(m_lpKodiVideoLibrary); +} + +void cKodiLibrary::fillVideoList(QStandardItemModel* lpModel) +{ + if(m_lpKodiVideoLibrary) + m_lpKodiVideoLibrary->fillVideoList(lpModel); +} diff --git a/ckodilibrary.h b/ckodilibrary.h index acb4dca..012e755 100644 --- a/ckodilibrary.h +++ b/ckodilibrary.h @@ -5,6 +5,7 @@ #include "ckodivideolibrary.h" #include +#include class cKodiLibrary @@ -14,6 +15,9 @@ public: ~cKodiLibrary(); bool init(); + + cKodiVideoLibrary* videoLibrary(); + void fillVideoList(QStandardItemModel* lpModel); private: QStatusBar* m_lpMainWindowStatusBar; cKodiVideoLibrary* m_lpKodiVideoLibrary; diff --git a/ckodivideolibrary.cpp b/ckodivideolibrary.cpp index ca52bed..962176b 100644 --- a/ckodivideolibrary.cpp +++ b/ckodivideolibrary.cpp @@ -108,3 +108,17 @@ qint32 cKodiVideoLibrary::load() } return(m_videosList.count()); } + +void cKodiVideoLibrary::fillVideoList(QStandardItemModel* lpModel) +{ + for(int z = 0;z < m_videosList.count();z++) + { + cMyVideos* lpVideos = m_videosList.at(z); + + QStandardItem* lpItem = new QStandardItem(lpVideos->localMovieTitle()); +// QVariant v = qVariantFromValue(lpMovie); +// lpItem->setData(v, Qt::UserRole); + lpModel->appendRow(lpItem); + } +// ui->m_lpMovies->sortByColumn(0, Qt::AscendingOrder); +} diff --git a/ckodivideolibrary.h b/ckodivideolibrary.h index affd746..b90df6f 100644 --- a/ckodivideolibrary.h +++ b/ckodivideolibrary.h @@ -8,6 +8,8 @@ #include #include +#include + class cKodiVideoLibrary { @@ -19,6 +21,8 @@ public: qint16 version(); qint32 load(); + + void fillVideoList(QStandardItemModel* lpModel); private: QSqlDatabase m_db; QString m_szFileName; diff --git a/cmainwindow.cpp b/cmainwindow.cpp index 85f90ce..baa9ed9 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -61,4 +61,5 @@ void cMainWindow::initDB() { m_lpKodiLibrary = new cKodiLibrary(ui->m_lpStatusBar, QDir::homePath() + QDir::separator() + QString(".kodi")); m_lpKodiLibrary->init(); + m_lpMovieWidget->setLibrary(m_lpKodiLibrary->videoLibrary()); } diff --git a/cmoviewidget.cpp b/cmoviewidget.cpp index 9ed0558..46a024d 100644 --- a/cmoviewidget.cpp +++ b/cmoviewidget.cpp @@ -1,14 +1,42 @@ #include "cmoviewidget.h" #include "ui_cmoviewidget.h" + cMovieWidget::cMovieWidget(QWidget *parent) : QWidget(parent), - ui(new Ui::cMovieWidget) + ui(new Ui::cMovieWidget), + m_lpMovieModel(0) { - ui->setupUi(this); + initUI(); } cMovieWidget::~cMovieWidget() { + if(m_lpMovieModel) + delete m_lpMovieModel; + delete ui; } + +void cMovieWidget::initUI() +{ + ui->setupUi(this); + + m_lpMovieModel = new QStandardItemModel(0, 2); + QStringList headerLabels = QStringList() << tr("Movie") << tr("Year"); + m_lpMovieModel->setHorizontalHeaderLabels(headerLabels); + ui->m_lpMovieView->setModel(m_lpMovieModel); +} + +void cMovieWidget::setLibrary(cKodiVideoLibrary* lpLibrary) +{ + m_lpLibrary = lpLibrary; + showList(); +} + +void cMovieWidget::showList() +{ + m_lpMovieModel->clear(); + + m_lpLibrary->fillVideoList(m_lpMovieModel); +} diff --git a/cmoviewidget.h b/cmoviewidget.h index f99d25a..bccaf5e 100644 --- a/cmoviewidget.h +++ b/cmoviewidget.h @@ -1,12 +1,18 @@ #ifndef CMOVIEWIDGET_H #define CMOVIEWIDGET_H + +#include "ckodivideolibrary.h" + #include +#include + namespace Ui { class cMovieWidget; } + class cMovieWidget : public QWidget { Q_OBJECT @@ -15,8 +21,14 @@ public: explicit cMovieWidget(QWidget *parent = 0); ~cMovieWidget(); + void setLibrary(cKodiVideoLibrary* lpLibrary); private: - Ui::cMovieWidget *ui; + Ui::cMovieWidget* ui; + QStandardItemModel* m_lpMovieModel; + cKodiVideoLibrary* m_lpLibrary; + + void initUI(); + void showList(); }; #endif // CMOVIEWIDGET_H diff --git a/cmoviewidget.ui b/cmoviewidget.ui index 9b33a0d..5f442e5 100644 --- a/cmoviewidget.ui +++ b/cmoviewidget.ui @@ -13,19 +13,11 @@ Form - - - - 100 - 80 - 47 - 13 - - - - Movie - - + + + + + diff --git a/cmyvideos.cpp b/cmyvideos.cpp index 5bd5452..553d0f2 100644 --- a/cmyvideos.cpp +++ b/cmyvideos.cpp @@ -39,3 +39,13 @@ cMyVideos* cMyVideosList::add(qint32 idMovie, qint32 idFile, const QString& szLo append(lpNew); return(lpNew); } + +QString cMyVideos::localMovieTitle() +{ + return(m_szLocalMovieTitle); +} + +qint32 cMyVideos::yearReleased() +{ + return(m_iYearReleased); +} diff --git a/cmyvideos.h b/cmyvideos.h index 4a48395..757995f 100644 --- a/cmyvideos.h +++ b/cmyvideos.h @@ -20,6 +20,9 @@ public: const QString& szCountry, const QString& szFilePath, qint32 idPath, qint32 idSet, qint32 iUserrating, const QString& szSet, const QString& szSetOverview, const QString& szFileName, const QString& szPathURL, qint32 iPlayCount, const QDateTime& lastPlayed, const QDateTime& dateAdded, qreal dResumeTimeInSeconds, qreal dTotalTimeInSeconds); + + QString localMovieTitle(); + qint32 yearReleased(); private: qint32 m_idMovie; qint32 m_idFile; diff --git a/hchn44uj.r5o.txt b/hchn44uj.r5o.txt new file mode 100644 index 0000000..c823afd --- /dev/null +++ b/hchn44uj.r5o.txt @@ -0,0 +1,15 @@ + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# Explicit paths specified without -i or -o; assuming --only paths... +# On branch master +# Your branch is ahead of 'origin/master' by 1 commit. +# (use "git push" to publish your local commits) +# +# Changes to be committed: +# new file: README.md +# +# Untracked files: +# qtKodiDB.pro.user +# + diff --git a/qtKodiDB.pro.user b/qtKodiDB.pro.user new file mode 100644 index 0000000..9107ad3 --- /dev/null +++ b/qtKodiDB.pro.user @@ -0,0 +1,318 @@ + + + + + + EnvironmentId + {90551da6-f083-4f65-96d6-4435a4c6527f} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.7.0 MinGW 32bit3 + Desktop Qt 5.7.0 MinGW 32bit3 + qt.57.win32_mingw53_kit + 0 + 0 + 0 + + C:/Users/birkeh/Documents/GitHub/build-qtKodiDB-Desktop_Qt_5_7_0_MinGW_32bit3-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + C:/Users/birkeh/Documents/GitHub/build-qtKodiDB-Desktop_Qt_5_7_0_MinGW_32bit3-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + C:/Users/birkeh/Documents/GitHub/build-qtKodiDB-Desktop_Qt_5_7_0_MinGW_32bit3-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy locally + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + qtKodiDB + + Qt4ProjectManager.Qt4RunConfiguration:C:/Users/birkeh/Documents/GitHub/qtKodiDB/qtKodiDB.pro + true + + qtKodiDB.pro + false + + C:/Users/birkeh/Documents/GitHub/build-qtKodiDB-Desktop_Qt_5_7_0_MinGW_32bit3-Debug + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + +