void PWS::show(){ if(createdUI == FALSE){ QPopupMenu *file_menu = new("QPopupMenu") QPopupMenu(); file_menu->insertItem(i18n("E&xit"), kapp, SLOT(quit())); QPopupMenu *help_menu = new("QPopupMenu") QPopupMenu(); help_menu->insertItem(i18n("&Help"), this, SLOT(invokeHelp())); // menuBar = new("KMenuBar") KMenuBar(this, "menubar"); // menuBar->insertItem(i18n("&File"), file_menu); // menuBar->insertItem(i18n("&Help"), help_menu); // setMenu(menuBar); // toolBar = new("KToolBar") KToolBar(this); // addToolBar(toolBar); // statusBar = new("KStatusBar") KStatusBar(this); // setStatusBar(statusBar); // resize(600,440); view = new("PWSWidget") PWSWidget(this); setView(view); connect(view, SIGNAL(quitPressed(QObject *)), this, SLOT(closeView(QObject *))); createdUI = TRUE; }
bool CmdExtended::helpCommands(DebuggerClient *client, const ExtendedCommandMap &matches) { for (ExtendedCommandMap::const_iterator iter = matches.begin(); iter != matches.end(); ++iter) { invokeHelp(client, iter->second); } return true; }
//*************************************************************************** Kwave::AmplifyFreeDialog::AmplifyFreeDialog(QWidget *parent) :QDialog(parent), Ui::AmplifyFreeDlg() { setupUi(this); curveWidget->setMinimumSize(150, 100); xScale->setMinimumSize(250, 30); xScale->setMinMax(0, 100); xScale->setLogMode(false); xScale->setUnit(i18n("ms")); yScale->setMinimumSize( 30, 150); yScale->setMinMax(0, 100); yScale->setLogMode(false); yScale->setUnit(i18n("%")); connect(buttonBox_Help->button(QDialogButtonBox::Help), SIGNAL(clicked()), this, SLOT(invokeHelp())); // set the focus onto the "OK" button buttonBox->button(QDialogButtonBox::Ok)->setFocus(); }
//*************************************************************************** Kwave::GotoDialog::GotoDialog(QWidget *widget, Mode mode, sample_index_t pos, double sample_rate, sample_index_t signal_length, const QString &help_section) :QDialog(widget), Ui::GotoDlg(), m_help_section(help_section) { setupUi(this); setModal(true); if (select_pos) { select_pos->init(mode, pos, sample_rate, 0, signal_length); select_pos->setTitle(QString()); } setMinimumSize(sizeHint()); setFixedSize(sizeHint()); connect(buttonBox_Help->button(QDialogButtonBox::Help), SIGNAL(clicked()), this, SLOT(invokeHelp())); // set the focus onto the "OK" button buttonBox->button(QDialogButtonBox::Ok)->setFocus(); }
//*************************************************************************** Kwave::LowPassDialog::LowPassDialog(QWidget *parent, double sample_rate) :QDialog(parent), Ui::LowPassDlg(), Kwave::PluginSetupDialog(), m_frequency(3500), m_sample_rate(sample_rate), m_filter(0) { setupUi(this); setModal(true); // set maximum frequency to sample rate / 2 double f_max = sample_rate / 2.0; slider->setMaximum(Kwave::toInt(f_max)); spinbox->setMaximum(Kwave::toInt(f_max)); // initialize the frequency scale widget scale_freq->setMinMax(0, Kwave::toInt(f_max)); scale_freq->setLogMode(false); scale_freq->setUnit(i18n("Hz")); // initialize the attenuation scale widget scale_db->setMinMax(-24, +6); scale_db->setLogMode(false); scale_db->setUnit(i18n("dB")); // initialize the frequency response widget freq_response->init(f_max, -24, +6); // set up the low pass filter dunction m_filter = new Kwave::LowPassFilter(); freq_response->setFilter(m_filter); // initialize the controls and the curve display slider->setValue(Kwave::toInt(m_frequency)); spinbox->setValue(Kwave::toInt(m_frequency)); updateDisplay(); // changes in the slider or spinbox connect(spinbox, SIGNAL(valueChanged(int)), this, SLOT(valueChanged(int))); // click to the "Listen" button connect(btListen, SIGNAL(toggled(bool)), this, SLOT(listenToggled(bool))); // expand the "Listen" button to it's maximum width listenToggled(true); if (btListen->width() > btListen->minimumWidth()) btListen->setMinimumWidth(btListen->width()); listenToggled(false); if (btListen->width() > btListen->minimumWidth()) btListen->setMinimumWidth(btListen->width()); // set the initial size of the dialog int h = (width() * 3) / 5; if (height() < h) resize(width(), h); int w = (height() * 5) / 3; if (width() < w) resize(w, height()); connect(buttonBox_Help->button(QDialogButtonBox::Help), SIGNAL(clicked()), this, SLOT(invokeHelp())); // set the focus onto the "OK" button buttonBox->button(QDialogButtonBox::Ok)->setFocus(); }
void KwikDisk::updateDFDone() { kdDebug() << k_funcinfo << endl; m_readingDF = FALSE; m_dirty = FALSE; contextMenu()->clear(); contextMenu()->insertTitle(KSystemTray::loadIcon("kdf"), i18n("KwikDisk")); int itemNo = 0; for( DiskEntry *disk = m_diskList.first(); disk != 0; disk = m_diskList.next() ) { // FIXME: tool tips are unused atm TQString toolTipText = i18n("%1 (%2) %3 on %4") .arg( disk->mounted() ? i18n("Unmount") : i18n("Mount")) .arg(disk->fsType()).arg(disk->deviceName()).arg(disk->mountPoint()); TQString entryName = disk->mountPoint(); if( disk->mounted() ) { entryName += TQString("\t\t\t[%1]").arg(disk->prettyKBAvail()); } int id = contextMenu()->insertItem("", this, TQT_SLOT(toggleMount(int)) ); contextMenu()->setItemParameter(id, itemNo); itemNo++; TQPixmap *pix = new TQPixmap(KSystemTray::loadIcon(disk->iconName())); if( getuid() !=0 && disk->mountOptions().find("user",0, false) == -1 ) { // // Special root icon, normal user cant mount. // // 2000-01-23 Espen Sand // Careful here: If the mask has not been defined we can // not use TQPixmap::mask() because it returns 0 => segfault // if( pix->mask() != 0 ) { TQBitmap *bm = new TQBitmap(*(pix->mask())); if( bm != 0 ) { TQPainter qp( bm ); qp.setPen(TQPen(white,1)); qp.drawRect(0,0,bm->width(),bm->height()); qp.end(); pix->setMask(*bm); } TQPainter qp( pix ); qp.setPen(TQPen(red,1)); qp.drawRect(0,0,pix->width(),pix->height()); qp.end(); } contextMenu()->disconnectItem(id,disk,TQT_SLOT(toggleMount())); toolTipText = i18n("You must login as root to mount this disk"); } contextMenu()->changeItem(*pix,entryName,id); } contextMenu()->insertSeparator(); contextMenu()->insertItem( KSystemTray::loadIcon("kdf"), i18n("&Start KDiskFree"), this, TQT_SLOT(startKDF()),0); contextMenu()->insertItem( KSystemTray::loadIcon("configure"), i18n("&Configure KwikDisk..."), this, TQT_SLOT(changeSettings()),0); contextMenu()->insertItem( KSystemTray::loadIcon("help"), KStdGuiItem::help().text(), this, TQT_SLOT(invokeHelp()),0); contextMenu()->insertSeparator(); contextMenu()->insertItem( KSystemTray::loadIcon("exit"), KStdGuiItem::quit().text(), this, TQT_SIGNAL(quitSelected()) ); }
//*************************************************************************** Kwave::RecordDialog::RecordDialog(QWidget *parent, QStringList ¶ms, Kwave::RecordController *controller, Kwave::RecordDialog::Mode mode) :QDialog(parent), Ui::RecordDlg(), m_methods_map(), m_file_filter(), m_devices_list_map(), m_state(Kwave::REC_EMPTY), m_params(), m_supported_resolutions(), m_buffer_progress_count(0), m_buffer_progress_total(0), m_buffer_progress_timer(this), m_record_enabled(true), m_samples_recorded(0), m_enable_setDevice(true), m_state_icon_widget(0) { m_status_bar.m_state = 0; m_status_bar.m_time = 0; m_status_bar.m_sample_rate = 0; m_status_bar.m_bits_per_sample = 0; m_status_bar.m_tracks = 0; setupUi(this); /* get initial parameters */ m_params.fromList(params); /* set the icons of the record control buttons */ KIconLoader icon_loader; btNew->setIcon( QIcon(icon_loader.loadIcon(_("document-new"), KIconLoader::Toolbar))); btStop->setIcon( QIcon(QPixmap(xpm_stop))); btPause->setIcon( QIcon(QPixmap(xpm_pause))); btRecord->setIcon(QIcon(QPixmap(xpm_krec_record))); // fill the combo box with playback methods unsigned int index=0; for (index = 0; index < m_methods_map.count(); ++index) { cbMethod->addItem(m_methods_map.description(index, true)); } cbMethod->setEnabled(cbMethod->count() > 1); /* --- set up all controls with their default/startup values --- */ // pre-record STD_SETUP_SLIDER(pre_record_enabled, pre_record_time, RecordPre); connect(chkRecordPre, SIGNAL(toggled(bool)), this, SLOT(preRecordingChecked(bool))); connect(sbRecordPre, SIGNAL(valueChanged(int)), this, SLOT(preRecordingTimeChanged(int))); // record time (duration) STD_SETUP(record_time_limited, record_time, RecordTime); // start time (date & time) chkRecordStartTime->setChecked(m_params.start_time_enabled); startTime->setDateTime(m_params.start_time); // record trigger STD_SETUP_SLIDER(record_trigger_enabled, record_trigger, RecordTrigger); // amplification STD_SETUP_SLIDER(amplification_enabled, amplification, LevelAmplify); // AGC STD_SETUP_SLIDER(agc_enabled, agc_decay, LevelAGC); // fade in STD_SETUP(fade_in_enabled, fade_in_time, LevelFadeIn); // fade out STD_SETUP(fade_out_enabled, fade_out_time, LevelFadeOut); // sample rate, bits per sample, track // -> will be initialized later, by the plugin // number of buffers slSourceBufferCount->setValue(m_params.buffer_count); // power of buffer size slSourceBufferSize->setValue(m_params.buffer_size); sourceBufferSizeChanged(m_params.buffer_size); // after this point all controls have their initial values /* --- connect some missing low level GUI functionality --- */ connect(cbMethod, SIGNAL(activated(int)), this, SLOT(methodSelected(int))); // record buffer size and count slSourceBufferCount->setValue(m_params.buffer_count); slSourceBufferSize->setValue(m_params.buffer_size); connect(slSourceBufferSize, SIGNAL(valueChanged(int)), this, SLOT(sourceBufferSizeChanged(int))); connect(slSourceBufferCount, SIGNAL(valueChanged(int)), this, SLOT(sourceBufferCountChanged(int))); // device treeview connect(listDevices, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), SLOT(listEntrySelected(QTreeWidgetItem*,QTreeWidgetItem*))); connect(listDevices, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(listItemExpanded(QTreeWidgetItem*))); connect(listDevices, SIGNAL(focusLost()), SLOT(updateListSelection())); // "select device..." button connect(btSourceSelect, SIGNAL(clicked()), this, SLOT(selectRecordDevice())); connect(cbDevice, SIGNAL(activated(QString)), this, SLOT(setDevice(QString))); // setup controls connect(chkRecordTime, SIGNAL(toggled(bool)), this, SLOT(recordTimeChecked(bool))); connect(sbRecordTime, SIGNAL(valueChanged(int)), this, SLOT(recordTimeChanged(int))); connect(chkRecordStartTime, SIGNAL(toggled(bool)), this, SLOT(startTimeChecked(bool))); connect(startTime, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(startTimeChanged(QDateTime))); connect(chkRecordTrigger, SIGNAL(toggled(bool)), this, SLOT(triggerChecked(bool))); connect(sbRecordTrigger, SIGNAL(valueChanged(int)), this, SLOT(triggerChanged(int))); connect(cbFormatSampleRate, SIGNAL(editTextChanged(QString)), this, SLOT(sampleRateChanged(QString))); connect(cbFormatSampleRate, SIGNAL(activated(QString)), this, SLOT(sampleRateChanged(QString))); connect(sbFormatTracks, SIGNAL(valueChanged(int)), this, SLOT(tracksChanged(int))); connect(cbFormatCompression, SIGNAL(activated(int)), this, SLOT(compressionChanged(int))); connect(sbFormatResolution, SIGNAL(valueChanged(int)), this, SLOT(bitsPerSampleChanged(int))); connect(cbFormatSampleFormat, SIGNAL(activated(int)), this, SLOT(sampleFormatChanged(int))); // connect the buttons to the record controller connect(btNew, SIGNAL(clicked()), controller, SLOT(actionReset())); connect(btStop, SIGNAL(clicked()), controller, SLOT(actionStop())); connect(btPause, SIGNAL(clicked()), controller, SLOT(actionPause())); connect(btRecord, SIGNAL(clicked()), controller, SLOT(actionStart())); // stop recording when the window gets closed connect(this, SIGNAL(rejected()), controller, SLOT(actionStop())); connect(this, SIGNAL(accepted()), controller, SLOT(actionStop())); // connect the notifications/commands of the record controller connect(controller, SIGNAL(stateChanged(Kwave::RecordState)), this, SLOT(setState(Kwave::RecordState))); // timer for updating the buffer progress bar connect(&m_buffer_progress_timer, SIGNAL(timeout()), this, SLOT(updateBufferProgressBar())); // help button connect(buttonBox->button(QDialogButtonBox::Help), SIGNAL(clicked()), this, SLOT(invokeHelp())); // status bar m_state_icon_widget = new Kwave::StatusWidget(this); Q_ASSERT(m_state_icon_widget); if (!m_state_icon_widget) return; m_state_icon_widget->setFixedSize(16, 16); lbl_state->addWidget(m_state_icon_widget); m_status_bar.m_state = new (std::nothrow) QLabel(_(" ")); Q_ASSERT(m_status_bar.m_state); if (!m_status_bar.m_state) return; m_status_bar.m_state->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); lbl_state->addWidget(m_status_bar.m_state); m_status_bar.m_time = new (std::nothrow) QLabel(_(" ")); Q_ASSERT(m_status_bar.m_time); if (!m_status_bar.m_time) return; m_status_bar.m_time->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); lbl_state->addWidget(m_status_bar.m_time); m_status_bar.m_sample_rate = new (std::nothrow) QLabel(_(" ")); Q_ASSERT(m_status_bar.m_sample_rate); if (!m_status_bar.m_sample_rate) return; m_status_bar.m_sample_rate->setAlignment(Qt::AlignRight | Qt::AlignVCenter); lbl_state->addWidget(m_status_bar.m_sample_rate); m_status_bar.m_bits_per_sample = new (std::nothrow) QLabel(_(" ")); Q_ASSERT(m_status_bar.m_bits_per_sample); if (!m_status_bar.m_bits_per_sample) return; m_status_bar.m_bits_per_sample->setAlignment(Qt::AlignRight | Qt::AlignVCenter); lbl_state->addWidget(m_status_bar.m_bits_per_sample); m_status_bar.m_tracks = new (std::nothrow) QLabel(_(" ")); Q_ASSERT(m_status_bar.m_tracks); if (!m_status_bar.m_tracks) return; m_status_bar.m_tracks->setAlignment(Qt::AlignRight | Qt::AlignVCenter); lbl_state->addWidget(m_status_bar.m_tracks); m_state_icon_widget->setFixedSize(16, lbl_state->childrenRect().height()); // set the initial state of the dialog to "Reset/Empty" setState(Kwave::REC_EMPTY); // disable the "level" tab, it is not implemented yet tabRecord->setCurrentIndex(1); QWidget *page = tabRecord->currentWidget(); tabRecord->setCurrentIndex(0); if (page) delete page; // add the "Done" button manually, otherwise it would have "Cancel" semantic QPushButton *bt_done = buttonBox->addButton(i18n("&Done"), QDialogButtonBox::AcceptRole); Q_ASSERT(bt_done); if (!bt_done) return; connect(bt_done, SIGNAL(clicked(bool)), this, SLOT(accept())); switch (mode) { case Kwave::RecordDialog::SETTINGS_FORMAT: tabRecord->setCurrentIndex(1); break; case Kwave::RecordDialog::SETTINGS_SOURCE: tabRecord->setCurrentIndex(2); break; case Kwave::RecordDialog::START_RECORDING: /* FALLTHROUGH */ case Kwave::RecordDialog::SETTINGS_DEFAULT: /* FALLTHROUGH */ default: tabRecord->setCurrentIndex(0); // set the focus onto the "Record" button btRecord->setFocus(); break; } }