mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
new methods for set and get the max time before idle on RshareSettings
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3308 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e3e4c97369
commit
423f6811ce
@ -129,7 +129,7 @@
|
||||
|
||||
/** Constructor */
|
||||
MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
: RWindow("MainWindow", parent, flags), maxTimeBeforeIdle(30)
|
||||
: RWindow("MainWindow", parent, flags)
|
||||
{
|
||||
/* Invoke the Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
@ -876,9 +876,10 @@ void MainWindow::loadOwnStatus()
|
||||
|
||||
void MainWindow::checkAndSetIdle(int idleTime)
|
||||
{
|
||||
if ((idleTime >= (int) maxTimeBeforeIdle) && !isIdle) {
|
||||
int maxTimeBeforeIdle = Settings->getMaxTimeBeforeIdle();
|
||||
if ((idleTime >= maxTimeBeforeIdle) && !isIdle) {
|
||||
setIdle(true);
|
||||
} else if ((idleTime < (int) maxTimeBeforeIdle) && isIdle) {
|
||||
} else if ((idleTime < maxTimeBeforeIdle) && isIdle) {
|
||||
setIdle(false);
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,6 @@ private:
|
||||
// idle function
|
||||
void setIdle(bool Idle);
|
||||
bool isIdle;
|
||||
const unsigned long maxTimeBeforeIdle;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::MainWindow ui;
|
||||
|
@ -87,6 +87,8 @@ RshareSettings *Settings = NULL;
|
||||
/** Default Constructor */
|
||||
RshareSettings::RshareSettings()
|
||||
{
|
||||
m_maxTimeBeforeIdle = -1;
|
||||
|
||||
initSettings();
|
||||
}
|
||||
|
||||
@ -375,3 +377,19 @@ void RshareSettings::setMsgSetToReadOnActivate (bool bValue)
|
||||
{
|
||||
setValueToGroup("MessageDialog", "SetMsgToReadOnActivate", bValue);
|
||||
}
|
||||
|
||||
/* time before idle */
|
||||
uint RshareSettings::getMaxTimeBeforeIdle()
|
||||
{
|
||||
if (m_maxTimeBeforeIdle == -1) {
|
||||
m_maxTimeBeforeIdle = valueFromGroup("General", "maxTimeBeforeIdle", 30).toUInt();
|
||||
}
|
||||
|
||||
return m_maxTimeBeforeIdle;
|
||||
}
|
||||
|
||||
void RshareSettings::setMaxTimeBeforeIdle(uint nValue)
|
||||
{
|
||||
m_maxTimeBeforeIdle = nValue;
|
||||
setValueToGroup("General", "maxTimeBeforeIdle", nValue);
|
||||
}
|
||||
|
@ -133,11 +133,18 @@ public:
|
||||
bool getMsgSetToReadOnActivate ();
|
||||
void setMsgSetToReadOnActivate (bool bValue);
|
||||
|
||||
/* time before idle */
|
||||
uint getMaxTimeBeforeIdle();
|
||||
void setMaxTimeBeforeIdle(uint nValue);
|
||||
|
||||
protected:
|
||||
/** Default constructor. */
|
||||
RshareSettings();
|
||||
|
||||
void initSettings();
|
||||
|
||||
/* member for fast access */
|
||||
int m_maxTimeBeforeIdle;
|
||||
};
|
||||
|
||||
// the one and only global settings object
|
||||
|
Loading…
Reference in New Issue
Block a user