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 #endif
} }
void OwnCloudSync::setSaveDBTime(qint64 seconds)
{
mSaveDBTimer->stop();
mSaveDBTimer->start(seconds*1000);
}
void OwnCloudSync::setEnabled( bool enabled) void OwnCloudSync::setEnabled( bool enabled)
{ {
mIsEnabled = enabled; mIsEnabled = enabled;

View file

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

View file

@ -126,7 +126,7 @@ SyncWindow::SyncWindow(QWidget *parent) :
updateStatus(); updateStatus();
ui->actionEnable_Delete_Account->setVisible(false); ui->actionEnable_Delete_Account->setVisible(false);
if( mAccounts.size() > 0 && ui->actionHide_on_start->isChecked() ) { if( mAccounts.size() > 0 && mHideOnStart ) {
hide(); hide();
} else { } else {
show(); show();
@ -302,7 +302,7 @@ void SyncWindow::on_buttonSave_clicked()
void SyncWindow::closeEvent(QCloseEvent *event) void SyncWindow::closeEvent(QCloseEvent *event)
{ {
if(mQuitAction || !ui->actionClose_Button_Hides_Window->isChecked()) { if(mQuitAction || !mHideOnClose) {
// Ask the user for confirmation before closing! // Ask the user for confirmation before closing!
QMessageBox box(this); QMessageBox box(this);
box.setText(tr("Are you sure you want to quit? " box.setText(tr("Are you sure you want to quit? "
@ -574,7 +574,7 @@ void SyncWindow::processNextStep()
mBusy = false; mBusy = false;
updateStatus(); updateStatus();
} }
if(mTotalSyncs%1000 == 0 ) { if(mTotalSyncs%mSaveLogCounter == 0 ) {
saveLogs(); saveLogs();
} }
} }
@ -712,10 +712,11 @@ void SyncWindow::saveApplicationSettings()
{ {
QSettings settings("paintblack.com","OwnCloud Sync"); QSettings settings("paintblack.com","OwnCloud Sync");
settings.beginGroup("SyncWindow"); settings.beginGroup("SyncWindow");
settings.setValue("hide_on_start",ui->actionHide_on_start->isChecked()); settings.setValue("hide_on_start",mHideOnStart);
settings.setValue("hide_when_closed", settings.setValue("hide_when_closed",mHideOnClose);
ui->actionClose_Button_Hides_Window->isChecked());
settings.setValue("display_debug",mDisplayDebug); 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.setValue("last_run_version",_OCS_VERSION);
settings.endGroup(); settings.endGroup();
settings.beginGroup("DisabledIncludedFilters"); settings.beginGroup("DisabledIncludedFilters");
@ -733,13 +734,12 @@ void SyncWindow::loadApplicationSettings()
{ {
QSettings settings("paintblack.com","OwnCloud Sync"); QSettings settings("paintblack.com","OwnCloud Sync");
settings.beginGroup("SyncWindow"); settings.beginGroup("SyncWindow");
bool checked = settings.value("hide_on_start").toBool(); mHideOnStart = settings.value("hide_on_start",true).toBool();
ui->actionHide_on_start->setChecked(checked); mHideOnClose = settings.value("hide_when_closed",true).toBool();
ui->actionClose_Button_Hides_Window->setChecked( mDisplayDebug = settings.value("display_debug",false).toBool();
settings.value("hide_when_closed").toBool()); mSaveLogCounter = settings.value("save_log_count",1000).toLongLong();
mDisplayDebug = settings.value("display_debug").toBool(); mSaveDBTime = settings.value("save_db_time",370).toLongLong();
ui->actionDisplay_Debug_Messages->setChecked(mDisplayDebug); QString lastRunVersion = settings.value("last_run_version","").toString();
QString lastRunVersion = settings.value("last_run_version").toString();
if( lastRunVersion != _OCS_VERSION ) { // Need to display what's new if( lastRunVersion != _OCS_VERSION ) { // Need to display what's new
// message // message
displayWhatsNew(); displayWhatsNew();
@ -751,6 +751,9 @@ void SyncWindow::loadApplicationSettings()
!settings.value(mIncludedFilters[i].name).toBool(); !settings.value(mIncludedFilters[i].name).toBool();
} }
settings.endGroup(); settings.endGroup();
// Now update the configuration
on_configurationBox_rejected();
} }
void SyncWindow::on_actionEnable_Delete_Account_triggered() void SyncWindow::on_actionEnable_Delete_Account_triggered()
@ -1041,3 +1044,31 @@ void SyncWindow::displayWhatsNew()
"- Selection of common filters<br />"), "- Selection of common filters<br />"),
QMessageBox::Ok); 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; QQueue<OwnCloudSync*> mAccountsReadyToSync;
bool mQuitAction; bool mQuitAction;
bool mDisplayDebug; bool mDisplayDebug;
bool mHideOnStart;
bool mHideOnClose;
qint64 mSaveLogCounter;
qint64 mSaveDBTime;
QIcon mDefaultIcon; QIcon mDefaultIcon;
QIcon mSyncIcon; QIcon mSyncIcon;
@ -182,6 +186,8 @@ private slots:
void on_buttonGlobalFilterRemove_clicked(); void on_buttonGlobalFilterRemove_clicked();
void on_buttonImport_clicked(); void on_buttonImport_clicked();
void on_buttonExport_clicked(); void on_buttonExport_clicked();
void on_configurationBox_accepted();
void on_configurationBox_rejected();
}; };
// Now create a global filter list // Now create a global filter list

View file

@ -14,8 +14,8 @@
<string>SyncWindow</string> <string>SyncWindow</string>
</property> </property>
<widget class="QWidget" name="centralWidget"> <widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout_8"> <layout class="QGridLayout" name="gridLayout_11">
<item row="1" column="1"> <item row="0" column="0">
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="lineWidth"> <property name="lineWidth">
<number>0</number> <number>0</number>
@ -624,22 +624,6 @@ p, li { white-space: pre-wrap; }
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
</property> </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"> <item row="0" column="0">
<widget class="QTabWidget" name="tabConfigurations"> <widget class="QTabWidget" name="tabConfigurations">
<property name="enabled"> <property name="enabled">
@ -652,19 +636,37 @@ p, li { white-space: pre-wrap; }
</size> </size>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tabConfigure"> <widget class="QWidget" name="tabConfigure">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>true</bool>
</property> </property>
<attribute name="title"> <attribute name="title">
<string>Configure</string> <string>Configure</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_11"> <widget class="QFrame" name="frame_9">
<item row="0" column="1"> <property name="geometry">
<widget class="QLineEdit" name="lineEdit"/> <rect>
</item> <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"> <item row="0" column="0">
<widget class="QLabel" name="label_15"> <widget class="QLabel" name="label_15">
<property name="text"> <property name="text">
@ -686,9 +688,6 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_2"/>
</item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="QLabel" name="label_18"> <widget class="QLabel" name="label_18">
<property name="text"> <property name="text">
@ -696,8 +695,87 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </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"> <widget class="QWidget" name="tabGlobalFilters">
<attribute name="title"> <attribute name="title">
<string>Global Filters</string> <string>Global Filters</string>
@ -801,7 +879,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="4"> <item row="4" column="0" colspan="4">
<widget class="QListView" name="listGlobalFilterView"/> <widget class="QListView" name="listGlobalFilterView"/>
</item> </item>
<item row="1" column="0" colspan="4"> <item row="1" column="0" colspan="4">
@ -866,6 +944,22 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</widget> </widget>
@ -891,10 +985,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
<addaction name="actionConfigure"/> <addaction name="actionConfigure"/>
<addaction name="action_Quit"/> <addaction name="action_Quit"/>
<addaction name="actionHide_on_start"/>
<addaction name="actionClose_Button_Hides_Window"/>
<addaction name="actionEnable_Delete_Account"/> <addaction name="actionEnable_Delete_Account"/>
<addaction name="actionDisplay_Debug_Messages"/>
</widget> </widget>
<widget class="QMenu" name="menuHelp"> <widget class="QMenu" name="menuHelp">
<property name="title"> <property name="title">