MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); network_ = new Network(this); connect(network_,SIGNAL(listUpdated()), this,SLOT(onRedraw())); this->setFixedSize(this->size()); //QTextCodec::setCodecForLocale(QTextCodec::codecForName("CP-866")); QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu); QAction *act; modeMenu_ = new QMenu(this); act = new QAction(tr("Telnet mode"),this); connect(act,SIGNAL(triggered()),this,SLOT(runTelnet())); modeMenu_->addAction(act); act = new QAction(tr("File mode"),this); connect(act,SIGNAL(triggered()),this,SLOT(runFile())); modeMenu_->addAction(act); act = new QAction(tr("Graphics mode"),this); connect(act,SIGNAL(triggered()),this,SLOT(runGraph())); modeMenu_->addAction(act); modeMenu_->addSeparator(); act = new QAction(tr("Options"),this); connect(act,SIGNAL(triggered()),this,SLOT(runOptions())); modeMenu_->addAction(act); }
void main(void) { int an3now; int an3max = 0; char key; char eepromloc = 0; int eepromval; int eeprommax; char graphclear = 1; Glcd_Init(); Sm_Glcd_Out2(57, 67, "H.S.B V1.0"); Sm_Glcd_Out2(51, 1, "AN3:"); Sm_Glcd_Out2(37, 1, "ROM:"); Sm_Glcd_Out2(0, 1, "MIN"); Sm_Glcd_Out2(10, 1, "MAX"); Sm_Glcd_Out2(20, 1, "MEAN"); //Lines for graph Glcd_H_Line(62, 126, 32, 1); Glcd_V_Line(0,32,62,1); ADCON1 = 0; eepromval = getAn3(eepromloc); showEepromval(eepromval,eeprommax); an3now = ADC_Read(3); intOut(26, 51, an3now); while(1) { an3max = an3now; eeprommax = eepromval; an3now = ADC_Read(3); key = scanKeypad(); if(key == 1) //store an3 value { storeAn3(eepromloc, an3now); eepromval = an3now; } if(key == 2) //switch eeprom bank and return value { if(eepromloc == 0) eepromloc = 16; else if(eepromloc == 16) eepromloc = 32; else if(eepromloc == 32) eepromloc = 0; eepromval = getan3(eepromloc); } if(key == 4 && graphclear == 1) //run graph if it is clear { graphclear = 0; runGraph(); } if(key == 5 && graphclear == 0) //clear graph if it has been run { graphclear = 1; resetGraph(); } key = 0; if(an3now != an3max) { intOut(26, 51, an3now); printBar(0, 59, an3now, an3max); } showEepromval(eepromval, eeprommax); } }