r19064 by jghali - remove some unnecessary indentation levels
scribus-commit
scribus-commit at lists.scribus.net
Sun Apr 20 22:02:26 UTC 2014
Author: jghali
Date: Sun Apr 20 22:02:25 2014
New Revision: 19064
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19064
Log:
remove some unnecessary indentation levels
Modified:
trunk/Scribus/scribus/ui/scrapbookpalette.cpp
Modified: trunk/Scribus/scribus/ui/scrapbookpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19064&path=/trunk/Scribus/scribus/ui/scrapbookpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrapbookpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/scrapbookpalette.cpp Sun Apr 20 22:02:25 2014
@@ -792,146 +792,8 @@
for (int rd = 0; rd < fileNames.count(); ++rd)
{
QString fileName = fileNames[rd];
- if (!fileName.isEmpty())
- {
- QDir d(fileName);
- activeBView = new BibView(this);
- QFileInfo fd(fileName);
- activeBView->canWrite = fd.isWritable();
- activeBView->setAcceptDrops(activeBView->canWrite);
- if (activeBView->canWrite)
- Frame3->addItem(activeBView, d.dirName());
- else
- Frame3->addItem(activeBView, QIcon(loadIcon("16/lock.png")), d.dirName());
- activeBView->ReadContents(fileName);
- activeBView->ScFilename = fileName;
- activeBView->visibleName = d.dirName();
- ScCore->fileWatcher->addDir(d.absolutePath(), true);
- activeBView->scrollToTop();
- }
- }
- activeBView = (BibView*)Frame3->widget(0);
- Frame3->setCurrentIndex(0);
- upButton->setEnabled(false);
- updateView();
- connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
- connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
- connect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
- connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
- connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
-}
-
-QStringList Biblio::getOpenScrapbooks()
-{
- QStringList ret;
- ret.clear();
- if (Frame3->count() > 2) // omit the first 2 Tabs since they contain the main and temp scrapbook
- {
- for (int a = 2; a < Frame3->count(); a++)
- {
- BibView* bv = (BibView*)Frame3->widget(a);
- ret.append(bv->ScFilename);
- }
- }
- return ret;
-}
-
-QStringList Biblio::getOpenScrapbooksNames()
-{
- QStringList ret;
- ret.clear();
- for (int a = 0; a < Frame3->count(); a++)
- {
- BibView* bv = (BibView*)Frame3->widget(a);
- ret.append(bv->visibleName);
- }
- return ret;
-}
-
-void Biblio::setScrapbookFileName(QString fileName)
-{
- activeBView->ScFilename=fileName;
-}
-
-const QString Biblio::getScrapbookFileName()
-{
- return activeBView->ScFilename;
-}
-
-const int Biblio::objectCount()
-{
- return activeBView->objectMap.count();
-}
-
-bool Biblio::tempHasContents()
-{
- return (!tempBView->objectMap.isEmpty());
-}
-
-void Biblio::readOldContents(QString fileName, QString newName)
-{
- activeBView->ReadOldContents(fileName, newName);
- activeBView->scrollToTop();
-}
-
-void Biblio::readContents(QString fileName)
-{
- activeBView->ReadContents(fileName);
-}
-
-void Biblio::readTempContents(QString fileName)
-{
- tempBView->ReadContents(fileName);
- tempBView->ScFilename = fileName;
- tempCount = tempBView->objectMap.count();
-}
-
-void Biblio::installEventFilter(QObject *filterObj)
-{
-// ScrPaletteBase::installEventFilter(filterObj);
- activeBView->installEventFilter(filterObj);
- tempBView->installEventFilter(filterObj);
-}
-
-void Biblio::updateView()
-{
- for (int a = 0; a < Frame3->count(); a++)
- {
- BibView* bv = (BibView*)Frame3->widget(a);
- QMap<QString, BibView::Elem>::Iterator itf;
- for (itf = bv->objectMap.begin(); itf != bv->objectMap.end(); ++itf)
- {
- if (itf.value().isDir)
- itf.value().widgetItem->setHidden(conf_HideDirs->isChecked());
- if (itf.value().isRaster)
- itf.value().widgetItem->setHidden(conf_HideImages->isChecked());
- if (itf.value().isVector)
- itf.value().widgetItem->setHidden(conf_HideVectors->isChecked());
- }
- }
- prefs->set("hideDirs", conf_HideDirs->isChecked());
- prefs->set("hideImages", conf_HideImages->isChecked());
- prefs->set("hideVectors", conf_HideVectors->isChecked());
- prefs->set("openMode", conf_OpenMode->isChecked());
-}
-
-void Biblio::NewLib()
-{
- PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
- QString fileName = QFileDialog::getExistingDirectory(this, tr("Choose a Scrapbook Directory"), dirs->get("scrap_load", "."));
- if (!fileName.isEmpty())
- {
- for (int a = 0; a < Frame3->count(); a++)
- {
- BibView* bv = (BibView*)Frame3->widget(a);
- if (fileName == bv->ScFilename)
- return;
- }
- disconnect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
- disconnect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
- disconnect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
- disconnect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
- disconnect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
+ if (fileName.isEmpty())
+ continue;
QDir d(fileName);
activeBView = new BibView(this);
QFileInfo fd(fileName);
@@ -944,20 +806,157 @@
activeBView->ReadContents(fileName);
activeBView->ScFilename = fileName;
activeBView->visibleName = d.dirName();
- Frame3->setCurrentWidget(activeBView);
ScCore->fileWatcher->addDir(d.absolutePath(), true);
- d.cdUp();
- dirs->set("scrap_load", d.absolutePath());
activeBView->scrollToTop();
- upButton->setEnabled(!((Frame3->currentIndex() == 0) || (Frame3->currentIndex() == 1)));
- updateView();
- connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
- connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
- connect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
- connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
- connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
- emit scrapbookListChanged();
- }
+ }
+ activeBView = (BibView*)Frame3->widget(0);
+ Frame3->setCurrentIndex(0);
+ upButton->setEnabled(false);
+ updateView();
+ connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
+ connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
+ connect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
+ connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
+ connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
+}
+
+QStringList Biblio::getOpenScrapbooks()
+{
+ QStringList ret;
+ ret.clear();
+ if (Frame3->count() > 2) // omit the first 2 Tabs since they contain the main and temp scrapbook
+ {
+ for (int a = 2; a < Frame3->count(); a++)
+ {
+ BibView* bv = (BibView*)Frame3->widget(a);
+ ret.append(bv->ScFilename);
+ }
+ }
+ return ret;
+}
+
+QStringList Biblio::getOpenScrapbooksNames()
+{
+ QStringList ret;
+ ret.clear();
+ for (int a = 0; a < Frame3->count(); a++)
+ {
+ BibView* bv = (BibView*)Frame3->widget(a);
+ ret.append(bv->visibleName);
+ }
+ return ret;
+}
+
+void Biblio::setScrapbookFileName(QString fileName)
+{
+ activeBView->ScFilename=fileName;
+}
+
+const QString Biblio::getScrapbookFileName()
+{
+ return activeBView->ScFilename;
+}
+
+const int Biblio::objectCount()
+{
+ return activeBView->objectMap.count();
+}
+
+bool Biblio::tempHasContents()
+{
+ return (!tempBView->objectMap.isEmpty());
+}
+
+void Biblio::readOldContents(QString fileName, QString newName)
+{
+ activeBView->ReadOldContents(fileName, newName);
+ activeBView->scrollToTop();
+}
+
+void Biblio::readContents(QString fileName)
+{
+ activeBView->ReadContents(fileName);
+}
+
+void Biblio::readTempContents(QString fileName)
+{
+ tempBView->ReadContents(fileName);
+ tempBView->ScFilename = fileName;
+ tempCount = tempBView->objectMap.count();
+}
+
+void Biblio::installEventFilter(QObject *filterObj)
+{
+// ScrPaletteBase::installEventFilter(filterObj);
+ activeBView->installEventFilter(filterObj);
+ tempBView->installEventFilter(filterObj);
+}
+
+void Biblio::updateView()
+{
+ for (int a = 0; a < Frame3->count(); a++)
+ {
+ BibView* bv = (BibView*)Frame3->widget(a);
+ QMap<QString, BibView::Elem>::Iterator itf;
+ for (itf = bv->objectMap.begin(); itf != bv->objectMap.end(); ++itf)
+ {
+ if (itf.value().isDir)
+ itf.value().widgetItem->setHidden(conf_HideDirs->isChecked());
+ if (itf.value().isRaster)
+ itf.value().widgetItem->setHidden(conf_HideImages->isChecked());
+ if (itf.value().isVector)
+ itf.value().widgetItem->setHidden(conf_HideVectors->isChecked());
+ }
+ }
+ prefs->set("hideDirs", conf_HideDirs->isChecked());
+ prefs->set("hideImages", conf_HideImages->isChecked());
+ prefs->set("hideVectors", conf_HideVectors->isChecked());
+ prefs->set("openMode", conf_OpenMode->isChecked());
+}
+
+void Biblio::NewLib()
+{
+ PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
+ QString fileName = QFileDialog::getExistingDirectory(this, tr("Choose a Scrapbook Directory"), dirs->get("scrap_load", "."));
+ if (fileName.isEmpty())
+ return;
+
+ for (int a = 0; a < Frame3->count(); a++)
+ {
+ BibView* bv = (BibView*)Frame3->widget(a);
+ if (fileName == bv->ScFilename)
+ return;
+ }
+ disconnect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
+ disconnect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
+ disconnect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
+ disconnect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
+ disconnect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
+ QDir d(fileName);
+ activeBView = new BibView(this);
+ QFileInfo fd(fileName);
+ activeBView->canWrite = fd.isWritable();
+ activeBView->setAcceptDrops(activeBView->canWrite);
+ if (activeBView->canWrite)
+ Frame3->addItem(activeBView, d.dirName());
+ else
+ Frame3->addItem(activeBView, QIcon(loadIcon("16/lock.png")), d.dirName());
+ activeBView->ReadContents(fileName);
+ activeBView->ScFilename = fileName;
+ activeBView->visibleName = d.dirName();
+ Frame3->setCurrentWidget(activeBView);
+ ScCore->fileWatcher->addDir(d.absolutePath(), true);
+ d.cdUp();
+ dirs->set("scrap_load", d.absolutePath());
+ activeBView->scrollToTop();
+ upButton->setEnabled(!((Frame3->currentIndex() == 0) || (Frame3->currentIndex() == 1)));
+ updateView();
+ connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
+ connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
+ connect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
+ connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
+ connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
+ emit scrapbookListChanged();
}
void Biblio::Import()
@@ -990,27 +989,25 @@
close();
if ((Frame3->currentIndex() == 0) || (Frame3->currentIndex() == 1))
return;
- else
- {
- disconnect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
- disconnect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
- disconnect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
- disconnect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
- disconnect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
- QFileInfo fi(activeBView->ScFilename);
- ScCore->fileWatcher->removeDir(fi.absolutePath());
- Frame3->removeItem(Frame3->indexOf(activeBView));
- delete activeBView; // currently disabled as the whole TabWidget vanishes when executing that delete????? -> seems to be fixed in Qt-4.3.3
- activeBView = (BibView*)Frame3->widget(0);
- Frame3->setCurrentIndex(0);
- upButton->setEnabled(!((Frame3->currentIndex() == 0) || (Frame3->currentIndex() == 1)));
- connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
- connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
- connect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
- connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
- connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
- emit scrapbookListChanged();
- }
+
+ disconnect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
+ disconnect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
+ disconnect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
+ disconnect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
+ disconnect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
+ QFileInfo fi(activeBView->ScFilename);
+ ScCore->fileWatcher->removeDir(fi.absolutePath());
+ Frame3->removeItem(Frame3->indexOf(activeBView));
+ delete activeBView; // currently disabled as the whole TabWidget vanishes when executing that delete????? -> seems to be fixed in Qt-4.3.3
+ activeBView = (BibView*)Frame3->widget(0);
+ Frame3->setCurrentIndex(0);
+ upButton->setEnabled(!((Frame3->currentIndex() == 0) || (Frame3->currentIndex() == 1)));
+ connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
+ connect(activeBView, SIGNAL(objDropped(QString)), this, SLOT(ObjFromMenu(QString)));
+ connect(activeBView, SIGNAL(fileDropped(QString, int)), this, SLOT(ObjFromFile(QString, int)));
+ connect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
+ connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
+ emit scrapbookListChanged();
}
void Biblio::libChanged(int index)
More information about the scribus-commit
mailing list