~ubuntu-branches/ubuntu/hardy/kdenlive/hardy

« back to all changes in this revision

Viewing changes to kdenlive/clippropertiesdialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Albin Tonnerre
  • Date: 2008-01-30 17:07:51 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080130170751-lyc8p6xvd7o98ur5
Tags: 0.5.svn20071228-0.0ubuntu1
* Merge from debian-multimedia (LP: #150453). Remaining changes:
  - Bump compat to 5
  - Suggest dvgrab and ffmpeg (needed for firewire capture)
  - debian/{rules,control}: add a kdenlive-data package
  - Add .install files for kdenlive and kdenlive-data
  - debian/copyright: add some copyright information
  - Modify Maintainer value to match the DebianMaintainerField specification

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
                          clippropertiesdialog.cpp  -  description
3
 
                             -------------------
4
 
    begin                : Mon Mar 17 2003
5
 
    copyright            : (C) 2003 by Jason Wood
6
 
    email                : jasonwood@blueyonder.co.uk
7
 
 ***************************************************************************/
8
 
 
9
 
/***************************************************************************
10
 
 *                                                                         *
11
 
 *   This program is free software; you can redistribute it and/or modify  *
12
 
 *   it under the terms of the GNU General Public License as published by  *
13
 
 *   the Free Software Foundation; either version 2 of the License, or     *
14
 
 *   (at your option) any later version.                                   *
15
 
 *                                                                         *
16
 
 ***************************************************************************/
17
 
#include <cmath>
18
 
 
19
 
#include <klocale.h>
20
 
 
21
 
#include <qnamespace.h>
22
 
#include <qhgroupbox.h>
23
 
#include <qhbox.h>
24
 
 
25
 
#include "clippropertiesdialog.h"
26
 
#include "docclipavfile.h"
27
 
#include "docclipref.h"
28
 
 
29
 
namespace Gui {
30
 
 
31
 
    ClipPropertiesDialog::ClipPropertiesDialog(QWidget * parent,
32
 
        const char *name):QVBox(parent, name), m_clip(0) {
33
 
        //video info layout
34
 
        QHGroupBox *m_videoGBox =
35
 
            new QHGroupBox(i18n("Video Stream"), this, "videoStream");
36
 
         m_videoGBox->setAlignment(0);
37
 
         m_videoGBox->setOrientation(Horizontal);
38
 
         m_videoGBox->setInsideSpacing(3);
39
 
        QHBox *m_videoHBox = new QHBox(m_videoGBox);
40
 
        QVBox *m_videoVBoxL = new QVBox(m_videoHBox);
41
 
        QVBox *m_videoVBoxR = new QVBox(m_videoHBox);
42
 
        //video stream headers
43
 
        new QLabel(i18n("Filename:"), m_videoVBoxL);
44
 
        new QLabel(i18n("Frame size, (fps):"), m_videoVBoxL);
45
 
        new QLabel(i18n("Length (hh:mm:ss):"), m_videoVBoxL);
46
 
        new QLabel(i18n("System:"), m_videoVBoxL);
47
 
        new QLabel(i18n("Decompressor:"), m_videoVBoxL);
48
 
        //video stream info data
49
 
         filenameLabel = new QLabel(m_videoVBoxR);
50
 
         filenameLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
51
 
         frameSizeLabel = new QLabel(m_videoVBoxR);
52
 
         frameSizeLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
53
 
         videoLength = new QLabel(m_videoVBoxR);
54
 
         videoLength->setFrameStyle(QFrame::Panel | QFrame::Sunken);
55
 
         systemLabel = new QLabel(m_videoVBoxR);
56
 
         systemLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
57
 
         decompressorLabel = new QLabel(m_videoVBoxR);
58
 
         decompressorLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
59
 
 
60
 
        //audio info layout
61
 
        QHGroupBox *m_audioGBox =
62
 
            new QHGroupBox(i18n("Audio Stream"), this, "audioStream");
63
 
         m_audioGBox->setAlignment(0);
64
 
         m_audioGBox->setOrientation(Horizontal);
65
 
         m_audioGBox->setInsideSpacing(3);
66
 
        QHBox *m_audioHBox = new QHBox(m_audioGBox);
67
 
        QVBox *m_audioVBoxL = new QVBox(m_audioHBox);
68
 
        QVBox *m_audioVBoxR = new QVBox(m_audioHBox);
69
 
        //audio stream headers
70
 
        new QLabel(i18n("Sampling Rate:"), m_audioVBoxL);
71
 
        new QLabel(i18n("Channels:"), m_audioVBoxL);
72
 
        new QLabel(i18n("Format:"), m_audioVBoxL);
73
 
        new QLabel(i18n("Bits per Sample:"), m_audioVBoxL);
74
 
        //audio stream info data
75
 
         samplingRateLabel = new QLabel(m_audioVBoxR);
76
 
         samplingRateLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
77
 
         channelsLabel = new QLabel(m_audioVBoxR);
78
 
         channelsLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
79
 
         formatLabel = new QLabel(m_audioVBoxR);
80
 
         formatLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
81
 
         audiobitLabel = new QLabel(m_audioVBoxR);
82
 
         audiobitLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
83
 
    } ClipPropertiesDialog::~ClipPropertiesDialog() {
84
 
    }
85
 
 
86
 
//display properties based on selected clip
87
 
    void ClipPropertiesDialog::setClip(DocClipRef * clip) {
88
 
        m_clip = clip;
89
 
        if (m_clip) {
90
 
            //video properties
91
 
            filenameLabel->setText(m_clip->name());
92
 
            if (m_clip->clipWidth()!=0 && m_clip->clipHeight()!=0)
93
 
            frameSizeLabel->setText(i18n("%1x%2, %3 fps").arg(m_clip->
94
 
                    clipWidth()).arg(clip->clipHeight()).arg(m_clip->
95
 
                    framesPerSecond()));
96
 
            else frameSizeLabel->setText(i18n("Unknown size, %1 fps").arg(m_clip->framesPerSecond()));
97
 
            if (m_clip->durationKnown()) {
98
 
                QString length = "";
99
 
                int seconds = (int) m_clip->duration().seconds() % 60;
100
 
                int minutes =
101
 
                    (int) floor(m_clip->duration().seconds() / 60);
102
 
                int hours = (int) floor(minutes / 60);
103
 
                if (hours >= 1) {
104
 
                    minutes = (int) hours % 60;
105
 
                } else {
106
 
                    hours = 0;
107
 
                }
108
 
                length.append(QString::number(hours).rightJustify(1, '0',
109
 
                        FALSE));
110
 
                length.append(":");
111
 
                length.append(QString::number(minutes).rightJustify(2, '0',
112
 
                        FALSE));
113
 
                length.append(":");
114
 
                length.append(QString::number(seconds).rightJustify(2, '0',
115
 
                        FALSE));
116
 
                videoLength->setText(length);
117
 
            } else {
118
 
                videoLength->setText(i18n("unknown"));
119
 
            }
120
 
            systemLabel->setText(m_clip->avSystem());
121
 
            decompressorLabel->setText(m_clip->avDecompressor());
122
 
 
123
 
            //audio properties
124
 
            samplingRateLabel->setText(i18n("0Hz"));
125
 
            switch (m_clip->audioChannels()) {
126
 
            case 2:
127
 
                channelsLabel->setText(i18n("%1 (stereo)").arg(m_clip->
128
 
                        audioChannels()));
129
 
                break;
130
 
            case 1:
131
 
                channelsLabel->setText(i18n("%1 (mono)").arg(m_clip->
132
 
                        audioChannels()));
133
 
                break;
134
 
            default:
135
 
                channelsLabel->setText(QString::number(m_clip->
136
 
                        audioChannels()));
137
 
                break;
138
 
            }
139
 
            formatLabel->setText(m_clip->audioFormat());
140
 
            audiobitLabel->setText(i18n("%1 bit").arg(m_clip->
141
 
                    audioBits()));
142
 
        }
143
 
    }
144
 
 
145
 
}                               // namespace Gui