added the conf file changes
[qtmeetings] / src / UserInterface / Views / MeetingInfoDialog.cpp
1 #include "MeetingInfoDialog.h"
2 #include "ToolBox.h"
3 #include "Meeting.h"
4 #include "Room.h"
5 #include <QLabel>
6 #include <QVBoxLayout>
7 #include <QPushButton>
8 #include <QTextEdit>
9 #include <QDebug>
10
11 MeetingInfoDialog::MeetingInfoDialog( Meeting *aMeeting, QWidget *aParent ) :
12                 QDialog( aParent )
13 {
14         setWindowTitle( tr( "Details" ) );
15
16         QFont normalFont;
17         normalFont.setPointSize( 11 );
18
19         QFont boldFont;
20         boldFont.setPointSize( 11 );
21         boldFont.setBold( true );
22
23         QLabel *subjectLabel = ToolBox::createLabel( tr( "Subject:" ), boldFont );
24         QLabel *subjectContent = ToolBox::createLabel( aMeeting->subject(), normalFont );
25
26         QLabel *descriptionLabel = ToolBox::createLabel( tr( "Description:" ), boldFont );
27         QTextEdit *descriptionContent = new QTextEdit( "" );
28         descriptionContent->setHtml( aMeeting->description() );
29         descriptionContent->setReadOnly( true );
30         descriptionContent->setFont( normalFont );
31
32         QLabel *organizerLabel = NULL;
33         QLabel *organizerContent = NULL;
34         
35         QString roomAddr = aMeeting->room().address();
36         QString organizer = aMeeting->organizer();
37         if( !organizer.contains( roomAddr ) )
38         {
39                 organizerLabel = ToolBox::createLabel( tr( "Organizer:" ), boldFont );
40                 organizerContent = ToolBox::createLabel( aMeeting->organizer(), normalFont );
41         }
42         QLabel *startsAtLabel = ToolBox::createLabel( tr( "Starts at:" ), boldFont );
43         QLabel *startsAtContent = ToolBox::createLabel( aMeeting->startsAt().toString( tr( "d MMMM yyyy hh:mm" ) ), normalFont );
44
45         QLabel *endsAtLabel = ToolBox::createLabel( tr( "Ends at:" ), boldFont );
46         QLabel *endsAtContent = ToolBox::createLabel( aMeeting->endsAt().toString( tr( "d MMMM yyyy hh:mm" ) ), normalFont );
47
48         QPushButton *button = new QPushButton;
49         button->setText( tr( "OK" ) );
50         connect( button, SIGNAL( clicked() ), this, SLOT( close() ) );
51
52         QHBoxLayout *buttonLayout = new QHBoxLayout;
53         buttonLayout->addStretch();
54         buttonLayout->addWidget( button );
55         buttonLayout->addStretch();
56
57         QVBoxLayout *layout = new QVBoxLayout;
58         layout->addWidget( subjectLabel );
59         layout->addWidget( subjectContent );
60         layout->addSpacing( 5 );
61         layout->addWidget( descriptionLabel );
62         layout->addWidget( descriptionContent );
63         layout->addSpacing( 5 );
64         if( organizerLabel )
65                 layout->addWidget( organizerLabel );
66         if( organizerContent )
67                 layout->addWidget( organizerContent );
68         layout->addSpacing( 5 );
69         layout->addWidget( startsAtLabel );
70         layout->addWidget( startsAtContent );
71         layout->addSpacing( 5 );
72         layout->addWidget( endsAtLabel );
73         layout->addWidget( endsAtContent );
74         layout->addSpacing( 5 );
75         layout->addStretch();
76         layout->addLayout( buttonLayout );
77         setLayout( layout );
78
79         setMinimumWidth( MeetingInfoDialog::width );
80         setMinimumHeight( MeetingInfoDialog::height );
81 }
82
83 MeetingInfoDialog::~MeetingInfoDialog()
84 {
85 }