helpBrowser::helpBrowser() { browser_ = new QTextBrowser(this); connect(browser_, SIGNAL(forwardAvailable(bool )), this, SLOT(forwardAvailable(bool ))); connect(browser_, SIGNAL(backwardAvailable(bool )), this, SLOT(backwardAvailable(bool ))); setCentralWidget(browser_); printAction_ = new QAction(QIcon(":print.png"), tr("Print this help page"), this); connect(printAction_, SIGNAL(triggered()), this, SLOT(processPrint())); printAllAction_ = new QAction(QIcon(":print_all.png"), tr("Print all help pages"), this); connect(printAllAction_, SIGNAL(triggered()), this, SLOT(processPrintAll())); backAction_ = new QAction(QIcon(":leftArrow.png"), tr("Back"), this); backAction_->setEnabled(false); connect(backAction_, SIGNAL(triggered()), this, SLOT(processBack())); forwardAction_ = new QAction(QIcon(":rightArrow.png"), tr("Forward"), this); forwardAction_->setEnabled(false); connect(forwardAction_, SIGNAL(triggered()), this, SLOT(processForward())); toolBar_ = addToolBar(tr("Toolbar")); toolBar_->addAction(printAction_); toolBar_->addAction(printAllAction_); toolBar_->addAction(backAction_); toolBar_->addAction(forwardAction_); resize(800, 600); }
//Beginning of main(void) int main(void) { //Initializes variables struct holeStruct holeData[MAX_HOLES]; struct dimenssionStruct dimenssion; struct dimenssionStruct*dimenPtr=&dimenssion; char label1[50]; char label2[50]; float inputDepth=0; //Holds input indicating if user wants to run or quit the program int mainChoice=0; //This hold the value (as returned by scanf()) indicating number of assignments made int validDepth=0; int soilChoice=0; int readResult=0; //result from readData function is stored in readResult var. readResult=readData(holeData,label1,label2); switch(readResult) { case 0: { //If readResult=0, below code is executed calcDimen(holeData,dimenPtr); calcHoleCoord(holeData,dimenPtr); initGraphics(dimenPtr); showAllData(holeData,label1,label2,dimenPtr); setcolor(WHITE); outtextxy(2,2,"Enter a depth in the console to see the soil information at that depth here."); /*This do..while loop calls the routines inside it as long as user does not decide to quit the program*/ do{ mainChoice=displayMainMenu(); if(mainChoice==1) { do { printf("\nEnter a depth (in meters):"); fflush(stdin); validDepth=scanf("%f",&inputDepth); }while(validDepth==0); inputDepth=fabs(inputDepth); soilChoice=displaySoilMenu(); processPrint(holeData,inputDepth,label1,label2,dimenPtr,soilChoice,1); } }while(mainChoice!=2); break; } case 1: { printf("You have chosen to exit the program because data from the file could not be read.\n Press Enter to exit."); break; } default: { printf("\nUnexpected error occoured in main(void)\n"); break; } } return readResult; }