]> Shamusworld >> Repos - architektonas/blobdiff - src/mainapp/applicationwindow.cpp
Fixed spurious library paths being added to Library Browser.
[architektonas] / src / mainapp / applicationwindow.cpp
index 22580a043e344ce1b0a537721bc9fe9974ee6c44..0566beb287f12d6aba77a1d1c78b6f1d4cac238e 100644 (file)
@@ -215,7 +215,7 @@ void ApplicationWindow::slotRunScript(const QString & name)
     statusBar()->showMessage(tr("Running script '%1'").arg(name), 2000);
 
        QStringList scriptList = RS_SYSTEM->getScriptList();
-       scriptList.append(RS_SYSTEM->getHomeDir() + "/.qcad/" + name);
+       scriptList.append(RS_SYSTEM->getHomeDir() + "/.architektonas/" + name);
 
        for (QStringList::Iterator it = scriptList.begin(); it!=scriptList.end(); ++it)
        {
@@ -1498,9 +1498,11 @@ void ApplicationWindow::initView()
 //     dw->setCaption(tr("Library Browser"));
 //not sure how to fix this one
 #warning "QMainWindow::addDockWidget: invalid 'area' argument"
-       addDockWidget(Qt::NoDockWidgetArea, dw);
+//     addDockWidget(Qt::NoDockWidgetArea, dw);
+//This works, but sux
+       addDockWidget(Qt::RightDockWidgetArea, dw);
        libraryDockWindow = dw;
-       libraryDockWindow->hide();
+//     libraryDockWindow->hide();
 
        RS_DEBUG->print("  command widget..");
 //     dw = new QDockWidget(QDockWidget::InDock, this, "Command");
@@ -1627,6 +1629,7 @@ void ApplicationWindow::slotWindowActivated(QMdiSubWindow * /*w*/)
 //which means the subwindow is NOT being activated!!!
        MDIWindow * m = getMDIWindow();
        RS_DEBUG->print(/*RS_Debug::D_CRITICAL,*/ "ApplicationWindow::slotWindowActivated m=%08X", m);
+
        if (m)
                RS_DEBUG->print(/*RS_Debug::D_CRITICAL,*/ "ApplicationWindow::slotWindowActivated m->getDoc=%08X", m->getDocument());
 
@@ -1661,7 +1664,7 @@ void ApplicationWindow::slotWindowActivated(QMdiSubWindow * /*w*/)
                slotPenChanged(penToolBar->getPen());
 
                // update toggle button status:
-               if (m->getGraphic() != NULL)
+               if (m->getGraphic())
                {
                        emit(gridChanged(m->getGraphic()->isGridOn()));
                        emit(printPreviewChanged(m->getGraphicView()->isPrintPreview()));
@@ -2018,7 +2021,6 @@ void ApplicationWindow::slotFileOpenRecent(void)
 void ApplicationWindow::slotFileOpen(const QString & fileName, RS2::FormatType type)
 {
        RS_DEBUG->print("ApplicationWindow::slotFileOpen(..)");
-
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
 
        if (!fileName.isEmpty())
@@ -2026,10 +2028,6 @@ void ApplicationWindow::slotFileOpen(const QString & fileName, RS2::FormatType t
                RS_DEBUG->print("ApplicationWindow::slotFileOpen: creating new doc window");
                // Create new document window:
                MDIWindow * w = slotFileNew();
-//             RS_APP->processEvents(1000);
-//Really, is this needed???
-//             RS_APP->processEvents(QEventLoop::AllEvents, 1000);
-
                RS_DEBUG->print("ApplicationWindow::slotFileOpen: linking layer list");
                // link the layer widget to the new document:
                layerWidget->setLayerList(w->getDocument()->getLayerList(), false);
@@ -2041,15 +2039,10 @@ void ApplicationWindow::slotFileOpen(const QString & fileName, RS2::FormatType t
                // link the layer widget to the new document:
                simulationControls->setGraphicView(w->getGraphicView());
 #endif
-
                RS_DEBUG->print("ApplicationWindow::slotFileOpen: open file");
 
-//             RS_APP->processEvents(1000);
-//We no longer try to do Qt better than the Qt folks...
-//             RS_APP->processEvents(QEventLoop::AllEvents, 1000);
-
-               // open the file in the new view:
-               if (w->slotFileOpen(fileName, type) == false)
+               // Open the file in the new view:
+               if (!w->slotFileOpen(fileName, type))
                {
                        // error
                        QApplication::restoreOverrideCursor();
@@ -2070,24 +2063,20 @@ void ApplicationWindow::slotFileOpen(const QString & fileName, RS2::FormatType t
                        recentFiles->add(fileName);
 
                RS_DEBUG->print("ApplicationWindow::slotFileOpen: update recent file menu: 2");
-//             updateRecentFilesMenu();
                recentFiles->UpdateGUI();
-
                RS_DEBUG->print("ApplicationWindow::slotFileOpen: update recent file menu: OK");
-
                RS_DEBUG->print("ApplicationWindow::slotFileOpen: set caption");
                // update caption:
-//             w->setCaption(fileName);
                w->setWindowTitle(fileName);
                RS_DEBUG->print("ApplicationWindow::slotFileOpen: set caption: OK");
-
                RS_DEBUG->print("ApplicationWindow::slotFileOpen: update coordinate widget");
                // update coordinate widget format:
                RS_DIALOGFACTORY->updateCoordinateWidget(Vector(0.0, 0.0), Vector(0.0, 0.0), true);
                RS_DEBUG->print("ApplicationWindow::slotFileOpen: update coordinate widget: OK");
-
+               // Update the layer and block widgets (document just loaded may have some)
+               layerWidget->update();
+               blockWidget->update();
                // show output of filter (if any):
-//             commandWidget->processStderr();
                QString message = tr("Loaded document: ") + fileName;
                commandWidget->appendHistory(message);
                statusBar()->showMessage(message, 2000);
@@ -2188,14 +2177,12 @@ void ApplicationWindow::slotFileSaveAs()
 void ApplicationWindow::slotFileExport()
 {
        RS_DEBUG->print("ApplicationWindow::slotFileExport()");
-
        statusBar()->showMessage(tr("Exporting drawing..."));
-
        MDIWindow * w = getMDIWindow();
-       QString fn;
 
-       if (w != NULL)
+       if (w)
        {
+               QString fn;
                // read default settings:
                settings.beginGroup("Paths");
                QString defDir = settings.value("ExportImage", RS_SYSTEM->getHomeDir()).toString();
@@ -2323,7 +2310,7 @@ bool ApplicationWindow::slotFileExport(const QString & name, const QString & for
 {
        MDIWindow * w = getMDIWindow();
 
-       if (w == NULL)
+       if (!w)
        {
                RS_DEBUG->print(RS_Debug::D_WARNING, "ApplicationWindow::slotFileExport: no window opened");
                return false;
@@ -2331,7 +2318,7 @@ bool ApplicationWindow::slotFileExport(const QString & name, const QString & for
 
        Drawing * graphic = w->getDocument()->getGraphic();
 
-       if (graphic == NULL)
+       if (!graphic)
        {
                RS_DEBUG->print(RS_Debug::D_WARNING, "ApplicationWindow::slotFileExport: no graphic");
                return false;
@@ -2388,7 +2375,7 @@ bool ApplicationWindow::slotFileExport(const QString & name, const QString & for
                ret = true;
        }
 #else
-#warning "Need to port to Qt4... !!! FIX !!!"
+#warning "ApplicationWindow::slotFileExport(): Need to port to Qt4... !!! FIX !!!"
 #endif
 
        QApplication::restoreOverrideCursor();
@@ -2416,7 +2403,7 @@ void ApplicationWindow::slotFileClose()
 
        MDIWindow * m = getMDIWindow();
 
-       if (m != NULL)
+       if (m)
 //             m->close(true);
                m->close();
 
@@ -2489,6 +2476,7 @@ void ApplicationWindow::slotFilePrint()
        // printer setup:
 //     if (printer->setup(this))
        QPrintDialog dialog(printer, this);
+
        if (dialog.exec())
        {
                //printer->setOutputToFile(true);
@@ -2551,7 +2539,7 @@ void ApplicationWindow::slotFilePrintPreview(bool on)
        RS_DEBUG->print("  creating MDI window");
        MDIWindow * parent = getMDIWindow();
 
-       if (parent == NULL)
+       if (!parent)
        {
                RS_DEBUG->print(RS_Debug::D_WARNING, "ApplicationWindow::slotFilePrintPreview: no window opened");
                return;
@@ -2660,6 +2648,7 @@ void ApplicationWindow::slotFileQuit()
                qApp->exit(0);
 }
 
+#if 0
 /**
  * Forces termination of QCad (demo version).
  */
@@ -2670,6 +2659,7 @@ void ApplicationWindow::slotFileDemoQuit()
        queryExit(true);
        qApp->exit(0);
 }
+#endif
 
 /**
  * Shows / hides the grid.
@@ -2957,7 +2947,7 @@ void ApplicationWindow::slotHelpAbout()
 
        QString modulesString;
 
-       if (modules.empty() == false)
+       if (!modules.empty())
                modulesString = modules.join(", ");
        else
                modulesString = tr("None");
@@ -2975,6 +2965,8 @@ void ApplicationWindow::slotHelpAbout()
                tr("Version: %1").arg("1.0.0") + "<br>" +
                tr("Date: %1").arg(__DATE__) + "<br>" +
                QString("&copy; 2010 Underground Software,<br>James Hammons") +
+               "<br>" +
+               QString("Portions &copy; 2001-2003 RibbonSoft") +
                "<br>"
 #ifdef QC_ABOUT_ADD_COMPANY
                + QString("<br>") + QC_ABOUT_ADD_COMPANY