diff options
Diffstat (limited to 'src/app/mainWindow.cpp')
-rw-r--r-- | src/app/mainWindow.cpp | 106 |
1 files changed, 105 insertions, 1 deletions
diff --git a/src/app/mainWindow.cpp b/src/app/mainWindow.cpp index 79cd025..4c556b9 100644 --- a/src/app/mainWindow.cpp +++ b/src/app/mainWindow.cpp @@ -20,6 +20,7 @@ #include <twin.h> #include <tqcstring.h> #include <tqevent.h> //::stateChanged() +#include <tqgroupbox.h> #include <tqlayout.h> //ctor #include <tqpopupmenu.h> //because XMLGUI is poorly designed #include <tqobjectlist.h> @@ -56,6 +57,102 @@ constexpr auto kSubtitleSelectActionName = "subtitle_channels_select"; namespace Codeine { + class MediaInfoDialog : public KDialogBase + { + TQLabel* m_videoWidth; + TQLabel* m_videoHeight; + TQLabel* m_videoBitRate; + TQLabel* m_audioBits; + TQLabel* m_audioSampleRate; + TQLabel* m_audioBitRate; + + public: + MediaInfoDialog(TQWidget *parent, const TQMap<MetaData, TQString>& meta) + : KDialogBase(parent, "meta_data_dialog", true, i18n("Media Information"), Close) + { + TQFrame *widget = makeMainWidget(); + widget->setMinimumWidth(250); + auto layout = new TQVBoxLayout(widget, 0, 4); + auto group = new TQGroupBox(2, Horizontal, i18n("General"), widget); + layout->addWidget(group); + + auto label = new TQLabel(i18n("Title") + ":", group); + auto value = new TQLabel(meta[MetaData::Title], group); + label->setBuddy(value); + + label = new TQLabel(i18n("Artist") + ":", group); + value = new TQLabel(meta[MetaData::Artist], group); + label->setBuddy(value); + + label = new TQLabel(i18n("Album") + ":", group); + value = new TQLabel(meta[MetaData::Album], group); + label->setBuddy(value); + + label = new TQLabel(i18n("Genre") + ":", group); + value = new TQLabel(meta[MetaData::Genre], group); + label->setBuddy(value); + + label = new TQLabel(i18n("Year") + ":", group); + value = new TQLabel(meta[MetaData::Year], group); + label->setBuddy(value); + + label = new TQLabel(i18n("Comment") + ":", group); + value = new TQLabel(meta[MetaData::Comment], group); + label->setBuddy(value); + + group = new TQGroupBox(2, Horizontal, i18n("Video"), widget); + layout->addWidget(group); + + label = new TQLabel(i18n("Bitrate") + ":", group); + m_videoBitRate = new TQLabel(group); + label->setBuddy(m_videoBitRate); + + label = new TQLabel(i18n("Codec") + ":", group); + value = new TQLabel(meta[MetaData::VideoCodec], group); + label->setBuddy(value); + + label = new TQLabel(i18n("Height") + ":", group); + m_videoHeight = new TQLabel(group); + label->setBuddy(m_videoHeight); + + label = new TQLabel(i18n("Width") + ":", group); + m_videoWidth = new TQLabel(group); + label->setBuddy(m_videoWidth); + + group = new TQGroupBox(2, Horizontal, i18n("Audio"), widget); + layout->addWidget(group); + + label = new TQLabel(i18n("Bitrate") + ":", group); + m_audioBitRate = new TQLabel(group); + label->setBuddy(m_audioBitRate); + + label = new TQLabel(i18n("Codec") + ":", group); + value = new TQLabel(meta[MetaData::AudioCodec], group); + label->setBuddy(value); + + label = new TQLabel(i18n("Bit Depth") + ":", group); + m_audioBits = new TQLabel(group); + label->setBuddy(m_audioBits); + + label = new TQLabel(i18n("Sample Rate") + ":", group); + m_audioSampleRate = new TQLabel(group); + label->setBuddy(m_audioSampleRate); + + resize(sizeHint()); + disableResize(); + } + + void setStreamInfo(const TQMap<StreamInfo, TQString>& info) + { + m_videoWidth->setText(info[StreamInfo::VideoWidth] + " px"); + m_videoHeight->setText(info[StreamInfo::VideoHeight] + " px"); + m_videoBitRate->setText(info[StreamInfo::VideoBitRate] + " bps"); + m_audioBits->setText(info[StreamInfo::AudioBits] + "-bit"); + m_audioSampleRate->setText(info[StreamInfo::AudioSampleRate] + " Hz"); + m_audioBitRate->setText(info[StreamInfo::AudioBitRate] + " bps"); + } + }; + /// @see codeine.h TQWidget *mainWindow() { return tdeApp->mainWidget(); } @@ -66,6 +163,7 @@ MainWindow::MainWindow() , m_positionSlider( new Slider( this, 65535 ) ) , m_timeLabel( new TQLabel( " 0:00:00 ", this ) ) , m_titleLabel( new KSqueezedTextLabel( this ) ) + , m_mediaInfoDialog(nullptr) { DEBUG_BLOCK @@ -647,7 +745,13 @@ MainWindow::configure() void MainWindow::streamInformation() { - MessageBox::information( TheStream::information(), i18n("Media Information") ); + if (!m_mediaInfoDialog) + { + TQMap<MetaData, TQString> metaData = TheStream::metaData(); + m_mediaInfoDialog = new MediaInfoDialog(this, metaData); + } + m_mediaInfoDialog->setStreamInfo(TheStream::info()); + m_mediaInfoDialog->show(); } void |