Browse Source

Rename to TDEStopWatch.

This is a more accurate name and we avoid naming confusion with
KTimer from tdeutils.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
master
Mavridis Philippe 6 months ago
parent
commit
16c261000d
Signed by: blu.256
GPG Key ID: F8D2D7E2F989A494
  1. 2
      CMakeLists.txt
  2. 4
      src/CMakeLists.txt
  3. 13
      src/main.cpp
  4. 24
      src/tdestopwatch.cpp
  5. 12
      src/tdestopwatch.h

2
CMakeLists.txt

@ -1,6 +1,6 @@
cmake_minimum_required( VERSION 2.8.12 )
project( tdetimer )
project( tdestopwatch )
set( VERSION 1.0.0 )
# include needed modules

4
src/CMakeLists.txt

@ -12,7 +12,7 @@ link_directories(
)
tde_add_executable( ${PROJECT_NAME} AUTOMOC
SOURCES tdetimer.cpp main.cpp
SOURCES tdestopwatch.cpp main.cpp
LINK tdeui-shared tdecore-shared
DESTINATION ${BIN_INSTALL_DIR}
)
)

13
src/main.cpp

@ -2,15 +2,13 @@
#include <tdeaboutdata.h>
#include <tdecmdlineargs.h>
#include <kdebug.h>
#include "tdetimer.h"
#include "tdestopwatch.h"
int main( int argc, char *argv[] )
{
TDEAboutData about(
"tdetimer", "TDE Timer", "1.0.0",
"A little timer for TDE",
"tdestopwatch", "TDE Stopwatch", "1.0.0",
"A little stopwatch utility for TDE",
TDEAboutData::License_GPL,
"Copyright (c) 2021 Mavridis Philippe"
);
@ -18,7 +16,8 @@ int main( int argc, char *argv[] )
TDECmdLineArgs::init(argc, argv, &about);
TDEApplication app( argc, argv );
app.setMainWidget( new TDETimer() );
TDEStopWatch main;
app.setMainWidget(&main);
return app.exec();
}
}

24
src/tdetimer.cpp → src/tdestopwatch.cpp

@ -9,9 +9,9 @@
#include <ktimewidget.h>
#include <tdelocale.h>
#include "tdetimer.h"
#include "tdestopwatch.h"
TDETimer::TDETimer()
TDEStopWatch::TDEStopWatch()
{
TDEIconLoader *il = kapp->iconLoader();
TQVBoxLayout *vlayout = new TQVBoxLayout(this);
@ -48,15 +48,15 @@ TDETimer::TDETimer()
pulse = new TQTimer(this);
connect( pulse, SIGNAL(timeout()), this, SLOT(slotTimeout()) );
setCaption( i18n("TDE Timer") );
setCaption( i18n("TDE Stopwatch") );
show();
}
TDETimer::~TDETimer()
TDEStopWatch::~TDEStopWatch()
{}
void TDETimer::slotStartStop()
void TDEStopWatch::slotStartStop()
{
if( pulse->isActive() )
pulse->stop();
@ -64,11 +64,11 @@ void TDETimer::slotStartStop()
pulse->start(1000);
}
void TDETimer::slotReset()
void TDEStopWatch::slotReset()
{
int result = KMessageBox::warningYesNo(
this,
i18n("Are you sure you want to reset the timer and steps?"),
i18n("Are you sure you want to reset the stopwatch and steps?"),
i18n("Confirm Reset")
);
@ -82,12 +82,12 @@ void TDETimer::slotReset()
time->setTime(timer);
}
void TDETimer::slotSetTime(const TQTime& t)
void TDEStopWatch::slotSetTime(const TQTime& t)
{
timer = t;
}
void TDETimer::slotSetFromStep(TQListBoxItem* step)
void TDEStopWatch::slotSetFromStep(TQListBoxItem* step)
{
int h, m, s;
TQStringList step_time = TQStringList::split(":", step->text());
@ -99,17 +99,17 @@ void TDETimer::slotSetFromStep(TQListBoxItem* step)
time->setTime(timer);
}
void TDETimer::slotTimeout()
void TDEStopWatch::slotTimeout()
{
timer = timer.addSecs(1);
time->setTime(timer);
}
void TDETimer::slotStep()
void TDEStopWatch::slotStep()
{
TQString time_str = timer.toString("hh:mm:ss");
if( stepl->findItem(time_str) == 0 )
stepl->insertItem(time_str);
}
#include "tdetimer.moc"
#include "tdestopwatch.moc"

12
src/tdetimer.h → src/tdestopwatch.h

@ -1,5 +1,5 @@
#ifndef __TDETIMER_H
#define __TDETIMER_H
#ifndef __TDESTOPWATCH_H
#define __TDESTOPWATCH_H
#include <tqdatetime.h>
#include <tqwidget.h>
@ -10,11 +10,11 @@ class TQListBox;
class TQListBoxItem;
class TQTimer;
class TDETimer : public TQWidget {
class TDEStopWatch : public TQWidget {
TQ_OBJECT
public:
TDETimer();
~TDETimer();
TDEStopWatch();
~TDEStopWatch();
public slots:
void slotStartStop();
@ -37,4 +37,4 @@ class TDETimer : public TQWidget {
TQTime timer;
};
#endif // __TDETIMER_H
#endif // __TDESTOPWATCH_H
Loading…
Cancel
Save