1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
|
/***************************************************************************
describe.cpp - description
-------------------
begin : Sat Dec 1 2001
copyright : (C) 2001 by Richard Groult
email : rgroult@jalix.org
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA. *
* *
* For license exceptions see LICENSE.EXC file, attached with the source *
* code. *
* *
***************************************************************************/
#include "describe.h"
// Qt
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qmultilineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qfileinfo.h>
// KDE
#include <klocale.h>
#include <klineedit.h>
#include <ktextedit.h>
Describe::Describe( QWidget* parent, const QString& imagefile, const char* name )
:KDialogBase( parent, name, false, "Describe" ,
KDialogBase::Help|KDialogBase::Ok|KDialogBase::Cancel|KDialogBase::Apply, KDialogBase::Ok, true )
{
setCaption( i18n( "Describe ")+imagefile);
QWidget *page = new QWidget( this );
setMainWidget(page);
///
DescribeLayout = new QVBoxLayout( page, 11, 6, "DescribeLayout");
layout1 = new QHBoxLayout( 0, 0, 6, "layout1");
textLabel5 = new QLabel( page, "textLabel5" );
layout1->addWidget( textLabel5 );
title = new KLineEdit( page, "title" );
layout1->addWidget( title );
DescribeLayout->addLayout( layout1 );
layout2 = new QHBoxLayout( 0, 0, 6, "layout2");
groupBox2 = new QGroupBox( page, "groupBox2" );
groupBox2->setColumnLayout(0, Qt::Vertical );
groupBox2->layout()->setSpacing( 6 );
groupBox2->layout()->setMargin( 11 );
groupBox2Layout = new QVBoxLayout( groupBox2->layout() );
groupBox2Layout->setAlignment( Qt::AlignTop );
layout3 = new QGridLayout( 0, 1, 1, 0, 6, "layout3");
textLabel3 = new QLabel( groupBox2, "textLabel3" );
layout3->addWidget( textLabel3, 2, 0 );
event = new KLineEdit( groupBox2, "event" );
event->setMinimumSize( QSize( 100, 0 ) );
layout3->addWidget( event, 0, 1 );
people = new KLineEdit( groupBox2, "people" );
people->setMinimumSize( QSize( 100, 0 ) );
layout3->addWidget( people, 2, 1 );
textLabel4 = new QLabel( groupBox2, "textLabel4" );
layout3->addWidget( textLabel4, 3, 0 );
textLabel1 = new QLabel( groupBox2, "textLabel1" );
layout3->addWidget( textLabel1, 0, 0 );
location = new KLineEdit( groupBox2, "location" );
location->setMinimumSize( QSize( 100, 0 ) );
layout3->addWidget( location, 1, 1 );
date = new KLineEdit( groupBox2, "date" );
date->setMinimumSize( QSize( 100, 0 ) );
layout3->addWidget( date, 3, 1 );
textLabel2 = new QLabel( groupBox2, "textLabel2" );
layout3->addWidget( textLabel2, 1, 0 );
groupBox2Layout->addLayout( layout3 );
layout2->addWidget( groupBox2 );
groupBox3 = new QGroupBox( page, "groupBox3" );
groupBox3->setColumnLayout(0, Qt::Vertical );
groupBox3->layout()->setSpacing( 6 );
groupBox3->layout()->setMargin( 11 );
groupBox3Layout = new QHBoxLayout( groupBox3->layout() );
groupBox3Layout->setAlignment( Qt::AlignTop );
longDescr = new KTextEdit( groupBox3, "longDescr" );
groupBox3Layout->addWidget( longDescr );
layout2->addWidget( groupBox3 );
DescribeLayout->addLayout( layout2 );
//languageChange();
resize( QSize(461, 224).expandedTo(minimumSizeHint()) );
clearWState( WState_Polished );
///
textLabel5->setText( i18n( "Title:" ) );
QToolTip::add( title, i18n( "Type a short title for the picture" ) );
groupBox2->setTitle( i18n( "Information" ) );
textLabel3->setText( i18n( "People:" ) );
QToolTip::add( event, i18n( "The event where the image was taken" ) );
QToolTip::add( people, i18n( "The names of the people on the picture" ) );
QWhatsThis::add( people, i18n( "Should be a comma separated list without the word \"and\" to allow for easy parsing for a future search feature. For example: Colin, Mike, Steph, Jeff, Marc" ) );
textLabel4->setText( i18n( "Date:" ) );
textLabel1->setText( i18n( "Event:" ) );
QToolTip::add( location, i18n( "The location where the image was taken" ) );
QToolTip::add( date, i18n( "The date and time the picture was taken" ) );
textLabel2->setText( i18n( "Location:" ) );
groupBox3->setTitle( i18n( "Describe" ) );
QToolTip::add( longDescr, i18n( "A description of the picture and any other information" ) );
///
setImageFile(imagefile);
title->setFocus();
}
/*
* Destroys the object and frees any allocated resources
*/
Describe::~Describe()
{
// no need to delete child widgets, Qt does it all for us
}
void
Describe::setImageFile(const QString& imagefile)
{
setCaption(imagefile);
iinfo = new ImageFileInfo(imagefile, 0);
title->setText(iinfo->getTitle());
event->setText(iinfo->getEvent());
location->setText(iinfo->getLocation());
people->setText(iinfo->getPeople());
date->setText(iinfo->getDate());
longDescr->setText(iinfo->getDescription());
}
void
Describe::slotOk()
{
iinfo->write(title->text(),event->text(),
location->text(),people->text(),
date->text(), longDescr->text() );
KDialogBase::slotOk();
emit close();
}
void
Describe::slotCancel()
{
KDialogBase::slotCancel();
emit close();
}
void
Describe::slotApply()
{
iinfo->write(title->text(),event->text(),
location->text(),people->text(),
date->text(), longDescr->text() );
KDialogBase::slotApply();
}
#include "describe.moc"
|