mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-25 09:11:06 -04:00
implemented a safety check for low disc space, and safe drop of disk access if too low
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2968 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
4d99495361
commit
0634e461fb
18 changed files with 137 additions and 5 deletions
|
@ -191,10 +191,10 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
|||
ui.stackPages->add(messagesDialog = new MessagesDialog(ui.stackPages),
|
||||
messageAction = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp));
|
||||
|
||||
#ifndef RS_RELEASE_VERSION
|
||||
#ifndef RS_RELEASE_VERSION
|
||||
ui.stackPages->add(channelFeed = new ChannelFeed(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BLOGS
|
||||
ui.stackPages->add(blogsFeed = new BlogsDialog(ui.stackPages),
|
||||
|
@ -292,6 +292,28 @@ MainWindow::~MainWindow()
|
|||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::displayDiskSpaceWarning(int loc,int size_limit_mb)
|
||||
{
|
||||
QString locString ;
|
||||
switch(loc)
|
||||
{
|
||||
case RS_PARTIALS_DIRECTORY: locString = "Partials" ;
|
||||
break ;
|
||||
|
||||
case RS_CONFIG_DIRECTORY: locString = "Config" ;
|
||||
break ;
|
||||
|
||||
case RS_DOWNLOAD_DIRECTORY: locString = "Download" ;
|
||||
break ;
|
||||
|
||||
default:
|
||||
std::cerr << "Error: " << __PRETTY_FUNCTION__ << " was called with an unknown parameter loc=" << loc << std::endl ;
|
||||
return ;
|
||||
}
|
||||
QMessageBox::critical(NULL,tr("Low disk space warning"),
|
||||
tr("The disk space in your ")+locString +tr(" directory is running low (current limit is ")+QString::number(size_limit_mb)+tr("MB). \n\n RetroShare will now safely suspend any disk access to this directory. \n\n Please make some free space and click Ok.")) ;
|
||||
}
|
||||
|
||||
/** Creates a tray icon with a context menu and adds it to the system
|
||||
* notification area. */
|
||||
void MainWindow::createTrayIcon()
|
||||
|
|
|
@ -138,6 +138,7 @@ public slots:
|
|||
void updateHashingInfo(const QString&) ;
|
||||
void displayErrorMessage(int,int,const QString&) ;
|
||||
void postModDirectories(bool update_local);
|
||||
void displayDiskSpaceWarning(int loc,int size_limit_mb) ;
|
||||
|
||||
protected:
|
||||
/** Default Constructor */
|
||||
|
|
|
@ -51,6 +51,13 @@ std::string NotifyQt::askForPassword(const std::string& key_details,bool prev_is
|
|||
return res ;
|
||||
}
|
||||
|
||||
void NotifyQt::notifyDiskFull(uint32_t loc,uint32_t size_in_mb)
|
||||
{
|
||||
std::cerr << "Notifyqt:: notified that disk is full" << std::endl ;
|
||||
|
||||
emit diskFull(loc,size_in_mb) ;
|
||||
}
|
||||
|
||||
void NotifyQt::notifyOwnStatusMessageChanged()
|
||||
{
|
||||
#ifdef NOTIFY_DEBUG
|
||||
|
|
|
@ -40,6 +40,8 @@ class NotifyQt: public QObject, public NotifyBase
|
|||
virtual void notifyPeerHasNewAvatar(std::string peer_id) ;
|
||||
virtual void notifyOwnAvatarChanged() ;
|
||||
virtual void notifyOwnStatusMessageChanged() ;
|
||||
virtual void notifyDiskFull(uint32_t loc,uint32_t size_in_mb) ;
|
||||
|
||||
|
||||
virtual std::string askForPassword(const std::string& key_details,bool prev_is_bad) ;
|
||||
|
||||
|
@ -63,6 +65,7 @@ class NotifyQt: public QObject, public NotifyBase
|
|||
void ownAvatarChanged() const ;
|
||||
void ownStatusMessageChanged() const ;
|
||||
void errorOccurred(int,int,const QString&) const ;
|
||||
void diskFull(int,int) const ;
|
||||
|
||||
public slots:
|
||||
|
||||
|
|
|
@ -45,8 +45,11 @@ TransferPage::TransferPage(QWidget * parent, Qt::WFlags flags)
|
|||
else
|
||||
ui._defaultStrategy_CB->setCurrentIndex(1) ;
|
||||
|
||||
ui._diskSpaceLimit_SB->setValue(rsFiles->freeDiskSpaceLimit()) ;
|
||||
|
||||
QObject::connect(ui._queueSize_SB,SIGNAL(valueChanged(int)),this,SLOT(updateQueueSize(int))) ;
|
||||
QObject::connect(ui._defaultStrategy_CB,SIGNAL(activated(int)),this,SLOT(updateDefaultStrategy(int))) ;
|
||||
QObject::connect(ui._diskSpaceLimit_SB,SIGNAL(valueChanged(int)),this,SLOT(updateDiskSizeLimit(int))) ;
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
@ -68,6 +71,11 @@ void TransferPage::updateDefaultStrategy(int i)
|
|||
}
|
||||
}
|
||||
|
||||
void TransferPage::updateDiskSizeLimit(int s)
|
||||
{
|
||||
rsFiles->setFreeDiskSpaceLimit(s) ;
|
||||
}
|
||||
|
||||
void TransferPage::updateQueueSize(int s)
|
||||
{
|
||||
rsFiles->setQueueSize(s) ;
|
||||
|
|
|
@ -43,6 +43,7 @@ class TransferPage: public ConfigPage
|
|||
public slots:
|
||||
void updateQueueSize(int) ;
|
||||
void updateDefaultStrategy(int) ;
|
||||
void updateDiskSizeLimit(int) ;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
<property name="title">
|
||||
<string>Transfer options</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
|
@ -38,6 +38,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Safety disk space limit :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -75,6 +82,25 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="_diskSpaceLimit_SB">
|
||||
<property name="suffix">
|
||||
<string> MB</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -92,7 +118,7 @@ p, li { white-space: pre-wrap; }
|
|||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;">RetroShare</span><span style=" font-size:8pt;"> is capable of transfering data and search requests between peers that are not necessarily friends. This traffic however only transits through a connected list of friends and is anonymous.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">You can separately setup share flags for each shared directory in the shared files dialog to be:</span></p>
|
||||
<ul style="-qt-list-indent: 1;"><li style=" font-size:8pt;" style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Browsable by friends</span>: files are seen by your friends.</li>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-size:8pt;" style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Browsable by friends</span>: files are seen by your friends.</li>
|
||||
<li style=" font-size:8pt;" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Anonymously shared</span>: files are anonymously reachable through distant F2F tunnels.</li></ul></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
|
|
|
@ -136,6 +136,7 @@ int main(int argc, char *argv[])
|
|||
std::cerr << "connecting signals and slots" << std::endl ;
|
||||
QObject::connect(notify,SIGNAL(gotTurtleSearchResult(qulonglong,FileDetail)),w->searchDialog ,SLOT(updateFiles(qulonglong,FileDetail))) ;
|
||||
QObject::connect(notify,SIGNAL(hashingInfoChanged(const QString&)),w ,SLOT(updateHashingInfo(const QString&))) ;
|
||||
QObject::connect(notify,SIGNAL(diskFull(int,int)) ,w ,SLOT(displayDiskSpaceWarning(int,int))) ;
|
||||
QObject::connect(notify,SIGNAL(filesPreModChanged(bool)) ,w->sharedfilesDialog ,SLOT(preModDirectories(bool) )) ;
|
||||
QObject::connect(notify,SIGNAL(filesPostModChanged(bool)) ,w->sharedfilesDialog ,SLOT(postModDirectories(bool) )) ;
|
||||
QObject::connect(notify,SIGNAL(filesPostModChanged(bool)) ,w ,SLOT(postModDirectories(bool) )) ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue