move the ui-related utils functions for annotations in an own utils class

svn path=/trunk/playground/graphics/okular/; revision=617097
remotes/origin/KDE/4.0
Pino Toscano 19 years ago
parent 8add3d7863
commit 48a772be4b
  1. 1
      CMakeLists.txt
  2. 38
      core/annotations.cpp
  3. 5
      core/annotations.h
  4. 51
      ui/annotationguiutils.cpp
  5. 27
      ui/annotationguiutils.h
  6. 3
      ui/side_reviews.cpp

@ -78,6 +78,7 @@ set(okularpart_SRCS
conf/dlgpresentation.cpp
ui/embeddedfilesdialog.cpp
ui/annotwindow.cpp
ui/annotationguiutils.cpp
ui/annotationpropertiesdialog.cpp
ui/annotationtools.cpp
ui/annotationwidgets.cpp

@ -11,9 +11,6 @@
#include <QtGui/QApplication>
#include <QtGui/QColor>
#include <kdebug.h>
#include <klocale.h>
// local includes
#include "annotations.h"
@ -81,41 +78,6 @@ QDomElement AnnotationUtils::findChildElement( const QDomNode & parentNode,
return QDomElement();
}
QString AnnotationUtils::captionForAnnotation( Annotation * ann )
{
if ( !ann )
return QString();
QString ret;
switch( ann->subType() )
{
case Okular::Annotation::AText:
if( ( (Okular::TextAnnotation*)ann )->textType() == Okular::TextAnnotation::Linked )
ret = i18n( "Note" );
else
ret = i18n( "FreeText" );
break;
case Okular::Annotation::ALine:
ret = i18n( "Line" );
break;
case Okular::Annotation::AGeom:
ret = i18n( "Geom" );
break;
case Okular::Annotation::AHighlight:
ret = i18n( "Highlight" );
break;
case Okular::Annotation::AStamp:
ret = i18n( "Stamp" );
break;
case Okular::Annotation::AInk:
ret = i18n( "Ink" );
break;
case Okular::Annotation::A_BASE:
break;
}
return ret;
}
QRect AnnotationUtils::annotationGeometry( const Annotation * ann,
double scaledWidth, double scaledHeight )
{

@ -52,11 +52,6 @@ class OKULAR_EXPORT AnnotationUtils
static QDomElement findChildElement( const QDomNode & parentNode,
const QString & name );
/**
* Returns the translated string with the type of the given @p annotation.
*/
static QString captionForAnnotation( Annotation * annotation );
/**
* Returns the geometry of the given @p annotation scaled by
* @p scaleX and @p scaleY.

@ -0,0 +1,51 @@
/***************************************************************************
* Copyright (C) 2006 by Pino Toscano <pino@kde.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. *
***************************************************************************/
// qt/kde includes
#include <klocale.h>
// local includes
#include "annotationguiutils.h"
#include "core/annotations.h"
QString AnnotationGuiUtils::captionForAnnotation( Okular::Annotation * ann )
{
if ( !ann )
return QString();
QString ret;
switch( ann->subType() )
{
case Okular::Annotation::AText:
if( ( (Okular::TextAnnotation*)ann )->textType() == Okular::TextAnnotation::Linked )
ret = i18n( "Note" );
else
ret = i18n( "FreeText" );
break;
case Okular::Annotation::ALine:
ret = i18n( "Line" );
break;
case Okular::Annotation::AGeom:
ret = i18n( "Geom" );
break;
case Okular::Annotation::AHighlight:
ret = i18n( "Highlight" );
break;
case Okular::Annotation::AStamp:
ret = i18n( "Stamp" );
break;
case Okular::Annotation::AInk:
ret = i18n( "Ink" );
break;
case Okular::Annotation::A_BASE:
break;
}
return ret;
}

@ -0,0 +1,27 @@
/***************************************************************************
* Copyright (C) 2006 by Pino Toscano <pino@kde.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. *
***************************************************************************/
#ifndef ANNOTATIONGUIUTILS_H
#define ANNOTATIONGUIUTILS_H
namespace Okular {
class Annotation;
}
class AnnotationGuiUtils
{
public:
/**
* Returns the translated string with the type of the given @p annotation.
*/
static QString captionForAnnotation( Okular::Annotation * annotation );
};
#endif

@ -25,6 +25,7 @@
#include "core/document.h"
#include "core/page.h"
#include "settings.h"
#include "annotationguiutils.h"
#include "side_reviews.h"
@ -186,7 +187,7 @@ class AnnotationItem : public QTreeWidgetItem
void init()
{
setText( 0, Okular::AnnotationUtils::captionForAnnotation( m_ann ) );
setText( 0, AnnotationGuiUtils::captionForAnnotation( m_ann ) );
setIcon( 0, KIcon( "okular" ) );
setToolTip( 0, QString( "<qt><b>%1</b><hr>%2</qt>" )
.arg( i18n( "Author: %1", m_ann->author() ), m_ann->contents() ) );

Loading…
Cancel
Save