[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/utils/rsibreak/src
From:       Juan Luis Baptiste <juan.baptiste () kdemail ! net>
Date:       2010-10-14 5:12:01
Message-ID: 20101014051201.568D0AC895 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1185664 by jbaptiste:

Added postpone break feature.
BU=G199793



 M  +2 -0      breakbase.cpp  
 M  +2 -0      breakbase.h  
 M  +7 -0      breakcontrol.cpp  
 M  +3 -0      breakcontrol.h  
 M  +3 -0      rsiglobals.cpp  
 M  +5 -0      rsirelaxpopup.cpp  
 M  +5 -0      rsirelaxpopup.h  
 M  +19 -0     rsitimer.cpp  
 M  +8 -0      rsitimer.h  
 M  +3 -0      rsiwidget.cpp  
 M  +27 -0     setuptiming.cpp  


--- trunk/extragear/utils/rsibreak/src/breakbase.cpp #1185663:1185664
@@ -1,5 +1,6 @@
 /*
    Copyright (C) 2009 Tom Albers <toma@kde.org>
+   Copyright (C) 2010 Juan Luis Baptiste <juan.baptiste@gmail.com>
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
@@ -39,6 +40,7 @@
     m_breakControl->installEventFilter( this );
     connect( m_breakControl, SIGNAL( skip() ), SIGNAL( skip() ) );
     connect( m_breakControl, SIGNAL( lock() ), SIGNAL( lock() ) );
+    connect( m_breakControl, SIGNAL( postpone() ), SIGNAL( postpone() ) );
 }
 
 BreakBase::~BreakBase()
--- trunk/extragear/utils/rsibreak/src/breakbase.h #1185663:1185664
@@ -1,5 +1,6 @@
 /*
    Copyright (C) 2009 Tom Albers <toma@kde.org>
+   Copyright (C) 2010 Juan Luis Baptiste <juan.baptiste@gmail.com>
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
@@ -52,6 +53,7 @@
 signals:
     void skip();
     void lock();
+    void postpone();
 
 private:
     BreakControl* m_breakControl;
--- trunk/extragear/utils/rsibreak/src/breakcontrol.cpp #1185663:1185664
@@ -1,5 +1,6 @@
 /*
    Copyright (C) 2009-2010 Tom Albers <toma@kde.org>
+   Copyright (C) 2010 Juan Luis Baptiste <juan.baptiste@gmail.com>
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
@@ -47,6 +48,12 @@
     m_skipButton->setFixedHeight( sizeSkip.height() );
     connect( m_skipButton, SIGNAL( clicked() ), SIGNAL( skip() ) );
 
+    m_postponeButton = new QPushButton( i18n( "Postpone Break" ), hbox );    
+    QSize sizePostpone(m_postponeButton->size());
+    m_postponeButton->setIcon(SmallIcon("go-next"));    
+    m_postponeButton->setFixedHeight(sizePostpone.height());
+    connect( m_postponeButton, SIGNAL( clicked() ), SIGNAL( postpone()) );    
+
     m_lockButton = new QPushButton( i18n( "Lock Screen" ), hbox );
     QSize sizeLock( m_skipButton->size() );
     m_lockButton->setFixedHeight( sizeLock.height() );
--- trunk/extragear/utils/rsibreak/src/breakcontrol.h #1185663:1185664
@@ -1,5 +1,6 @@
 /*
    Copyright (C) 2009-2010 Tom Albers <toma@kde.org>
+   Copyright (C) 2010 Juan Luis Baptiste <juan.baptiste@gmail.com>
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
@@ -45,12 +46,14 @@
 signals:
     void skip();
     void lock();
+    void postpone();
 
 private:
     QLabel* m_textLabel;
     QPushButton* m_skipButton;
     QPushButton* m_lockButton;
     QVBoxLayout* m_vbox;
+    QPushButton* m_postponeButton;
 };
 
 #endif // BREAKCONTROL_H
--- trunk/extragear/utils/rsibreak/src/rsiglobals.cpp #1185663:1185664
@@ -1,5 +1,6 @@
 /*
    Copyright (C) 2006,2010 Tom Albers <toma@kde.org>
+   Copyright (C) 2010 Juan Luis Baptiste <juan.baptiste@gmail.com>
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
@@ -70,6 +71,7 @@
     m_intervals["tiny_maximized"] = config.readEntry( "TinyDuration", 20 );
     m_intervals["big_minimized"] = config.readEntry( "BigInterval", 60 ) * 60;
     m_intervals["big_maximized"] = config.readEntry( "BigDuration", 1 ) * 60;
+    m_intervals["postpone_break"] = config.readEntry( "PostponeBreakDuration", 5 ) * 60;
     m_intervals["patience"] = config.readEntry( "Patience", 30 );
 
     if ( config.readEntry( "DEBUG", 0 ) > 0 ) {
@@ -77,6 +79,7 @@
         m_intervals["tiny_minimized"] = m_intervals["tiny_minimized"] / 60;
         m_intervals["big_minimized"] = m_intervals["big_minimized"] / 60;
         m_intervals["big_maximized"] = m_intervals["big_maximized"] / 60;
+	m_intervals["postpone_break"] = m_intervals["postpone_break"] / 60;
     }
 
     // if big_maximized < tiny_maximized, the bigbreaks will not get reset,
--- trunk/extragear/utils/rsibreak/src/rsirelaxpopup.cpp #1185663:1185664
@@ -1,6 +1,7 @@
 /*
    Copyright (C) 2005 Bram Schoenmakers <bramschoenmakers@kde.nl>
    Copyright (C) 2005-2007,2010 Tom Albers <toma@kde.org>
+   Copyright (C) 2010 Juan Luis Baptiste <juan.baptiste@gmail.com>
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
@@ -52,6 +53,10 @@
     m_skipbutton->setToolTip( i18n( "Skip this break" ) );
     connect( m_skipbutton, SIGNAL( clicked() ), SIGNAL( skip() ) );
 
+    m_postponebutton = new QPushButton( SmallIcon( "go-next" ), i18n( "Postpone Break" ), hbox );
+    m_postponebutton->setToolTip( i18n( "Postpone this break" ) );
+    connect( m_postponebutton, SIGNAL( clicked() ), SIGNAL( postpone()) );
+    
     m_lockbutton = new QPushButton( SmallIcon( "system-lock-screen" ), i18n( "Lock Screen" ), hbox );
     m_lockbutton->setToolTip( i18n( "Lock the session" ) );
     connect( m_lockbutton, SIGNAL( clicked() ), SIGNAL( lock() ) );
--- trunk/extragear/utils/rsibreak/src/rsirelaxpopup.h #1185663:1185664
@@ -1,6 +1,7 @@
 /*
    Copyright (C) 2005 Bram Schoenmakers <bramschoenmakers@kde.nl>
    Copyright (C) 2010 Tom Albers <toma@kde.org>
+   Copyright (C) 2010 Juan Luis Baptiste <juan.baptiste@gmail.com>
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
@@ -70,6 +71,9 @@
     /** Ask the main widget to skip the break. */
     void skip();
 
+    /** Ask the main widget to postpone the break. */
+    void postpone();
+
 protected:
     /**
       Changes the background color for 0.5 second. The background is restored
@@ -91,6 +95,7 @@
     QProgressBar *m_progress;
     QPushButton *m_lockbutton;
     QPushButton *m_skipbutton;
+    QPushButton* m_postponebutton;
 };
 
 #endif /* RSIRELAXPOPUP_H */
--- trunk/extragear/utils/rsibreak/src/rsitimer.cpp #1185663:1185664
@@ -1,6 +1,7 @@
 /*
    Copyright (C) 2005-2006,2008-2010 Tom Albers <toma@kde.org>
    Copyright (C) 2005-2006 Bram Schoenmakers <bramschoenmakers@kde.nl>
+   Copyright (C) 2010 Juan Luis Baptiste <juan.baptiste@gmail.com>
 
    The parts for idle detection is based on
    kdepim's karm idletimedetector.cpp/.h
@@ -41,6 +42,7 @@
 #include <QThread>
 #include <kglobal.h>
 #include <QX11Info>
+#include <KDebug>
 
 RSITimer::RSITimer( QObject *parent )
         : QThread( parent ), m_breakRequested( false )
@@ -162,6 +164,7 @@
 void RSITimer::resetAfterTinyBreak()
 {
     m_tiny_left = m_intervals["tiny_minimized"];
+    kDebug() << "********** resetAfterTinyBreak !!";
     resetAfterBreak();
     emit updateToolTip( m_tiny_left, m_big_left );
     RSIGlobals::instance()->NotifyBreak( false, false );
@@ -175,6 +178,7 @@
 void RSITimer::resetAfterBigBreak()
 {
     m_tiny_left = m_intervals["tiny_minimized"];
+    kDebug() << "********** resetAfterBigBreak !!";
     m_big_left = m_intervals["big_minimized"];
     resetAfterBreak();
     emit updateToolTip( m_tiny_left, m_big_left );
@@ -204,6 +208,7 @@
 void RSITimer::slotRestart()
 {
     m_tiny_left = m_intervals["tiny_minimized"];
+    kDebug() << "********** slotRestart !!";
     m_big_left = m_intervals["big_minimized"];
     resetAfterBreak();
     slotStart();
@@ -223,6 +228,20 @@
     slotStart();
 }
 
+void RSITimer::postponeBreak()
+{
+   kDebug() << "kidle: On postponeBreak !!" << m_intervals["postpone_break"];
+   m_patience = 0;
+   m_relax_left = 0;
+   m_pause_left = 0;   
+   m_big_left += m_intervals["postpone_break"];
+   m_tiny_left += m_intervals["postpone_break"];
+   
+   emit relax( -1, false );
+   emit updateToolTip( m_tiny_left, m_big_left );
+   emit minimize();
+}
+
 void RSITimer::slotReadConfig( bool restart )
 {
     QMap<QString, int> oldIntervals = m_intervals;
--- trunk/extragear/utils/rsibreak/src/rsitimer.h #1185663:1185664
@@ -1,6 +1,7 @@
 /*
    Copyright (C) 2005-2006,2008-2010 Tom Albers <toma@kde.org>
    Copyright (C) 2005-2006 Bram Schoenmakers <bramschoenmakers@kde.nl>
+   Copyright (C) 2010 Juan Luis Baptiste <juan.baptiste@gmail.com>
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
@@ -112,6 +113,13 @@
     void skipBreak();
 
     /**
+      When the user presses the postpone break button during a break,
+      this function will be called. It will postpone the break  for the 
+      configured amount of seconds.
+    */
+    void postponeBreak();
+    
+    /**
       Queries X how many seconds the user has been idle. A value of 0
       means there was activity during the last second.
       @returns The amount of seconds of idling.
--- trunk/extragear/utils/rsibreak/src/rsiwidget.cpp #1185663:1185664
@@ -1,6 +1,7 @@
 /*
    Copyright (C) 2005-2006,2009-2010 Tom Albers <toma@kde.org>
    Copyright (C) 2006 Bram Schoenmakers <bramschoenmakers@kde.nl>
+   Copyright (C) 2010 Juan Luis Baptiste <juan.baptiste@gmail.com>
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
@@ -238,6 +239,7 @@
     connect( m_tray, SIGNAL( suspend( bool ) ), m_timer, SLOT( slotSuspended( bool ) ) );
 
     connect( m_relaxpopup, SIGNAL( skip() ), m_timer, SLOT( skipBreak() ) );
+    connect( m_relaxpopup, SIGNAL( postpone() ), m_timer, SLOT( postponeBreak() ) );
 
     first = false;
 }
@@ -300,6 +302,7 @@
     }
     connect( m_effect, SIGNAL( skip() ), m_timer, SLOT( skipBreak() ) );
     connect( m_effect, SIGNAL( lock() ), this, SLOT( slotLock() ) );
+    connect( m_effect, SIGNAL( postpone()),  m_timer, SLOT( postponeBreak() ) );
 
     m_effect->showMinimize( !config.readEntry( "HideMinimizeButton", false ) );
     m_effect->showLock( !config.readEntry( "HideLockButton", false ) );
--- trunk/extragear/utils/rsibreak/src/setuptiming.cpp #1185663:1185664
@@ -1,6 +1,7 @@
 /* ============================================================
  * Copyright (C) 2005-2007,2009-2010 by Tom Albers <toma@kde.org>
  * Copyright (C) 2006 Bram Schoenmakers <bramschoenmakers@kde.nl>
+ * Copyright (C) 2010 Juan Luis Baptiste <juan.baptiste@gmail.com>
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -40,6 +41,7 @@
     KIntNumInput*          tinyDuration;
     KIntNumInput*          bigInterval;
     KIntNumInput*          bigDuration;
+    KIntNumInput*          postponeDuration;
     int                    debug;
 };
 
@@ -114,8 +116,28 @@
     vbox1->addStretch( 1 );
     bigBox->setLayout( vbox1 );
 
+    // ------------------------ Postpone break
+    
+    QGroupBox *postponeBox = new QGroupBox( this );
+    postponeBox->setTitle( i18n( "Postpone Breaks" ) );
+
+    KHBox *m5 = new KHBox( this );
+    QLabel *l5 = new QLabel( i18n( "For a duration of:" ) + ' ', m5 );
+    l5->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
+    l5->setWhatsThis( i18n( "Here you can set for how much time you want to postpone a break." ) );
+    d->postponeDuration = new KIntNumInput( m5 );
+    d->postponeDuration->setRange( 1, 1000, 1 );
+    d->postponeDuration->setSliderEnabled( false );
+    l5->setBuddy( d->postponeDuration );
+
+    QVBoxLayout *vbox2 = new QVBoxLayout( postponeBox );
+    vbox2->addWidget( m5 );
+    vbox2->addStretch( 1 );
+    postponeBox->setLayout( vbox2 );    
+    
     l->addWidget( tinyBox );
     l->addWidget( bigBox );
+    l->addWidget( postponeBox );
     setLayout( l );
     readSettings();
 
@@ -126,6 +148,8 @@
     d->debug > 0 ? d->bigDuration->setSuffix( ki18np( " second", " seconds" ) )
     : d->bigDuration->setSuffix( ki18np( " minute", " minutes" ) );
     d->tinyDuration->setSuffix( ki18np( " second", " seconds" ) );
+    d->debug ? d->postponeDuration->setSuffix( ki18np( " second", " seconds" ) )
+    : d->postponeDuration->setSuffix( ki18np( " minute", " minutes" ) );
 
     slotTinyValueChanged( d->tinyInterval->value() );
 
@@ -134,6 +158,7 @@
     d->bigInterval->setFixedSize( d->tinyInterval->minimumSizeHint() );
     d->tinyDuration->setFixedSize( d->tinyInterval->minimumSizeHint() );
     d->bigDuration->setFixedSize( d->tinyInterval->minimumSizeHint() );
+    d->postponeDuration->setFixedSize( d->tinyInterval->minimumSizeHint() );
 }
 
 SetupTiming::~SetupTiming()
@@ -148,6 +173,7 @@
     config.writeEntry( "TinyDuration", d->tinyDuration->value() );
     config.writeEntry( "BigInterval", d->bigInterval->value() );
     config.writeEntry( "BigDuration", d->bigDuration->value() );
+    config.writeEntry( "PostponeBreakDuration", d->postponeDuration->value() );
     config.sync();
 }
 
@@ -161,6 +187,7 @@
     d->bigInterval->setValue( config.readEntry( "BigInterval", 60 ) );
     d->bigInterval->setMinimum( d->tinyInterval->value() );
     d->bigDuration->setValue( config.readEntry( "BigDuration", 1 ) );
+    d->postponeDuration->setValue( config.readEntry( "PostponeBreakDuration", 5 ) );
 }
 
 void SetupTiming::slotTinyValueChanged( int i )
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic