#include <QFile>
#include <QImage>
#include <QImageReader>
-#include <QtCore/qdatetime.h>
+#include <QElapsedTimer>
const int ITERATIONS = 2;
const QSize SCALED_SIZE(1280, 800);
static void bench(QIODevice* device, const QString& outputName)
{
- QTime chrono;
+ QElapsedTimer chrono;
chrono.start();
for (int iteration = 0; iteration < ITERATIONS; ++iteration) {
qDebug() << "Iteration:" << iteration;
// reset timing
m_timer.stop();
- m_time = QTime();
+ m_time.invalidate();
update();
// reset physics
void bballApplet::updatePhysics()
{
// find out the delta-time since the last call
- if (m_time.isNull())
+ if (!m_time.isValid())
m_time.start();
qreal dT = qMin((qreal)m_time.restart() / 1000.0, 0.5);
#include <QtCore/QBasicTimer>
#include <QtCore/QElapsedTimer>
-#include <QtCore/QDateTime>
#include <QtGui/QVector2D>
#include <QGraphicsSceneMouseEvent>
#include <QtDBus/QDBusInterface>
// status
QBasicTimer m_timer;
- QTime m_time;
+ QElapsedTimer m_time;
QRectF m_screenRect;
// Own
#include "taskmanager/taskgroup.h"
-// Qt
-#include <QtCore/qdatetime.h>
+// Katie
+#include <QElapsedTimer>
#include <QIcon>
-#include <QtGui/qevent.h>
+#include <QGraphicsSceneDragDropEvent>
#include <QGraphicsWidget>
#include <QPropertyAnimation>
private:
QRectF m_activeRect;
- QTime m_lastGeometryUpdate;
- QTime m_lastUpdate;
+ QElapsedTimer m_lastGeometryUpdate;
+ QElapsedTimer m_lastUpdate;
QSize m_lastIconSize;
int m_activateTimerId;
int m_updateGeometryTimerId;
#include <QtXml/qdom.h>
#include <QtCore/qdatetime.h>
+// FIXME: this is jumpy
+static int elapsedSecs(const QTime &time)
+{
+ const int msecs = time.msecsTo(QTime::currentTime());
+ if (msecs <= 0) {
+ return 0;
+ }
+ return (msecs / 1000);
+}
struct StatusStrings
{
int Transfer::elapsedTime() const
{
if (status() == Job::Running)
- return m_runningTime.elapsed() / 1000;
+ return elapsedSecs(m_runningTime);
return m_runningSeconds;
}
e.setAttribute("UploadedSize", m_uploadedSize);
e.setAttribute("DownloadLimit", m_visibleDownloadLimit);
e.setAttribute("UploadLimit", m_visibleUploadLimit);
- e.setAttribute("ElapsedTime", status() == Job::Running ? m_runningTime.elapsed() / 1000 : m_runningSeconds);
+ e.setAttribute("ElapsedTime", status() == Job::Running ? elapsedSecs(m_runningTime) : m_runningSeconds);
e.setAttribute("Policy", policy() == Job::Start ? "Start" : (policy() == Job::Stop ? "Stop" : "None"));
}
if (jobStatus == Job::Running && status() != Job::Running)
{
- m_runningTime.restart();
+ m_runningTime = QTime::currentTime();
m_runningTime.addSecs(m_runningSeconds);
}
if (jobStatus != Job::Running && status() == Job::Running)
- m_runningSeconds = m_runningTime.elapsed() / 1000;
+ m_runningSeconds = elapsedSecs(m_runningTime);
/**
* It's important to call job::setStatus AFTER having changed the
* icon or the text or whatever.
#include <KAboutData>
#include <KDebug>
-#include <QtCore/qdatetime.h>
+#include <QElapsedTimer>
int main(int argc, char **argv)
{
- QTime startupTimer;
+ QElapsedTimer startupTimer;
startupTimer.start();
KAboutData aboutData("krdc", 0, ki18n("KRDC"), KDE_VERSION_STRING,
ki18n("KDE Remote Desktop Client"), KAboutData::License_GPL,
const int searchId = 0;
d.searchText(searchId, " i ", true, Qt::CaseSensitive, Okular::Document::NextMatch, false, QColor());
- QTime t;
+ QElapsedTimer t;
t.start();
while (spy.count() != 1 && t.elapsed() < 500)
qApp->processEvents();
#include <qimage.h>
#include <qpainter.h>
#include <qtimer.h>
+#include <qelapsedtimer.h>
#include <qset.h>
#include <qscrollbar.h>
#include <qtooltip.h>
// viewport move
bool viewportMoveActive;
- QTime viewportMoveTime;
+ QElapsedTimer viewportMoveTime;
QPoint viewportMoveDest;
int lastSourceLocationViewportPageNumber;
double lastSourceLocationViewportNormalizedX;
#include <kdialog.h>
#include <QTimer>
-#include <QtCore/qdatetime.h>
+#include <QElapsedTimer>
#include <QString>
+#include <QTreeWidgetItem>
+#include <QCloseEvent>
+#include <QKeyEvent>
class OperationRunner;
class Operation;
class ApplyProgressDetailsWidget;
class Report;
-
-#include <QTreeWidgetItem>
-#include <QCloseEvent>
-#include <QKeyEvent>
-
/** Show progress.
The progress dialog telling the user about the progress of the Operations that are being applied.
void allOpsDone(const QString& msg);
- QTime& time() { return m_Time; }
+ QElapsedTimer& time() { return m_Time; }
QTimer& timer() { return m_Timer; }
const QTimer& timer() const { return m_Timer; }
Report* m_Report;
QString m_SavedParentTitle;
QTimer m_Timer;
- QTime m_Time;
+ QElapsedTimer m_Time;
QTreeWidgetItem* m_CurrentOpItem;
QTreeWidgetItem* m_CurrentJobItem;
int m_LastReportUpdate;
#include "util/report.h"
#include <QIcon>
-#include <QtCore/qdatetime.h>
+#include <QElapsedTimer>
#include <kdebug.h>
#include <klocale.h>
void* buffer = malloc(blockSize * source.sectorSize());
int percent = 0;
- QTime t;
+ QElapsedTimer t;
t.start();
while (blocksCopied < blocksToCopy)