• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • calligra API Reference
  • KDE Home
  • Contact Us
 

KoWidgetUtils

  • sources
  • kfour-appscomplete
  • calligra
  • libs
  • widgetutils
KoUpdaterPrivate_p.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  * Copyright (C) 2006-2007 Thomas Zander <[email protected]>
3  * Copyright (C) 2009 Boudewijn Rempt <[email protected]>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef KO_UPDATERPRIVATE__P_H
22 #define KO_UPDATERPRIVATE__P_H
23 
24 #include "KoProgressUpdater.h"
25 
26 #include <QTime>
27 #include <QVector>
28 
40 class KoUpdaterPrivate : public QObject
41 {
42 
43  Q_OBJECT
44 
45 public:
46 
47  KoUpdaterPrivate(KoProgressUpdater *parent, int weight, const QString& name)
48  : QObject(0)
49  , m_progress(0)
50  , m_weight(weight)
51  , m_interrupted(false)
52  , m_hasOutput(parent->hasOutput())
53  , m_parent(parent)
54  {
55  setObjectName(name);
56  }
57 
60  ~KoUpdaterPrivate() override;
61 
62  bool interrupted() const { return m_interrupted; }
63 
64  int progress() const { return m_progress; }
65 
66  int weight() const { return m_weight; }
67 
68  class TimePoint {
69  public:
70  QTime time;
71  int value;
72 
73  explicit TimePoint(int value_) :time(QTime::currentTime()), value(value_) {}
74  TimePoint() {}
75  };
76 
77  void addPoint(int value) {
78  if (m_hasOutput) {
79  m_points.append(TimePoint(value));
80  }
81  }
82 
83  const QVector<TimePoint> & getPoints() const {
84  return m_points;
85  }
86 
87 public Q_SLOTS:
88 
90  void cancel();
91 
94  void interrupt();
95 
97  void setProgress( int percent );
98 
99 Q_SIGNALS:
100 
102  void sigUpdated();
103 
106  void sigInterrupted();
107 
108 private:
109  int m_progress; // always in percent
110  int m_weight;
111  bool m_interrupted;
112  bool m_hasOutput;
113 
114  KoProgressUpdater *m_parent;
115  QVector<TimePoint> m_points;
116 };
117 
118 Q_DECLARE_TYPEINFO(KoUpdaterPrivate::TimePoint, Q_MOVABLE_TYPE);
119 
120 #endif
KoUpdaterPrivate::TimePoint::TimePoint
TimePoint()
Definition: KoUpdaterPrivate_p.h:74
KoUpdaterPrivate::interrupted
bool interrupted() const
Definition: KoUpdaterPrivate_p.h:62
KoUpdaterPrivate::TimePoint::time
QTime time
Definition: KoUpdaterPrivate_p.h:70
KoUpdaterPrivate::sigUpdated
void sigUpdated()
Emitted whenever the progress changed.
KoUpdaterPrivate::addPoint
void addPoint(int value)
Definition: KoUpdaterPrivate_p.h:77
KoUpdaterPrivate::TimePoint
Definition: KoUpdaterPrivate_p.h:68
KoUpdaterPrivate::cancel
void cancel()
Cancel comes from KoUpdater.
QObject
KoUpdaterPrivate::interrupt
void interrupt()
Interrupt comes from the gui, through KoProgressUpdater, goes to KoUpdater to signal running tasks th...
QString
Q_DECLARE_TYPEINFO
Q_DECLARE_TYPEINFO(KoUpdaterPrivate::TimePoint, Q_MOVABLE_TYPE)
KoUpdaterPrivate::KoUpdaterPrivate
KoUpdaterPrivate(KoProgressUpdater *parent, int weight, const QString &name)
Definition: KoUpdaterPrivate_p.h:47
KoUpdaterPrivate::setProgress
void setProgress(int percent)
progress comes from KoUpdater
KoUpdaterPrivate::getPoints
const QVector< TimePoint > & getPoints() const
Definition: KoUpdaterPrivate_p.h:83
KoUpdaterPrivate::weight
int weight() const
Definition: KoUpdaterPrivate_p.h:66
KoUpdaterPrivate::progress
int progress() const
Definition: KoUpdaterPrivate_p.h:64
KoProgressUpdater.h
KoUpdaterPrivate::~KoUpdaterPrivate
~KoUpdaterPrivate() override
when deleting an updater, make sure the accompanying thread is interrupted, too.
KoUpdaterPrivate::sigInterrupted
void sigInterrupted()
Emitted whenever the parent KoProgressUpdater is interrupted, for instance through a press on a cance...
KoUpdaterPrivate
KoUpdaterPrivate is the gui-thread side of KoUpdater.
Definition: KoUpdaterPrivate_p.h:40
QObject::setObjectName
void setObjectName(const QString &name)
KoUpdaterPrivate::TimePoint::TimePoint
TimePoint(int value_)
Definition: KoUpdaterPrivate_p.h:73
QObject::name
const char * name() const
QVector
QTime
QObject::parent
QObject * parent() const
KoUpdaterPrivate::TimePoint::value
int value
Definition: KoUpdaterPrivate_p.h:71
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Apr 21 2021 23:25:26 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KoWidgetUtils

Skip menu "KoWidgetUtils"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

calligra API Reference

Skip menu "calligra API Reference"
  • Braindump
  • filters
  •   MSO
  •   KoMSOOXML
  •   KoOdf2
  •   KoOdfReader
  • Karbon
  • libs
  •   BasicFlakes
  •   Flake
  •   KoKross
  •   KUndo2
  •   KoMain
  •   KoOdf
  •   KoPageApp
  •   Pigment
  •   KoPlugin
  •   KoRdf
  •   KoStore
  •   KoText
  •   KoTextLayout
  •   KoVectorImage
  •   KoWidgets
  •   KoWidgetUtils
  • plugins
  •   formulashape
  •   musicshape
  • Sheets
  • Stage
  • Words
  •   part
  •     scripting

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal