Commit 0aec9cc4 authored by Claudio Valerio's avatar Claudio Valerio

fixed issue 765

parent 00f87f85
This diff is collapsed.
......@@ -476,6 +476,8 @@ void UBApplication::closing()
if (webController)
webController->closing();
UBSettings::settings()->closing();
UBSettings::settings()->appToolBarPositionedAtTop->set(mainWindow->toolBarArea(mainWindow->boardToolBar) == Qt::TopToolBarArea);
quit();
......
......@@ -67,8 +67,6 @@ UBPreferencesController::UBPreferencesController(QWidget *parent)
mPreferencesWindow = new UBPreferencesDialog(this,parent, Qt::Dialog);
mPreferencesUI = new Ui::preferencesDialog(); // deleted in
mPreferencesUI->setupUi(mPreferencesWindow);
connect(mPreferencesUI->Username_textBox, SIGNAL(editingFinished()), this, SLOT(onCommunityUsernameChanged()));
connect(mPreferencesUI->Password_textEdit, SIGNAL(editingFinished()), this, SLOT(onCommunityPasswordChanged()));
wire();
}
......@@ -161,6 +159,12 @@ void UBPreferencesController::wire()
connect(mMarkerProperties->pressureSensitiveCheckBox, SIGNAL(clicked(bool)), settings, SLOT(setMarkerPressureSensitive(bool)));
connect(mMarkerProperties->opacitySlider, SIGNAL(valueChanged(int)), this, SLOT(opacitySliderChanged(int)));
//network
connect(mPreferencesUI->Username_textBox, SIGNAL(editingFinished()), this, SLOT(onCommunityUsernameChanged()));
connect(mPreferencesUI->Password_textEdit, SIGNAL(editingFinished()), this, SLOT(onCommunityPasswordChanged()));
connect(mPreferencesUI->PSDataPersistenceCheckBox,SIGNAL(clicked()),this, SLOT(onCommunityPersistenceChanged()));
// about tab
connect(mPreferencesUI->checkSoftwareUpdateAtLaunchCheckBox, SIGNAL(clicked(bool)), settings->appEnableAutomaticSoftwareUpdates, SLOT(setBool(bool)));
}
......@@ -212,18 +216,36 @@ void UBPreferencesController::init()
mMarkerProperties->opacitySlider->setValue(settings->boardMarkerAlpha->get().toDouble() * 100);
//network
mPreferencesUI->PSDataPersistenceCheckBox->setChecked(settings->getCommunityDataPersistence());
persistanceCheckboxUpdate();
}
void UBPreferencesController::onCommunityUsernameChanged()
{
UBSettings* settings = UBSettings::settings();
settings->setCommunityUsername(mPreferencesUI->Username_textBox->text());
persistanceCheckboxUpdate();
}
void UBPreferencesController::onCommunityPasswordChanged()
{
UBSettings* settings = UBSettings::settings();
settings->setCommunityPassword(mPreferencesUI->Password_textEdit->text());
persistanceCheckboxUpdate();
}
void UBPreferencesController::onCommunityPersistenceChanged()
{
UBSettings::settings()->setCommunityPersistence(mPreferencesUI->PSDataPersistenceCheckBox->isChecked());
}
void UBPreferencesController::persistanceCheckboxUpdate()
{
bool checkBoxEnabled = mPreferencesUI->Username_textBox->text().length() || mPreferencesUI->Password_textEdit->text().length();
mPreferencesUI->PSDataPersistenceCheckBox->setEnabled(checkBoxEnabled);
mPreferencesUI->PSDataPersistenceCheckBox->setStyleSheet(checkBoxEnabled ? "color:black;" : "color:lightgray;");
}
......
......@@ -83,12 +83,14 @@ class UBPreferencesController : public QObject
void toolbarOrientationHorizontal(bool checked);
void onCommunityUsernameChanged();
void onCommunityPasswordChanged();
void onCommunityPersistenceChanged();
private:
static qreal sSliderRatio;
static qreal sMinPenWidth;
static qreal sMaxPenWidth;
void persistanceCheckboxUpdate();
};
......
......@@ -357,6 +357,7 @@ void UBSettings::init()
communityUser = new UBSetting(this, "Community", "Username", "");
communityPsw = new UBSetting(this, "Community", "Password", "");
communityDataPersistence = new UBSetting(this,"Community", "DataPeristence",true);
QStringList uris = UBToolsManager::manager()->allToolIDs();
......@@ -392,6 +393,8 @@ void UBSettings::init()
teacherGuideLessonPagesActivated = new UBSetting(this,"DockPalette","TeacherGuideActivateLessonPages",true);
libIconSize = new UBSetting(this, "Library", "LibIconSize", defaultLibraryIconSize);
cleanNonPersistentSettings();
}
......@@ -1180,6 +1183,11 @@ void UBSettings::setCommunityPassword(const QString &password)
communityPsw->set(QVariant(password));
}
void UBSettings::setCommunityPersistence(const bool persistence)
{
communityDataPersistence->set(QVariant(persistence));
}
int UBSettings::libraryIconSize(){
return libIconSize->get().toInt();
}
......@@ -1218,3 +1226,15 @@ QString UBSettings::replaceWildcard(QString& path)
return result;
}
void UBSettings::closing()
{
cleanNonPersistentSettings();
}
void UBSettings::cleanNonPersistentSettings()
{
if(!communityDataPersistence->get().toBool()){
communityPsw->set(QVariant(""));
communityUser->set(QVariant(""));
}
}
......@@ -29,13 +29,14 @@ class UBSettings : public QObject
UBSettings(QObject *parent = 0);
virtual ~UBSettings();
void cleanNonPersistentSettings();
public:
QStringList* supportedKeyboardSizes;
void InitKeyboardPaletteKeyBtnSizes();
void ValidateKeyboardPaletteKeyBtnSize();
void closing();
int penWidthIndex();
......@@ -95,6 +96,8 @@ class UBSettings : public QObject
void setCommunityUsername(const QString& username);
QString communityPassword();
void setCommunityPassword(const QString& password);
bool getCommunityDataPersistence(){return communityDataPersistence->get().toBool();}
void setCommunityPersistence(const bool persistence);
int libraryIconSize();
void setLibraryIconsize(const int& size);
......@@ -337,6 +340,7 @@ class UBSettings : public QObject
UBSetting* communityUser;
UBSetting* communityPsw;
UBSetting* communityDataPersistence;
UBSetting* pageSize;
UBSetting* pageDpi;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment