Logo Search packages:      
Sourcecode: qantenna version File versions  Download package

MainWindow::MainWindow (  ) 

"Calculate at open" CheckBox

Log text with welcome msg

FileList

Start/End calculating events

Definition at line 36 of file mainwindow.cpp.

References antennasWithoutCalc(), calculating, close(), closeAll(), disableFileListEvents, fileListChanged(), fileListNewSelection(), finishedCalc(), listColName, log(), logEndOK(), logStart(), logTextChanged(), renderPath, renderToClipboard(), renderToFile(), startedCalc(), syncFileList(), theData, and ui.

{

      ui.setupUi(this);

      // Instanciation of the data and the nec process
      theData = new DataManager(ui.widgetGL, this);

      // A status bar
      QStatusBar * statusBar = new QStatusBar(this);
      connect(ui.widgetGL,SIGNAL(setStatus(QString, int)),statusBar,
              SLOT(showMessage(const QString & ,int)));
      setStatusBar(statusBar);

      // The magic of sinals/slots for rendering
      connect(ui.widgetGL,SIGNAL(RenderSurface()),
              theData,SLOT(Render()));
      connect(ui.widgetGL,SIGNAL(rebuildLists()),
              theData,SLOT(rebuildLists()));

      // Alpha connection
      connect(ui.horizontalSliderAlpha,SIGNAL(sliderMoved(int)),
              theData,SLOT(setAlpha(int)));

      // Radius connection
      connect(ui.horizontalSliderRadius,SIGNAL(sliderMoved(int)),
              theData,SLOT(setRadius(int)));

      // Scale connection
      connect(ui.horizontalSliderSurfaceScale,SIGNAL(sliderMoved(int)),
              theData,SLOT(setSurfaceSize(int)));

      // Components radius connection
      connect(ui.horizontalSliderSegmentRadius,SIGNAL(sliderMoved(int)),
              theData,SLOT(setComponentsRadius(int)));

      // Minimum dB connection
      connect(ui.doubleSpinBoxDBMinimum,SIGNAL(valueChanged(double)),
              theData,SLOT(setDBMinimum(double)));

      // More signals/slots magic for the grid
      connect(ui.checkBoxGrid,SIGNAL(toggled(bool)),
              theData,SLOT(setRenderGrid(bool)));
      connect(ui.checkBoxGrid,SIGNAL(toggled(bool)),
              ui.widgetGL,SLOT(update()));
      // The grid
      ui.checkBoxGrid->setCheckState(Qt::Checked);

      // The rendering modes
      ui.checkBoxSurface->setCheckState(Qt::Checked);
      ui.checkBoxSpheres->setCheckState(Qt::Unchecked);
      ui.checkBoxMesh->setCheckState(Qt::Unchecked);
      ui.checkBoxInsideTriangles->setCheckState(Qt::Unchecked);

      // The signals and slots magic for the rendering modes
      connect(ui.checkBoxSurface,SIGNAL(toggled(bool)),
              theData,SLOT(setRenderSurface(bool)));
      connect(ui.checkBoxSurface,SIGNAL(toggled(bool)),
              ui.widgetGL,SLOT(update()));

      connect(ui.checkBoxSpheres,SIGNAL(toggled(bool)),
              theData,SLOT(setRenderSpheres(bool)));
      connect(ui.checkBoxSpheres,SIGNAL(toggled(bool)),
              ui.widgetGL,SLOT(update()));
      // Only enable the radius slider when showing spheres
      ui.horizontalSliderRadius->setEnabled(false);
      ui.labelSphereRadius->setEnabled(false);
      connect(ui.checkBoxSpheres,SIGNAL(toggled(bool)),
              ui.horizontalSliderRadius,SLOT(setEnabled(bool)));
      connect(ui.checkBoxSpheres,SIGNAL(toggled(bool)),
              ui.labelSphereRadius,SLOT(setEnabled(bool)));

      connect(ui.checkBoxMesh,SIGNAL(toggled(bool)),
              theData,SLOT(setRenderMesh(bool)));
      connect(ui.checkBoxMesh,SIGNAL(toggled(bool)),
              ui.widgetGL,SLOT(update()));

      connect(ui.checkBoxInsideTriangles,SIGNAL(toggled(bool)),
              theData,SLOT(setRenderInsideTriangles(bool)));
      connect(ui.checkBoxInsideTriangles,SIGNAL(toggled(bool)),
              ui.widgetGL,SLOT(update()));

      /*
        QActions
      */

      // Quit
      connect(ui.actionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));

      // Open
      connect(ui.actionOpen, SIGNAL(triggered()), theData, SLOT(openDialog()));
      // Close[all]
      connect(ui.actionClose, SIGNAL(triggered()), this, SLOT(close()));
      connect(ui.actionCloseAll, SIGNAL(triggered()), this, SLOT(closeAll()));

      // Calculate pattern
      connect(theData, SIGNAL(antennasWithoutCalc(bool)),
              this, SLOT(antennasWithoutCalc(bool)));

      // About
      connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(about()));
      connect(ui.actionAboutQt, SIGNAL(triggered()), this, SLOT(aboutQt()));

      // Render
      connect(ui.actionRender, SIGNAL(triggered()), this, SLOT(renderToFile()));
      connect(ui.actionRenderClipboard, SIGNAL(triggered()), this, SLOT(renderToClipboard()));

      // Assign actions to QToolButtons
      ui.fileListOpen->setDefaultAction(ui.actionOpen);
      ui.fileListClose->setDefaultAction(ui.actionClose);
      ui.fileListCloseAll->setDefaultAction(ui.actionCloseAll);
      ui.fileListCalc->setDefaultAction(ui.actionCalc);

      /*
        Antennas tab
      */

      /// "Calculate at open" CheckBox
      connect(ui.fileListCalculate, SIGNAL(toggled(bool)),
                  theData, SLOT(setCalcAtOpen(bool)));

      /// Log text with welcome msg
      ui.logText->insertHtml("<table width=\"100%\"><tr><td><img src=\":/icons/img/icon.png\"> \
      </td><td valign=middle>"+tr("Welcome to")+" <b>QAntenna</b>!</td></tr></table>");
      connect(ui.logText, SIGNAL(textChanged()),
                  this, SLOT(logTextChanged()));
      // Clear log
      connect(ui.logTextClean, SIGNAL(clicked()),
                  ui.logText, SLOT(clear()));
      // Classes that use the logger
      connect(theData, SIGNAL(logStart(QString, QString)),
                  this, SLOT(logStart(QString, QString)));
      connect(theData, SIGNAL(log(QString)),
                  this, SLOT(log(QString)));
      connect(theData, SIGNAL(logEndOK(bool)),
                  this, SLOT(logEndOK(bool)));

      /// FileList
      // Sync with datamanager
      syncFileList();
      ui.tabParameters->setDisabled(true);
      connect(theData, SIGNAL(updatedAntennaList()),
                  this, SLOT(syncFileList()));
      // Freq change
      connect(ui.fileList, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
                  this, SLOT(fileListChanged(QTreeWidgetItem*, int)));
      // Selection change
      connect(ui.fileList, SIGNAL(itemSelectionChanged()),
                  this, SLOT(fileListNewSelection()));

      // Asign the item delegate
      ui.fileList->setItemDelegate(new AntennaDelegate(listColFrequency, listColIndex));

      // Table options
      ui.fileList->header()->setDefaultAlignment(Qt::AlignLeft);
      ui.fileList->header()->setMovable(false);
      ui.fileList->header()->setStretchLastSection(false);

      ui.fileList->header()->setResizeMode(listColName, QHeaderView::Stretch);
      ui.fileList->header()->setResizeMode(listColFrequency, QHeaderView::Stretch);
      ui.fileList->header()->setResizeMode(listColShow, QHeaderView::ResizeToContents);
      ui.fileList->header()->setResizeMode(listColCalc, QHeaderView::ResizeToContents);

      // The listColPath column contains the full path (used as id)
      ui.fileList->header()->hideSection(listColPath);
      // The listColIndex column contains the DataManager's antenna index
      ui.fileList->header()->hideSection(listColIndex);

      /// Start/End calculating events
      // _Every_ finishedCalc signal means that the file list has to
      // be updated ("gear" field)
      connect(theData, SIGNAL(finishedCalc()), this, SLOT(syncFileList()));
      // Things to do before and after calculating _all_ the patterns
      connect(theData, SIGNAL(finishedAllCalc()),     this, SLOT(finishedCalc()));
      connect(theData, SIGNAL(startedCalc()), this, SLOT(startedCalc()));

      connect(ui.actionCalc, SIGNAL(triggered()),     theData, SLOT(calculateRadiationPattern()));

      /*
        Other
      */

      // render to file/clipboard information
      renderPath= ".";
      renderWidth= 800;
      renderHeight= 600;

      calculating= false;
      disableFileListEvents= false;

      // This should make widgetGL as big as possible
      QList<int> list;
      list << height() << 1;
      ui.splitter_2->setSizes(list);
}


Generated by  Doxygen 1.6.0   Back to index