MyComposite::MyComposite(QWidget *parent) : QMainWindow(parent) { undoStack = new QUndoStack(this); QMenu* fileMenu = this->menuBar()->addMenu("&File"); newAction = new QAction("&New",fileMenu); newAction->setShortcuts(QKeySequence::New); fileMenu->addAction(newAction); openAction = new QAction("&Open",fileMenu); openAction->setShortcuts(QKeySequence::Open); fileMenu->addAction(openAction); saveAction = new QAction("&Save",fileMenu); saveAction->setShortcuts(QKeySequence::Save); fileMenu->addAction(saveAction); saveAsAction = new QAction("S&ave as",fileMenu); saveAsAction->setShortcuts(QKeySequence::SaveAs); fileMenu->addAction(saveAsAction); quitAction = new QAction("&Quit",fileMenu); quitAction->setShortcuts(QKeySequence::Quit); fileMenu->addAction(quitAction); QMenu* editMenu = this->menuBar()->addMenu("&Edit"); undoAction = undoStack->createUndoAction(editMenu, "&Undo"); undoAction->setShortcuts(QKeySequence::Undo); editMenu->addAction(undoAction); redoAction = undoStack->createRedoAction(editMenu, "&Redo"); redoAction->setShortcuts(QKeySequence::Redo); editMenu->addAction(redoAction); editMenu->addSeparator(); cutAction = new QAction("&Cut ",editMenu); cutAction->setShortcuts(QKeySequence::Cut); cutAction->setEnabled(0); editMenu->addAction(cutAction); copyAction = new QAction("&Copy ",editMenu); copyAction->setShortcuts(QKeySequence::Copy); copyAction->setEnabled(0); editMenu->addAction(copyAction); pasteAction = new QAction("&Paste ",editMenu); pasteAction->setShortcuts(QKeySequence::Paste); pasteAction->setEnabled(0); editMenu->addAction(pasteAction); editMenu->addSeparator(); addCollectionAction = new QAction("Add &Collection",editMenu); addCollectionAction->setShortcut(QKeySequence("Ctrl+1")); editMenu->addAction(addCollectionAction); addImageAction = new QAction("Add &Image",editMenu); addImageAction->setShortcut(QKeySequence("Ctrl+2")); editMenu->addAction(addImageAction); deleteAllAction = new QAction("&Delete All Images",editMenu); deleteAllAction->setShortcut(QKeySequence("Ctrl+3")); editMenu->addAction(deleteAllAction); deleteImageAction = new QAction("&Delete Image",editMenu); deleteImageAction->setShortcut(QKeySequence("Ctrl+4")); deleteImageAction->setEnabled(0); editMenu->addAction(deleteImageAction); QMenu* playMenu = this->menuBar()->addMenu("&Play"); setTimerAction = new QAction("&Set Timer",playMenu); setTimerAction->setShortcut(QKeySequence("Ctrl+5")); playMenu->addAction(setTimerAction); playAction = new QAction("&Play",playMenu); playAction->setShortcut(QKeySequence("Ctrl+6")); playAction->setEnabled(0); playMenu->addAction(playAction); pauseAction = new QAction("&Pause",playMenu); pauseAction->setShortcut(QKeySequence("Ctrl+7")); pauseAction->setEnabled(0); playMenu->addAction(pauseAction); playSAction = new QAction("&Play from selection",playMenu); playSAction->setShortcut(QKeySequence("Ctrl+8")); playSAction->setEnabled(0); playMenu->addAction(playSAction); resetAction = new QAction("&Reset",playMenu); resetAction->setShortcut(QKeySequence("Ctrl+9")); playMenu->addAction(resetAction); splitter = new QSplitter(); /*QFrame *leftWidget = new QFrame(); QVBoxLayout *leftLayout = new QVBoxLayout(); leftWidget->setLayout(leftLayout); leftWidget->setStyleSheet("QFrame { background-color: rgb(219, 226, 228); }");*/ /*QFrame *innerWidget = new QFrame(); QGridLayout *innerLayout = new QGridLayout(); innerWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); innerWidget->setLayout(innerLayout);*/ dock = new QDockWidget(); addDockWidget(Qt::LeftDockWidgetArea, dock); //leftLayout->addWidget(dock); //leftLayout->addWidget(innerWidget,0,0, Qt::AlignTop); splitter->addWidget(dock); QFrame *rightWidget = new QFrame(); rightLayout = new QGridLayout(); rightWidget->setLayout(rightLayout); rightWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); rightLayout->setVerticalSpacing(0); rightLayout->setHorizontalSpacing(0); QScrollArea *scrollArea = new QScrollArea(); scrollArea->setWidgetResizable(1); BoxImage *boxImage = new BoxImage(this); //boxImage->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); boxImage->setStyleSheet("QFrame { background-color: rgb(254,254,254); }"); scrollArea->setWidget(rightWidget); splitter->addWidget(scrollArea); //scrollArea->setStyleSheet("QScrollArea { background-color: rgb(254,254,254); }"); setStyleSheet("QSplitter {background-color: rgb(219, 226, 228);}"); QList<int> sizeList = QList<int>() << 300 << 760; splitter->setSizes(sizeList); setCentralWidget(splitter); resize(760+300+20,500+20); connect (quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect (addCollectionAction, SIGNAL(triggered()), boxImage, SLOT(addCollectionCallback())); connect (addImageAction, SIGNAL(triggered()), boxImage, SLOT(addImageCallback())); connect (deleteAllAction, SIGNAL(triggered()), boxImage, SLOT(deleteAllCallback())); connect (deleteImageAction, SIGNAL(triggered()), boxImage, SLOT(deleteImageCallback())); connect(cutAction, SIGNAL(triggered()), boxImage, SLOT(cutCallback())); connect(copyAction, SIGNAL(triggered()), boxImage, SLOT(copyCallback())); connect(pasteAction, SIGNAL(triggered()), boxImage, SLOT(pasteCallback())); connect(setTimerAction, SIGNAL(triggered()), boxImage, SLOT(timerCallback())); connect(playAction, SIGNAL(triggered()), boxImage, SLOT(playCallback())); connect(pauseAction, SIGNAL(triggered()), boxImage, SLOT(pauseCallback())); connect(playSAction, SIGNAL(triggered()), boxImage, SLOT(playSCallback())); connect(resetAction, SIGNAL(triggered()), boxImage, SLOT(resetCallback())); connect(newAction,SIGNAL(triggered()),this,SLOT(notYetCallback())); connect(openAction,SIGNAL(triggered()),this,SLOT(notYetCallback())); connect(saveAction,SIGNAL(triggered()),this,SLOT(notYetCallback())); connect(saveAsAction,SIGNAL(triggered()),this,SLOT(notYetCallback())); }
Phone::Phone(int mc) { maxcall = mc; calls = new Call*[maxcall]; for (int i=0; i<maxcall; i++) calls[i] = NULL; call_number = 0; connections = 0; recorder = new Recorder(); player = new Player(); timer = new QTimer(this); recBuffer = NULL; ready = 0; enc_state = NULL; /* * FIXME * The speex_mode_query() can give ony the frame size, but no sampling rate. * So we must create a useless decoder here, fetch the informations and then destroy it. * To fix this as soon as speex will add the speex_mode_query for sampling rate. */ void *dec_state = speex_decoder_init(&speex_uwb_mode); int enh = 1; speex_decoder_ctl(dec_state, SPEEX_SET_ENH, &enh); speex_decoder_ctl(dec_state, SPEEX_GET_SAMPLING_RATE, &play_rate); speex_decoder_ctl(dec_state, SPEEX_GET_FRAME_SIZE, &play_frame_size); speex_decoder_destroy(dec_state); agc = false; agc_sw = false; agc_hw = false; peak = 0.f; amp = 1.f; agc_step = 0.f; agc_level = 0.f; agc_err = 0.f; inport = IHU_DEFAULT_INPORT; recording = false; playing = false; listening = false; ringing = false; notifier = NULL; tcpserver = NULL; sd = -1; rec_status = RECORDER_STATUS_STOP; play_status = PLAYER_STATUS_STOP; if ((out = (char *) malloc(MAXBUFSIZE))==NULL) throw Error(Error::IHU_ERR_MEMORY); if ((buffer = (float *) malloc(MAXBUFSIZE*sizeof(float)))==NULL) throw Error(Error::IHU_ERR_MEMORY); if ((prebuffer = (float *) malloc(REC_BUFSIZE*sizeof(float)))==NULL) throw Error(Error::IHU_ERR_MEMORY); if ((playBuffer = (float *) malloc(play_frame_size*2*sizeof(float)))==NULL) throw Error(Error::IHU_ERR_MEMORY); connect( recorder, SIGNAL(warning(QString)), this, SLOT(warning(QString)) ); connect( recorder, SIGNAL(data(float*, int)), this, SLOT(processAudioSamples(float*,int)) ); connect( player, SIGNAL(warning(QString)), this, SLOT(warning(QString)) ); connect( timer, SIGNAL(timeout()), this, SLOT(playCallback()) ); }