Skip to content

Commit

Permalink
Use foreach when auto saving the classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Jan 2, 2017
1 parent 79b168d commit 0642e41
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions OMEdit/OMEditGUI/MainWindow.cpp
Expand Up @@ -3023,9 +3023,8 @@ void MainWindow::createMenus()
*/
void MainWindow::autoSaveHelper(LibraryTreeItem *pLibraryTreeItem)
{
for (int i = 0; i < pLibraryTreeItem->childrenSize(); i++) {
LibraryTreeItem *pChildLibraryTreeItem = pLibraryTreeItem->child(i);
if (!pChildLibraryTreeItem->isSystemLibrary()) {
foreach (LibraryTreeItem *pChildLibraryTreeItem, pLibraryTreeItem->childrenItems()) {
if (pChildLibraryTreeItem && !pChildLibraryTreeItem->isSystemLibrary()) {
if (pChildLibraryTreeItem->isFilePathValid() && !pChildLibraryTreeItem->isSaved()) {
mpLibraryWidget->saveLibraryTreeItem(pChildLibraryTreeItem);
} else {
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.h
Expand Up @@ -92,6 +92,7 @@ class LibraryTreeItem : public QObject
bool isRootItem() {return mIsRootItem;}
int childrenSize() const {return mChildren.size();}
LibraryTreeItem* childAt(int index) const {return mChildren.at(index);}
QList<LibraryTreeItem*> childrenItems() {return mChildren;}
LibraryType getLibraryType() {return mLibraryType;}
void setLibraryType(LibraryType libraryType) {mLibraryType = libraryType;}
void setSystemLibrary(bool systemLibrary) {mSystemLibrary = systemLibrary;}
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/Options/OptionsDialog.cpp
Expand Up @@ -801,6 +801,7 @@ void OptionsDialog::saveGeneralSettings()
// save auto save
mpSettings->setValue("autoSave/enable", mpGeneralSettingsPage->getEnableAutoSaveGroupBox()->isChecked());
mpSettings->setValue("autoSave/interval", mpGeneralSettingsPage->getAutoSaveIntervalSpinBox()->value());
MainWindow::instance()->getAutoSaveTimer()->setInterval(mpGeneralSettingsPage->getAutoSaveIntervalSpinBox()->value() * 1000);
MainWindow::instance()->toggleAutoSave();
// save welcome page
switch (mpGeneralSettingsPage->getWelcomePageView()) {
Expand Down

0 comments on commit 0642e41

Please sign in to comment.