controller.cpp

来自「This a framework to test new ideas in tr」· C++ 代码 · 共 74 行

CPP
74
字号
/*******************************************************************************//*  Project:        SOFTWARE RADIO - LCM Laboratoire de Communications Mobiles *//*  -------------------------------------------------------------------------- *//*  Filename:       controller.cpp                                             *//*  Description:    calls the main procedures one after the other, holds the   *//*                  'update()' function.                                       *//*  -------------------------------------------------------------------------- *//*  Date:           January 09 2003                                            *//*  Version:        v1.0                                                       *//*  Authors:        Braure Jerome, Ferreiro Jose                               *//*                  Communication Systems (9th semester) - EPFL                *//*******************************************************************************//*******************************************************************************//*  This program is free software; you can redistribute it and/or modify it    *//*  under the terms of the GNU General Public License as published by the Free *//*  Software Foundation; either version 2 of the License, or (at your option)  *//*  any later version.                                                         *//*******************************************************************************/#include <qapplication.h>#include "controller.h"#include "canvasview.h"#include "modulegenerator.h"#include <qobject.h>/*******************************************************************************//* Function:    Controller() - (constuctor)                                    *//* Description: Constructs a controller.                                       *//* Inputs:      mapper:    pointer to the module mapper.                       *//*              canvas:    pointer to the canvas to draw on.                   *//*              modGen:    pointer to the module generator.                    *//*******************************************************************************/Controller::Controller( Mapper* mapper, QCanvas *canvas,                        ModuleGenerator* modGen ) {  this->mapper = mapper;  this->canvas = canvas;  this->modGen = modGen;  // connect( this->modGen, SIGNAL( stfaNbr(int)), canvas, SLOT(slotStfaNbr(int)));};/*******************************************************************************//* Function:    update()                                                       *//* Description: Refreshes the data displayed on the GUI.                       *//* Inputs:      none.                                                          *//* Returns:     void.                                                          *//*******************************************************************************/void Controller::update() {  // delete old module list  mapper->moduleList->setAutoDelete( true );  mapper->moduleList->clear();  // delete everything on canvas  QCanvasItemList allModules = canvas->allItems();  QCanvasItemList::iterator it;  for ( it = allModules.begin(); it != allModules.end(); ++it )    ( *it ) ->hide();  allModules.clear();  // read file system and draw  if ( modGen->readFileSystem() ) {    mapper->map( canvas );    canvas->update();  } else    exit( 0 );};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?