mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-11 06:45:50 -05:00
Fix Partial Dir Check
Add WrongValue StyleSheet property, when bad directory selected. Update QLineEdit with current setting so it's possible to see if something is modified. No need to restart.
This commit is contained in:
parent
57cff61873
commit
f12cd5774d
9 changed files with 120 additions and 58 deletions
|
|
@ -244,9 +244,15 @@ OpModeStatus[opMode="Minimal"] {
|
|||
background: #FFCCCC;
|
||||
}
|
||||
|
||||
/*Property Values at end to overwrite other settings*/
|
||||
|
||||
[new=false] {
|
||||
background: #F8F8F8;
|
||||
}
|
||||
[new=true] {
|
||||
background: #DCECFD;
|
||||
}
|
||||
|
||||
[WrongValue="true"] {
|
||||
background-color: #FF8080;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,15 +22,17 @@
|
|||
#include "TransferPage.h"
|
||||
|
||||
#include "rshare.h"
|
||||
#include "gui/ShareManager.h"
|
||||
#include "util/misc.h"
|
||||
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
|
||||
#include <QToolTip>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <util/misc.h>
|
||||
#include <gui/ShareManager.h>
|
||||
#include <retroshare/rsiface.h>
|
||||
#include <retroshare/rsfiles.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
|
||||
TransferPage::TransferPage(QWidget * parent, Qt::WindowFlags flags)
|
||||
: ConfigPage(parent, flags)
|
||||
{
|
||||
|
|
@ -225,11 +227,23 @@ void TransferPage::setIncomingDirectory()
|
|||
return;
|
||||
}
|
||||
|
||||
ui.incomingDir->setText(qdir);
|
||||
std::string dir = ui.incomingDir->text().toUtf8().constData();
|
||||
|
||||
if(!dir.empty())
|
||||
rsFiles->setDownloadDirectory(dir);
|
||||
std::string dir = qdir.toUtf8().constData();
|
||||
if(!dir.empty())
|
||||
{
|
||||
if (!rsFiles->setDownloadDirectory(dir))
|
||||
{
|
||||
ui.incomingDir->setToolTip( tr("Invalid Input. Have you got the right to write on it?") );
|
||||
ui.incomingDir->setProperty("WrongValue", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.incomingDir->setToolTip( "" );
|
||||
ui.incomingDir->setProperty("WrongValue", false);
|
||||
}
|
||||
}
|
||||
ui.incomingDir->style()->unpolish(ui.incomingDir);
|
||||
ui.incomingDir->style()->polish( ui.incomingDir);
|
||||
whileBlocking(ui.incomingDir)->setText(QString::fromUtf8(rsFiles->getDownloadDirectory().c_str()));
|
||||
}
|
||||
|
||||
void TransferPage::setPartialsDirectory()
|
||||
|
|
@ -239,11 +253,25 @@ void TransferPage::setPartialsDirectory()
|
|||
return;
|
||||
}
|
||||
|
||||
ui.partialsDir->setText(qdir);
|
||||
std::string dir = ui.partialsDir->text().toUtf8().constData();
|
||||
std::string dir = qdir.toUtf8().constData();
|
||||
if (!dir.empty())
|
||||
rsFiles->setPartialsDirectory(dir);
|
||||
{
|
||||
if (!rsFiles->setPartialsDirectory(dir))
|
||||
{
|
||||
ui.partialsDir->setToolTip( tr("Invalid Input. It can't be an already shared directory.") );
|
||||
ui.partialsDir->setProperty("WrongValue", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.partialsDir->setToolTip( "" );
|
||||
ui.partialsDir->setProperty("WrongValue", false);
|
||||
}
|
||||
}
|
||||
ui.partialsDir->style()->unpolish(ui.partialsDir);
|
||||
ui.partialsDir->style()->polish( ui.partialsDir);
|
||||
whileBlocking(ui.partialsDir)->setText(QString::fromUtf8(rsFiles->getPartialsDirectory().c_str()));
|
||||
}
|
||||
|
||||
void TransferPage::toggleAutoCheckDirectories(bool b)
|
||||
{
|
||||
ui.autoCheckDirectoriesDelay_SB->setEnabled(b);
|
||||
|
|
|
|||
|
|
@ -293,9 +293,16 @@ OpModeStatus[opMode="Minimal"] {
|
|||
background: #700000;
|
||||
}
|
||||
|
||||
/*Property Values at end to overwrite other settings*/
|
||||
|
||||
[new=false] {
|
||||
background: #202020;
|
||||
}
|
||||
[new=true] {
|
||||
background: #005000;
|
||||
}
|
||||
|
||||
[WrongValue=true] {
|
||||
background-color: #702020;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1126,9 +1126,15 @@ OpModeStatus[opMode="Minimal"] {
|
|||
background: #700000;
|
||||
}
|
||||
|
||||
/*Property Values at end to overwrite other settings*/
|
||||
|
||||
[new=false] {
|
||||
background: #202020;
|
||||
}
|
||||
[new=true] {
|
||||
background: #005000;
|
||||
}
|
||||
|
||||
[WrongValue="true"] {
|
||||
background-color: #702020;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue