This commit is contained in:
2016-10-20 13:51:28 +02:00
parent f73d6cd478
commit 0f2c75fe95
19 changed files with 276 additions and 12 deletions
+47
View File
@@ -0,0 +1,47 @@
#include <QBitmap>
#include <QStylePainter>
#include <QStyleOptionTab>
#include "cmaintabbar.h"
cMainTabBar::cMainTabBar(QWidget *parent)
: QTabBar(parent)
{
}
cMainTabBar::~cMainTabBar()
{
}
QSize cMainTabBar::tabSizeHint(int index) const
{
QSize s = QTabBar::tabSizeHint(index);
s.setHeight(80);
return(s);
}
void cMainTabBar::paintEvent(QPaintEvent*)
{
QStylePainter p(this);
for (int index = 0; index < count(); index++)
{
QStyleOptionTab tab;
initStyleOption(&tab, index);
QIcon tempIcon = tabIcon(index);
QString tempText = this->tabText(index);
QRect tabrect = tabRect(index);
tab.icon = QIcon();
tab.text = QString();
p.drawControl(QStyle::CE_TabBarTab, tab);
tempIcon.paint(&p, tabrect, Qt::AlignTop);
tabrect.adjust(0, 0, 0, -2);
p.drawText(tabrect, Qt::AlignBottom | Qt::AlignHCenter, tempText );
}
}
+22
View File
@@ -0,0 +1,22 @@
#ifndef CMAINTABBAR_H
#define CMAINTABBAR_H
#include <QTabBar>
#include <QIcon>
#include <QPainter>
class cMainTabBar : public QTabBar
{
Q_OBJECT
public:
cMainTabBar(QWidget *parent = Q_NULLPTR);
virtual ~cMainTabBar();
protected:
QSize tabSizeHint(int index) const;
void paintEvent(QPaintEvent *);
};
#endif // CMAINTABBAR_H
+9
View File
@@ -0,0 +1,9 @@
#include "cmaintabwidget.h"
#include "cmaintabbar.h"
cMainTabWidget::cMainTabWidget(QWidget *parent) :
QTabWidget(parent)
{
setTabBar(new cMainTabBar());
}
+14
View File
@@ -0,0 +1,14 @@
#ifndef CMAINTABWIDGET_H
#define CMAINTABWIDGET_H
#include <QTabWidget>
class cMainTabWidget : public QTabWidget
{
public:
cMainTabWidget(QWidget *parent = Q_NULLPTR);
};
#endif // CMAINTABWIDGET_H
+15 -4
View File
@@ -23,6 +23,12 @@ cMainWindow::~cMainWindow()
if(m_lpTVShowWidget)
delete m_lpTVShowWidget;
if(m_lpMusicWidget)
delete m_lpMusicWidget;
if(m_lpMusicVideoWidget)
delete m_lpMusicVideoWidget;
delete ui;
}
@@ -30,11 +36,16 @@ void cMainWindow::initUI()
{
ui->setupUi(this);
m_lpMovieWidget = new cMovieWidget(this);
m_lpTVShowWidget = new cTVShowWidget(this);
m_lpMovieWidget = new cMovieWidget(this);
m_lpTVShowWidget = new cTVShowWidget(this);
m_lpMusicWidget = new cMusicWidget(this);
m_lpMusicVideoWidget = new cMusicVideosWidget(this);
ui->m_lpMainTab->addTab(m_lpMovieWidget, QIcon(":/icons/Videos.ico"), "Movies");
ui->m_lpMainTab->addTab(m_lpTVShowWidget, QIcon(":/icons/TV Shows.ico"), "TV Shows");
ui->m_lpMainTab->addTab(m_lpMusicWidget, QIcon(":/icons/Musics.ico"), "Music");
ui->m_lpMainTab->addTab(m_lpMusicVideoWidget, QIcon(":/icons/Videos.ico"), "Music Videos");
ui->m_lpMainTab->addTab(m_lpMovieWidget, QIcon(":/icons/Videos.ico"), "");
ui->m_lpMainTab->addTab(m_lpTVShowWidget, QIcon(":/icons/TV Shows.ico"), "");
ui->m_lpMainTab->setCurrentIndex(0);
setWindowTitle("qtKodiAdmin");
+5
View File
@@ -4,6 +4,9 @@
#include "cmoviewidget.h"
#include "ctvshowwidget.h"
#include "cmusicwidget.h"
#include "cmusicvideoswidget.h"
#include "ckodilibrary.h"
#include <QMainWindow>
@@ -26,6 +29,8 @@ private:
Ui::cMainWindow* ui;
cMovieWidget* m_lpMovieWidget;
cTVShowWidget* m_lpTVShowWidget;
cMusicWidget* m_lpMusicWidget;
cMusicVideosWidget* m_lpMusicVideoWidget;
cKodiLibrary m_kodiLibrary;
void initUI();
+9 -1
View File
@@ -16,7 +16,7 @@
<widget class="QWidget" name="centralWidget">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTabWidget" name="m_lpMainTab">
<widget class="cMainTabWidget" name="m_lpMainTab">
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
@@ -57,6 +57,14 @@
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>cMainTabWidget</class>
<extends>QTabWidget</extends>
<header>cmaintabwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
+3 -3
View File
@@ -16,14 +16,14 @@
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>130</x>
<y>280</y>
<x>100</x>
<y>80</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
<string>Movie</string>
</property>
</widget>
</widget>
+14
View File
@@ -0,0 +1,14 @@
#include "cmusicvideoswidget.h"
#include "ui_cmusicvideoswidget.h"
cMusicVideosWidget::cMusicVideosWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::cMusicVideosWidget)
{
ui->setupUi(this);
}
cMusicVideosWidget::~cMusicVideosWidget()
{
delete ui;
}
+22
View File
@@ -0,0 +1,22 @@
#ifndef CMUSICVIDEOSWIDGET_H
#define CMUSICVIDEOSWIDGET_H
#include <QWidget>
namespace Ui {
class cMusicVideosWidget;
}
class cMusicVideosWidget : public QWidget
{
Q_OBJECT
public:
explicit cMusicVideosWidget(QWidget *parent = 0);
~cMusicVideosWidget();
private:
Ui::cMusicVideosWidget *ui;
};
#endif // CMUSICVIDEOSWIDGET_H
+32
View File
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cMusicVideosWidget</class>
<widget class="QWidget" name="cMusicVideosWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>90</x>
<y>50</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Music Videos</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
+14
View File
@@ -0,0 +1,14 @@
#include "cmusicwidget.h"
#include "ui_cmusicwidget.h"
cMusicWidget::cMusicWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::cMusicWidget)
{
ui->setupUi(this);
}
cMusicWidget::~cMusicWidget()
{
delete ui;
}
+22
View File
@@ -0,0 +1,22 @@
#ifndef CMUSICWIDGET_H
#define CMUSICWIDGET_H
#include <QWidget>
namespace Ui {
class cMusicWidget;
}
class cMusicWidget : public QWidget
{
Q_OBJECT
public:
explicit cMusicWidget(QWidget *parent = 0);
~cMusicWidget();
private:
Ui::cMusicWidget *ui;
};
#endif // CMUSICWIDGET_H
+32
View File
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cMusicWidget</class>
<widget class="QWidget" name="cMusicWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>50</x>
<y>40</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Music</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
+1 -1
View File
@@ -23,7 +23,7 @@
</rect>
</property>
<property name="text">
<string>TextLabel1</string>
<string>TV Show</string>
</property>
</widget>
</widget>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 345 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 345 KiB

+2
View File
@@ -6,6 +6,8 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
cMainWindow w;
w.showMaximized();
//w.show();
//w.resize(100, 100);
return a.exec();
}
+13 -3
View File
@@ -17,17 +17,27 @@ SOURCES += main.cpp\
ckodivideolibrary.cpp \
ckodilibrary.cpp \
cmoviewidget.cpp \
ctvshowwidget.cpp
ctvshowwidget.cpp \
cmaintabbar.cpp \
cmaintabwidget.cpp \
cmusicwidget.cpp \
cmusicvideoswidget.cpp
HEADERS += cmainwindow.h \
ckodivideolibrary.h \
ckodilibrary.h \
cmoviewidget.h \
ctvshowwidget.h
ctvshowwidget.h \
cmaintabbar.h \
cmaintabwidget.h \
cmusicwidget.h \
cmusicvideoswidget.h
FORMS += cmainwindow.ui \
cmoviewidget.ui \
ctvshowwidget.ui
ctvshowwidget.ui \
cmusicwidget.ui \
cmusicvideoswidget.ui
RESOURCES += \
qtkodidb.qrc