Consolidated all menu configuration into one screen. All are now in the

configurations window.
This commit is contained in:
Juan Carlos Cornejo 2011-12-14 12:01:04 -05:00 committed by Klaas Freitag
parent fcee6235a3
commit 454ca25f11
5 changed files with 208 additions and 73 deletions

View file

@ -139,6 +139,12 @@ OwnCloudSync::OwnCloudSync(QString name, WId id,QSet<QString> *globalFilters)
#endif
}
void OwnCloudSync::setSaveDBTime(qint64 seconds)
{
mSaveDBTimer->stop();
mSaveDBTimer->start(seconds*1000);
}
void OwnCloudSync::setEnabled( bool enabled)
{
mIsEnabled = enabled;

View file

@ -90,6 +90,7 @@ public:
void removeFilter(QString filter);
void hardStop();
void deleteAccount();
void setSaveDBTime(qint64 seconds);
void pause() { mIsPaused = true; }
void resume() {
mIsPaused = false;

View file

@ -126,7 +126,7 @@ SyncWindow::SyncWindow(QWidget *parent) :
updateStatus();
ui->actionEnable_Delete_Account->setVisible(false);
if( mAccounts.size() > 0 && ui->actionHide_on_start->isChecked() ) {
if( mAccounts.size() > 0 && mHideOnStart ) {
hide();
} else {
show();
@ -302,7 +302,7 @@ void SyncWindow::on_buttonSave_clicked()
void SyncWindow::closeEvent(QCloseEvent *event)
{
if(mQuitAction || !ui->actionClose_Button_Hides_Window->isChecked()) {
if(mQuitAction || !mHideOnClose) {
// Ask the user for confirmation before closing!
QMessageBox box(this);
box.setText(tr("Are you sure you want to quit? "
@ -574,7 +574,7 @@ void SyncWindow::processNextStep()
mBusy = false;
updateStatus();
}
if(mTotalSyncs%1000 == 0 ) {
if(mTotalSyncs%mSaveLogCounter == 0 ) {
saveLogs();
}
}
@ -712,10 +712,11 @@ void SyncWindow::saveApplicationSettings()
{
QSettings settings("paintblack.com","OwnCloud Sync");
settings.beginGroup("SyncWindow");
settings.setValue("hide_on_start",ui->actionHide_on_start->isChecked());
settings.setValue("hide_when_closed",
ui->actionClose_Button_Hides_Window->isChecked());
settings.setValue("hide_on_start",mHideOnStart);
settings.setValue("hide_when_closed",mHideOnClose);
settings.setValue("display_debug",mDisplayDebug);
settings.setValue("save_log_count",mSaveLogCounter);
settings.setValue("save_db_time",mSaveDBTime);
settings.setValue("last_run_version",_OCS_VERSION);
settings.endGroup();
settings.beginGroup("DisabledIncludedFilters");
@ -733,13 +734,12 @@ void SyncWindow::loadApplicationSettings()
{
QSettings settings("paintblack.com","OwnCloud Sync");
settings.beginGroup("SyncWindow");
bool checked = settings.value("hide_on_start").toBool();
ui->actionHide_on_start->setChecked(checked);
ui->actionClose_Button_Hides_Window->setChecked(
settings.value("hide_when_closed").toBool());
mDisplayDebug = settings.value("display_debug").toBool();
ui->actionDisplay_Debug_Messages->setChecked(mDisplayDebug);
QString lastRunVersion = settings.value("last_run_version").toString();
mHideOnStart = settings.value("hide_on_start",true).toBool();
mHideOnClose = settings.value("hide_when_closed",true).toBool();
mDisplayDebug = settings.value("display_debug",false).toBool();
mSaveLogCounter = settings.value("save_log_count",1000).toLongLong();
mSaveDBTime = settings.value("save_db_time",370).toLongLong();
QString lastRunVersion = settings.value("last_run_version","").toString();
if( lastRunVersion != _OCS_VERSION ) { // Need to display what's new
// message
displayWhatsNew();
@ -751,6 +751,9 @@ void SyncWindow::loadApplicationSettings()
!settings.value(mIncludedFilters[i].name).toBool();
}
settings.endGroup();
// Now update the configuration
on_configurationBox_rejected();
}
void SyncWindow::on_actionEnable_Delete_Account_triggered()
@ -1041,3 +1044,31 @@ void SyncWindow::displayWhatsNew()
"- Selection of common filters<br />"),
QMessageBox::Ok);
}
void SyncWindow::on_configurationBox_accepted()
{
mSaveLogCounter = ui->spinSaveLogs->value();
mSaveDBTime = ui->spinSaveDB->value();
mHideOnClose = ui->checkCloseButton->isChecked();
mDisplayDebug = ui->checkShowDebug->isChecked();
mHideOnStart = ui->checkHideOnStart->isChecked();
for(int i = 0; i < mAccounts.size(); i++ ) {
mAccounts[i]->setSaveDBTime(mSaveDBTime);
}
// Finally return to the main window
ui->stackedWidget->setCurrentIndex(0);
}
void SyncWindow::on_configurationBox_rejected()
{
// Reset the GUI
ui->spinSaveLogs->setValue(mSaveLogCounter);
ui->spinSaveDB->setValue(mSaveDBTime);
ui->checkCloseButton->setChecked(mHideOnClose);
ui->checkShowDebug->setChecked(mDisplayDebug);
ui->checkHideOnStart->setChecked(mHideOnStart);
// Finally return to the main window
ui->stackedWidget->setCurrentIndex(0);
}

View file

@ -93,6 +93,10 @@ private:
QQueue<OwnCloudSync*> mAccountsReadyToSync;
bool mQuitAction;
bool mDisplayDebug;
bool mHideOnStart;
bool mHideOnClose;
qint64 mSaveLogCounter;
qint64 mSaveDBTime;
QIcon mDefaultIcon;
QIcon mSyncIcon;
@ -182,6 +186,8 @@ private slots:
void on_buttonGlobalFilterRemove_clicked();
void on_buttonImport_clicked();
void on_buttonExport_clicked();
void on_configurationBox_accepted();
void on_configurationBox_rejected();
};
// Now create a global filter list

View file

@ -14,8 +14,8 @@
<string>SyncWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout_8">
<item row="1" column="1">
<layout class="QGridLayout" name="gridLayout_11">
<item row="0" column="0">
<widget class="QStackedWidget" name="stackedWidget">
<property name="lineWidth">
<number>0</number>
@ -624,22 +624,6 @@ p, li { white-space: pre-wrap; }
<property name="margin">
<number>0</number>
</property>
<item row="1" column="0">
<widget class="QPushButton" name="buttonReturn">
<property name="text">
<string>Return to Main Window</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QTabWidget" name="tabConfigurations">
<property name="enabled">
@ -652,51 +636,145 @@ p, li { white-space: pre-wrap; }
</size>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tabConfigure">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<attribute name="title">
<string>Configure</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_11">
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Save database every</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_16">
<property name="text">
<string>seconds.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_17">
<property name="text">
<string>Save and clear log every</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_2"/>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_18">
<property name="text">
<string>syncs.</string>
</property>
</widget>
</item>
</layout>
<widget class="QFrame" name="frame_9">
<property name="geometry">
<rect>
<x>0</x>
<y>10</y>
<width>361</width>
<height>91</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Save database every</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_16">
<property name="text">
<string>seconds.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_17">
<property name="text">
<string>Save and clear log every</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_18">
<property name="text">
<string>syncs.</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinSaveLogs">
<property name="maximum">
<number>99999999</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinSaveDB">
<property name="maximum">
<number>2593000</number>
</property>
<property name="value">
<number>370</number>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QFrame" name="frame_10">
<property name="geometry">
<rect>
<x>0</x>
<y>100</y>
<width>361</width>
<height>85</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkHideOnStart">
<property name="text">
<string>Hide on start</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkCloseButton">
<property name="text">
<string>Close button hides window</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkShowDebug">
<property name="text">
<string>Display Debug Messages</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QDialogButtonBox" name="configurationBox">
<property name="geometry">
<rect>
<x>100</x>
<y>190</y>
<width>167</width>
<height>25</height>
</rect>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</widget>
<widget class="QWidget" name="tabGlobalFilters">
<attribute name="title">
@ -801,7 +879,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="3" column="0" colspan="4">
<item row="4" column="0" colspan="4">
<widget class="QListView" name="listGlobalFilterView"/>
</item>
<item row="1" column="0" colspan="4">
@ -866,6 +944,22 @@ p, li { white-space: pre-wrap; }
</widget>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="buttonReturn">
<property name="text">
<string>Return to Main Window</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -891,10 +985,7 @@ p, li { white-space: pre-wrap; }
</property>
<addaction name="actionConfigure"/>
<addaction name="action_Quit"/>
<addaction name="actionHide_on_start"/>
<addaction name="actionClose_Button_Hides_Window"/>
<addaction name="actionEnable_Delete_Account"/>
<addaction name="actionDisplay_Debug_Messages"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">