static void write(RomMapperOpcodeModule* rm, UInt16 ioPort, UInt8 value) { switch (ioPort) { case 0x40: rm->biosLatch = value & 0x03; slotMapPage(rm->slot, rm->sslot, 0, rm->biosRom + rm->biosLatch * 0x2000, 1, 0); break; case 0x48: case 0x49: case 0x4a: case 0x4b: rm->megaRamLatch[ioPort & 3] = value & 0x0f; slotUpdate(rm); break; case 0x50: ay8910WriteAddress(rm->ay8910, ioPort, value); break; case 0x51: ay8910WriteData(rm->ay8910, ioPort, value); break; } }
ReportPreviewWindow::ReportPreviewWindow( QWidget* parent ) : QDialog( parent ) , m_ui( new Ui::ReportPreviewWindow ) , m_document( 0 ) { m_ui->setupUi( this ); setAttribute( Qt::WA_DeleteOnClose ); connect( m_ui->pushButtonClose, SIGNAL( clicked() ), SLOT( slotClose() ) ); connect( m_ui->pushButtonUpdate, SIGNAL( clicked() ), SLOT( slotUpdate() ) ); connect( m_ui->pushButtonSave, SIGNAL( clicked() ), SLOT( slotSaveToXml() ) ); connect( m_ui->pushButtonSaveTotals, SIGNAL( clicked() ), SLOT( slotSaveToText() ) ); #ifndef QT_NO_PRINTER connect( m_ui->pushButtonPrint, SIGNAL( clicked() ), SLOT( slotPrint() ) ); #else m_ui->pushButtonPrint->setEnabled(false); #endif resize(600, 600); }
void DlgPreferences::addPageWidget(DlgPreferencePage* pWidget) { connect(this, SIGNAL(showDlg()), pWidget, SLOT(slotShow())); connect(this, SIGNAL(closeDlg()), pWidget, SLOT(slotHide())); connect(this, SIGNAL(showDlg()), pWidget, SLOT(slotUpdate())); connect(buttonBox, SIGNAL(accepted()), pWidget, SLOT(slotApply())); connect(buttonBox, SIGNAL(rejected()), pWidget, SLOT(slotCancel())); QScrollArea* sa = new QScrollArea(pagesWidget); sa->setWidgetResizable(true); sa->setWidget(pWidget); pagesWidget->addWidget(sa); int iframe = 2 * sa->frameWidth(); m_pageSizeHint = m_pageSizeHint.expandedTo( pWidget->sizeHint()+QSize(iframe, iframe)); }
CVSService::CVSService(KActionCollection *ac) { m_menu = new KPopupMenu(); KAction *action = new KAction(i18n("&Commit..."), "vcs_commit", 0, this, SLOT(slotCommit()), ac, "vcs_commit"); action->plug(m_menu); action = new KAction(i18n("&Update"), "vcs_update", 0, this, SLOT(slotUpdate()), ac, "vcs_update"); action->plug(m_menu); KPopupMenu *updateToMenu = new KPopupMenu(m_menu); m_menu->insertItem(SmallIconSet("vcs_update"), i18n("Update &To"), updateToMenu); action = new KAction(i18n("&Tag/Date..."), "vcs_update", 0, this, SLOT(slotUpdateToTag()), ac, "vcs_update_tag_date"); action->plug(updateToMenu); action = new KAction(i18n("&HEAD"), "vcs_update", 0, this, SLOT(slotUpdateToHead()), ac, "vcs_update_head"); action->plug(updateToMenu); action = new KAction(i18n("Re&vert"), "reload", 0, this, SLOT(slotRevert()), ac, "vcs_revert"); action->plug(m_menu); m_menu->insertSeparator(); action = new KAction(i18n("&Add to Repository..."), "vcs_add", 0, this, SLOT(slotAdd()), ac, "vcs_add"); action->plug(m_menu); action = new KAction(i18n("&Remove From Repository..."), "vcs_remove", 0, this, SLOT(slotRemove()), ac, "vcs_remove"); action->plug(m_menu); action = new KAction(i18n("&Ignore in CVS Operations"), 0, this, SLOT(slotAddToCVSIgnore()), ac); action->plug(m_menu); action = new KAction(i18n("Do &Not Ignore in CVS Operations"), 0, this, SLOT(slotRemoveFromCVSIgnore()), ac); action->plug(m_menu); m_menu->insertSeparator(); action = new KAction(i18n("Show &Log Messages"), 0, this, SLOT(slotBrowseLog()), ac); action->plug(m_menu); m_cvsJob = 0L; m_repository = 0L; m_cvsService =0L; m_commitDlg = new CVSCommitDlgS(); m_updateToDlg = new CVSUpdateToDlgS(); m_timer = new QTimer(this); connect(m_timer, SIGNAL(timeout()), this, SLOT(slotTimeout())); }
void PerforcePart::contextMenu(QPopupMenu *popup, const Context *context) { if (context->hasType( Context::FileContext )) { const FileContext *fcontext = static_cast<const FileContext*>(context); popupfile = fcontext->urls().first().path(); QFileInfo fi( popupfile ); popup->insertSeparator(); KPopupMenu *sub = new KPopupMenu(popup); QString name = fi.fileName(); sub->insertTitle( i18n("Actions for %1").arg(name) ); int id = sub->insertItem( i18n("Edit"), this, SLOT(slotEdit()) ); sub->setWhatsThis(id, i18n("<b>Edit</b><p>Opens file(s) in a client workspace for edit.")); id = sub->insertItem( i18n("Revert"), this, SLOT(slotRevert()) ); sub->setWhatsThis(id, i18n("<b>Revert</b><p>Discards changes made to open files.")); id = sub->insertItem( i18n("Submit"), this, SLOT(slotCommit()) ); sub->setWhatsThis(id, i18n("<b>Submit</b><p>Sends changes made to open files to the depot.")); id = sub->insertItem( i18n("Sync"), this, SLOT(slotUpdate()) ); sub->setWhatsThis(id, i18n("<b>Sync</b><p>Copies files from the depot into the workspace.")); sub->insertSeparator(); id = sub->insertItem( i18n("Diff Against Repository"), this, SLOT(slotDiff()) ); sub->setWhatsThis(id, i18n("<b>Diff against repository</b><p>Compares a client workspace file to a revision in the depot.")); id = sub->insertItem( i18n("Add to Repository"), this, SLOT(slotAdd()) ); sub->setWhatsThis(id, i18n("<b>Add to repository</b><p>Open file(s) in a client workspace for addition to the depot.")); id = sub->insertItem( i18n("Remove From Repository"), this, SLOT(slotRemove()) ); sub->setWhatsThis(id, i18n("<b>Remove from repository</b><p>Open file(s) in a client workspace for deletion from the depot.")); id = popup->insertItem(i18n("Perforce"), sub); } }
void DlgPrefBeats::offsetEnabled(int i) { m_boffsetEnabled = static_cast<bool>(i); slotUpdate(); }
void DlgPrefBeats::fixedtempoEnabled(int i) { m_bfixedtempoEnabled = static_cast<bool>(i); slotUpdate(); }
int Q3IconView::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = Q3ScrollView::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: selectionChanged(); break; case 1: selectionChanged((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break; case 2: currentChanged((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break; case 3: clicked((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break; case 4: clicked((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break; case 5: pressed((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break; case 6: pressed((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break; case 7: doubleClicked((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break; case 8: returnPressed((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break; case 9: rightButtonClicked((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break; case 10: rightButtonPressed((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break; case 11: mouseButtonPressed((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Q3IconViewItem*(*)>(_a[2])),(*reinterpret_cast< const QPoint(*)>(_a[3]))); break; case 12: mouseButtonClicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Q3IconViewItem*(*)>(_a[2])),(*reinterpret_cast< const QPoint(*)>(_a[3]))); break; case 13: contextMenuRequested((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break; case 14: dropped((*reinterpret_cast< QDropEvent*(*)>(_a[1])),(*reinterpret_cast< const Q3ValueList<Q3IconDragItem>(*)>(_a[2]))); break; case 15: moved(); break; case 16: onItem((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break; case 17: onViewport(); break; case 18: itemRenamed((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break; case 19: itemRenamed((*reinterpret_cast< Q3IconViewItem*(*)>(_a[1]))); break; case 20: arrangeItemsInGrid((*reinterpret_cast< const QSize(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break; case 21: arrangeItemsInGrid((*reinterpret_cast< const QSize(*)>(_a[1]))); break; case 22: arrangeItemsInGrid((*reinterpret_cast< bool(*)>(_a[1]))); break; case 23: arrangeItemsInGrid(); break; case 24: setContentsPos((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 25: updateContents(); break; case 26: doAutoScroll(); break; case 27: adjustItems(); break; case 28: slotUpdate(); break; case 29: movedContents((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; } _id -= 30; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = sorting(); break; case 1: *reinterpret_cast< bool*>(_v) = sortDirection(); break; case 2: *reinterpret_cast< SelectionMode*>(_v) = selectionMode(); break; case 3: *reinterpret_cast< int*>(_v) = gridX(); break; case 4: *reinterpret_cast< int*>(_v) = gridY(); break; case 5: *reinterpret_cast< int*>(_v) = spacing(); break; case 6: *reinterpret_cast< ItemTextPos*>(_v) = itemTextPos(); break; case 7: *reinterpret_cast< QBrush*>(_v) = itemTextBackground(); break; case 8: *reinterpret_cast< Arrangement*>(_v) = arrangement(); break; case 9: *reinterpret_cast< ResizeMode*>(_v) = resizeMode(); break; case 10: *reinterpret_cast< int*>(_v) = maxItemWidth(); break; case 11: *reinterpret_cast< int*>(_v) = maxItemTextLength(); break; case 12: *reinterpret_cast< bool*>(_v) = autoArrange(); break; case 13: *reinterpret_cast< bool*>(_v) = itemsMovable(); break; case 14: *reinterpret_cast< bool*>(_v) = wordWrapIconText(); break; case 15: *reinterpret_cast< bool*>(_v) = showToolTips(); break; case 16: *reinterpret_cast< uint*>(_v) = count(); break; } _id -= 17; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 2: setSelectionMode(*reinterpret_cast< SelectionMode*>(_v)); break; case 3: setGridX(*reinterpret_cast< int*>(_v)); break; case 4: setGridY(*reinterpret_cast< int*>(_v)); break; case 5: setSpacing(*reinterpret_cast< int*>(_v)); break; case 6: setItemTextPos(*reinterpret_cast< ItemTextPos*>(_v)); break; case 7: setItemTextBackground(*reinterpret_cast< QBrush*>(_v)); break; case 8: setArrangement(*reinterpret_cast< Arrangement*>(_v)); break; case 9: setResizeMode(*reinterpret_cast< ResizeMode*>(_v)); break; case 10: setMaxItemWidth(*reinterpret_cast< int*>(_v)); break; case 11: setMaxItemTextLength(*reinterpret_cast< int*>(_v)); break; case 12: setAutoArrange(*reinterpret_cast< bool*>(_v)); break; case 13: setItemsMovable(*reinterpret_cast< bool*>(_v)); break; case 14: setWordWrapIconText(*reinterpret_cast< bool*>(_v)); break; case 15: setShowToolTips(*reinterpret_cast< bool*>(_v)); break; } _id -= 17; } else if (_c == QMetaObject::ResetProperty) { _id -= 17; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 17; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 17; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 17; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 17; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 17; } #endif // QT_NO_PROPERTIES return _id; }
void ImageViewer::setData(const QByteArray &data) { delete m_image; m_image = ApiSurface::imageFromData(data); slotUpdate(); }
static void write(RomMapperOpcodeMegaRam* rm, UInt16 ioPort, UInt8 value) { rm->megaRamLatch[ioPort & 3] = value & 0x0f; slotUpdate(rm); }
void QtGroupBoxPropertyBrowserPrivate::updateLater() { QTimer::singleShot(0, q_ptr, SLOT(slotUpdate())); }
void FilesTransferUI::upload(void) { if(SDriveEngine::inst()->uploadFileMngr) { if(SDriveEngine::inst()->uploadFileMngr->getState() == NetworkManager::EBusy) return; } QString fileName = QFileDialog::getOpenFileName(SDriveEngine::inst()->parent, tr("Uploading file"), QDir::homePath(), tr("All files(*)")); if(!fileName.isEmpty()) { QString uploadLink(dynamic_cast<WebContentManager*> (SDriveEngine::inst()->getContentMngr())->getParentFolderInfo().uploadLink + QString("/?convert=false")); FilePanel *filePanel = SDriveEngine::inst()->getFilePanel(SettingsManager().currentPanel()); SDriveEngine::inst()->uploadFileMngr.reset(new UploadFileManager(SDriveEngine::inst()->parent)); connect(SDriveEngine::inst()->uploadFileMngr.data(), SIGNAL(signalUpdateFileList()), filePanel, SLOT(slotUpdate())); SDriveEngine::inst()->uploadFileMngr->startUpload(uploadLink, fileName); } }
DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx, SkinLoader* pSkinLoader, PlayerManager* pPlayerManager, ConfigObject<ConfigValue> * pConfig) : DlgPreferencePage(parent), m_pConfig(pConfig), m_timer(-1), m_mixxx(mixxx), m_pSkinLoader(pSkinLoader), m_pPlayerManager(pPlayerManager) { setupUi(this); for (unsigned int i = 0; i < PlayerManager::numDecks(); ++i) { QString group = PlayerManager::groupForDeck(i); m_rateControls.push_back(new ControlObjectThread( group, "rate")); m_rateRangeControls.push_back(new ControlObjectThread( group, "rateRange")); m_rateDirControls.push_back(new ControlObjectThread( group, "rate_dir")); m_cueControls.push_back(new ControlObjectThread( group, "cue_mode")); } for (unsigned int i = 0; i < m_pPlayerManager->numSamplers(); ++i) { QString group = PlayerManager::groupForSampler(i); m_rateControls.push_back(new ControlObjectThread( group, "rate")); m_rateRangeControls.push_back(new ControlObjectThread( group, "rateRange")); m_rateDirControls.push_back(new ControlObjectThread( group, "rate_dir")); m_cueControls.push_back(new ControlObjectThread( group, "cue_mode")); } // Position display configuration m_pControlPositionDisplay = new ControlObject(ConfigKey("[Controls]", "ShowDurationRemaining")); connect(m_pControlPositionDisplay, SIGNAL(valueChanged(double)), this, SLOT(slotSetPositionDisplay(double))); ComboBoxPosition->addItem(tr("Position")); ComboBoxPosition->addItem(tr("Remaining")); if (m_pConfig->getValueString(ConfigKey("[Controls]","PositionDisplay")).length() == 0) m_pConfig->set(ConfigKey("[Controls]","PositionDisplay"),ConfigValue(0)); if (m_pConfig->getValueString(ConfigKey("[Controls]","PositionDisplay")).toInt() == 1) { ComboBoxPosition->setCurrentIndex(1); m_pControlPositionDisplay->set(1.0f); } else { ComboBoxPosition->setCurrentIndex(0); m_pControlPositionDisplay->set(0.0f); } connect(ComboBoxPosition, SIGNAL(activated(int)), this, SLOT(slotSetPositionDisplay(int))); // Set default direction as stored in config file if (m_pConfig->getValueString(ConfigKey("[Controls]","RateDir")).length() == 0) m_pConfig->set(ConfigKey("[Controls]","RateDir"),ConfigValue(0)); slotSetRateDir(m_pConfig->getValueString(ConfigKey("[Controls]","RateDir")).toInt()); connect(ComboBoxRateDir, SIGNAL(activated(int)), this, SLOT(slotSetRateDir(int))); // Set default range as stored in config file if (m_pConfig->getValueString(ConfigKey("[Controls]","RateRange")).length() == 0) m_pConfig->set(ConfigKey("[Controls]","RateRange"),ConfigValue(2)); slotSetRateRange(m_pConfig->getValueString(ConfigKey("[Controls]","RateRange")).toInt()); connect(ComboBoxRateRange, SIGNAL(activated(int)), this, SLOT(slotSetRateRange(int))); // // Rate buttons configuration // //NOTE: THESE DEFAULTS ARE A LIE! You'll need to hack the same values into the static variables // at the top of enginebuffer.cpp if (m_pConfig->getValueString(ConfigKey("[Controls]","RateTempLeft")).length() == 0) m_pConfig->set(ConfigKey("[Controls]","RateTempLeft"),ConfigValue(QString("4.0"))); if (m_pConfig->getValueString(ConfigKey("[Controls]","RateTempRight")).length() == 0) m_pConfig->set(ConfigKey("[Controls]","RateTempRight"),ConfigValue(QString("2.0"))); if (m_pConfig->getValueString(ConfigKey("[Controls]","RatePermLeft")).length() == 0) m_pConfig->set(ConfigKey("[Controls]","RatePermLeft"),ConfigValue(QString("0.50"))); if (m_pConfig->getValueString(ConfigKey("[Controls]","RatePermRight")).length() == 0) m_pConfig->set(ConfigKey("[Controls]","RatePermRight"),ConfigValue(QString("0.05"))); connect(spinBoxTempRateLeft, SIGNAL(valueChanged(double)), this, SLOT(slotSetRateTempLeft(double))); connect(spinBoxTempRateRight, SIGNAL(valueChanged(double)), this, SLOT(slotSetRateTempRight(double))); connect(spinBoxPermRateLeft, SIGNAL(valueChanged(double)), this, SLOT(slotSetRatePermLeft(double))); connect(spinBoxPermRateRight, SIGNAL(valueChanged(double)), this, SLOT(slotSetRatePermRight(double))); spinBoxTempRateLeft->setValue(m_pConfig->getValueString(ConfigKey("[Controls]","RateTempLeft")).toDouble()); spinBoxTempRateRight->setValue(m_pConfig->getValueString(ConfigKey("[Controls]","RateTempRight")).toDouble()); spinBoxPermRateLeft->setValue(m_pConfig->getValueString(ConfigKey("[Controls]","RatePermLeft")).toDouble()); spinBoxPermRateRight->setValue(m_pConfig->getValueString(ConfigKey("[Controls]","RatePermRight")).toDouble()); SliderRateRampSensitivity->setEnabled(true); SpinBoxRateRampSensitivity->setEnabled(true); // // Override Playing Track on Track Load // ComboBoxAllowTrackLoadToPlayingDeck->addItem(tr("Don't load tracks into a playing deck")); ComboBoxAllowTrackLoadToPlayingDeck->addItem(tr("Load tracks into a playing deck")); ComboBoxAllowTrackLoadToPlayingDeck->setCurrentIndex(m_pConfig->getValueString(ConfigKey("[Controls]", "AllowTrackLoadToPlayingDeck")).toInt()); connect(ComboBoxAllowTrackLoadToPlayingDeck, SIGNAL(activated(int)), this, SLOT(slotSetAllowTrackLoadToPlayingDeck(int))); // // Locale setting // // Iterate through the available locales and add them to the combobox // Borrowed following snippet from http://qt-project.org/wiki/How_to_create_a_multi_language_application QString translationsFolder = m_pConfig->getResourcePath() + "translations/"; QString currentLocale = pConfig->getValueString(ConfigKey("[Config]","Locale")); QDir translationsDir(translationsFolder); QStringList fileNames = translationsDir.entryList(QStringList("mixxx_*.qm")); ComboBoxLocale->addItem("System", ""); // System default locale ComboBoxLocale->setCurrentIndex(0); for (int i = 0; i < fileNames.size(); ++i) { // Extract locale from filename QString locale = fileNames[i]; locale.truncate(locale.lastIndexOf('.')); locale.remove(0, locale.indexOf('_') + 1); QString lang = QLocale::languageToString(QLocale(locale).language()); if (lang == "C") { // Ugly hack to remove the non-resolving locales continue; } ComboBoxLocale->addItem(lang, locale); // locale as userdata (for storing to config) if (locale == currentLocale) { // Set the currently selected locale ComboBoxLocale->setCurrentIndex(ComboBoxLocale->count() - 1); } } connect(ComboBoxLocale, SIGNAL(activated(int)), this, SLOT(slotSetLocale(int))); // // Default Cue Behavior // // Set default value in config file and control objects, if not present QString cueDefault = m_pConfig->getValueString(ConfigKey("[Controls]","CueDefault")); if(cueDefault.length() == 0) { m_pConfig->set(ConfigKey("[Controls]","CueDefault"), ConfigValue(0)); cueDefault = "0"; } int cueDefaultValue = cueDefault.toInt(); // Update combo box ComboBoxCueDefault->addItem(tr("CDJ Mode")); ComboBoxCueDefault->addItem(tr("Simple")); ComboBoxCueDefault->setCurrentIndex(cueDefaultValue); slotSetCueDefault(cueDefaultValue); connect(ComboBoxCueDefault, SIGNAL(activated(int)), this, SLOT(slotSetCueDefault(int))); //Cue recall ComboBoxCueRecall->addItem(tr("On")); ComboBoxCueRecall->addItem(tr("Off")); ComboBoxCueRecall->setCurrentIndex(m_pConfig->getValueString(ConfigKey("[Controls]", "CueRecall")).toInt()); //NOTE: for CueRecall, 0 means ON.... connect(ComboBoxCueRecall, SIGNAL(activated(int)), this, SLOT(slotSetCueRecall(int))); // Re-queue tracks in Auto DJ ComboBoxAutoDjRequeue->addItem(tr("Off")); ComboBoxAutoDjRequeue->addItem(tr("On")); ComboBoxAutoDjRequeue->setCurrentIndex(m_pConfig->getValueString(ConfigKey("[Auto DJ]", "Requeue")).toInt()); connect(ComboBoxAutoDjRequeue, SIGNAL(activated(int)), this, SLOT(slotSetAutoDjRequeue(int))); #ifdef __AUTODJCRATES__ // The minimum available for randomly-selected tracks autoDjMinimumAvailableSpinBox->setValue( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "MinimumAvailable"), "20").toInt()); connect(autoDjMinimumAvailableSpinBox, SIGNAL(valueChanged(int)), this, SLOT(slotSetAutoDjMinimumAvailable(int))); // The auto-DJ replay-age for randomly-selected tracks autoDjIgnoreTimeCheckBox->setChecked( (bool) m_pConfig->getValueString( ConfigKey("[Auto DJ]", "UseIgnoreTime"), "0").toInt()); connect(autoDjIgnoreTimeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(slotSetAutoDjUseIgnoreTime(int))); autoDjIgnoreTimeEdit->setTime( QTime::fromString( m_pConfig->getValueString( ConfigKey("[Auto DJ]", "IgnoreTime"), "23:59"), autoDjIgnoreTimeEdit->displayFormat())); autoDjIgnoreTimeEdit->setEnabled( autoDjIgnoreTimeCheckBox->checkState() == Qt::Checked); connect(autoDjIgnoreTimeEdit, SIGNAL(timeChanged(const QTime &)), this, SLOT(slotSetAutoDjIgnoreTime(const QTime &))); #else // __AUTODJCRATES__ // Remove the preferences. autoDjMinimumAvailableLabel->setVisible(false); GridLayout1->removeWidget(autoDjMinimumAvailableLabel); autoDjMinimumAvailableSpinBox->setVisible(false); GridLayout1->removeWidget(autoDjMinimumAvailableSpinBox); autoDjIgnoreTimeCheckBox->setVisible(false); GridLayout1->removeWidget(autoDjIgnoreTimeCheckBox); autoDjIgnoreTimeEdit->setVisible(false); GridLayout1->removeWidget(autoDjIgnoreTimeEdit); #endif // __AUTODJCRATES__ // // Skin configurations // QString warningString = "<img src=\":/images/preferences/ic_preferences_warning.png\") width=16 height=16 />" + tr("The selected skin is bigger than your screen resolution."); warningLabel->setText(warningString); ComboBoxSkinconf->clear(); QDir dir(m_pConfig->getResourcePath() + "skins/"); dir.setFilter(QDir::Dirs); QString configuredSkinPath = m_pSkinLoader->getConfiguredSkinPath(); QList<QFileInfo> list = dir.entryInfoList(); int j=0; for (int i=0; i<list.size(); ++i) { if (list.at(i).fileName()!="." && list.at(i).fileName()!="..") { checkSkinResolution(list.at(i).fileName()) ? ComboBoxSkinconf->insertItem(i, QIcon(":/trolltech/styles/commonstyle/images/standardbutton-apply-32.png"), list.at(i).fileName()) : ComboBoxSkinconf->insertItem(i, QIcon(":/images/preferences/ic_preferences_warning.png"), list.at(i).fileName()); if (list.at(i).filePath() == configuredSkinPath) { ComboBoxSkinconf->setCurrentIndex(j); } ++j; } } connect(ComboBoxSkinconf, SIGNAL(activated(int)), this, SLOT(slotSetSkin(int))); connect(ComboBoxSchemeconf, SIGNAL(activated(int)), this, SLOT(slotSetScheme(int))); checkSkinResolution(ComboBoxSkinconf->currentText()) ? warningLabel->hide() : warningLabel->show(); slotUpdateSchemes(); // // Tooltip configuration // ComboBoxTooltips->addItem(tr("On")); // 1 ComboBoxTooltips->addItem(tr("On (only in Library)")); // 2 ComboBoxTooltips->addItem(tr("Off")); // 0 // Update combo box int configTooltips = m_mixxx->getToolTipsCgf(); // Add two mod-3 makes the on-disk order match up with the combo-box // order. ComboBoxTooltips->setCurrentIndex((configTooltips + 2) % 3); connect(ComboBoxTooltips, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSetTooltips(int))); // // Ramping Temporary Rate Change configuration // // Set Ramp Rate On or Off connect(groupBoxRateRamp, SIGNAL(toggled(bool)), this, SLOT(slotSetRateRamp(bool))); groupBoxRateRamp->setChecked((bool) m_pConfig->getValueString(ConfigKey("[Controls]","RateRamp")).toInt() ); // Update Ramp Rate Sensitivity connect(SliderRateRampSensitivity, SIGNAL(valueChanged(int)), this, SLOT(slotSetRateRampSensitivity(int))); SliderRateRampSensitivity->setValue( m_pConfig->getValueString(ConfigKey("[Controls]","RateRampSensitivity")).toInt() ); slotUpdate(); initWaveformControl(); }
kpEffectsDialog::kpEffectsDialog (bool actOnSelection, kpMainWindow *parent, const char *name) : kpToolPreviewDialog (kpToolPreviewDialog::Preview, true/*reserve top row*/, QString::null/*caption*/, QString::null/*afterActionText (no Dimensions Group Box)*/, actOnSelection, parent, name), m_delayedUpdateTimer (new QTimer (this)), m_effectsComboBox (0), m_settingsGroupBox (0), m_settingsLayout (0), m_colorEffectWidget (0) { #if DEBUG_KP_EFFECTS_DIALOG kdDebug () << "kpEffectsDialog::kpEffectsDialog()" << endl; #endif if (actOnSelection) setCaption (i18n ("More Image Effects (Selection)")); else setCaption (i18n ("More Image Effects")); connect (m_delayedUpdateTimer, SIGNAL (timeout ()), this, SLOT (slotUpdateWithWaitCursor ())); QHBox *effectContainer = new QHBox (mainWidget ()); effectContainer->setSpacing (spacingHint () * 4 /*need more space for QGroupBox titles*/); effectContainer->setMargin (0); QLabel *label = new QLabel (i18n ("&Effect:"), effectContainer); m_effectsComboBox = new KComboBox (effectContainer); m_effectsComboBox->insertItem (i18n ("Balance")); m_effectsComboBox->insertItem (i18n ("Emboss")); m_effectsComboBox->insertItem (i18n ("Flatten")); m_effectsComboBox->insertItem (i18n ("Invert")); m_effectsComboBox->insertItem (i18n ("Reduce Colors")); m_effectsComboBox->insertItem (i18n ("Soften & Sharpen")); label->setBuddy (m_effectsComboBox); effectContainer->setStretchFactor (m_effectsComboBox, 1); addCustomWidgetToFront (effectContainer); m_settingsGroupBox = new QGroupBox (mainWidget ()); m_settingsLayout = new QVBoxLayout (m_settingsGroupBox, marginHint () * 2, spacingHint ()); addCustomWidgetToBack (m_settingsGroupBox); connect (m_effectsComboBox, SIGNAL (activated (int)), this, SLOT (selectEffect (int))); selectEffect (0); resize (s_lastWidth, s_lastHeight); #if DEBUG_KP_EFFECTS_DIALOG kdDebug () << "\tabout to slotUpdate()" << endl; #endif slotUpdate (); }
// public slot void kpEffectsDialog::selectEffect (int which) { #if DEBUG_KP_EFFECTS_DIALOG kdDebug () << "kpEffectsDialog::selectEffect(" << which << ")" << endl; #endif if (which < 0 || which >= m_effectsComboBox->count ()) { return; } if (which != m_effectsComboBox->currentItem ()) m_effectsComboBox->setCurrentItem (which); delete m_colorEffectWidget; m_colorEffectWidget = 0; m_settingsGroupBox->setCaption (QString::null); #define CREATE_EFFECT_WIDGET(name) \ m_colorEffectWidget = new name (m_actOnSelection, \ m_mainWindow, \ m_settingsGroupBox) switch (which) { case 0: CREATE_EFFECT_WIDGET (kpEffectBalanceWidget); break; case 1: CREATE_EFFECT_WIDGET (kpEffectEmbossWidget); break; case 2: CREATE_EFFECT_WIDGET (kpEffectFlattenWidget); break; case 3: CREATE_EFFECT_WIDGET (kpEffectInvertWidget); break; case 4: CREATE_EFFECT_WIDGET (kpEffectReduceColorsWidget); break; case 5: CREATE_EFFECT_WIDGET (kpEffectBlurSharpenWidget); break; } #undef CREATE_EFFECT_WIDGET if (m_colorEffectWidget) { #if DEBUG_KP_EFFECTS_DIALOG kdDebug () << "\twidget exists for effect #" << endl; #endif m_settingsGroupBox->setTitle (m_colorEffectWidget->caption ()); // Don't resize the preview when showing the widget: // TODO: actually work QSize previewGroupBoxMinSize = m_previewGroupBox->minimumSize (); QSize previewGroupBoxMaxSize = m_previewGroupBox->maximumSize (); QLayout::ResizeMode previewGroupBoxResizeMode = m_previewGroupBox->layout () ? m_previewGroupBox->layout ()->resizeMode () : QLayout::Auto; #if DEBUG_KP_EFFECTS_DIALOG kdDebug () << "\tpreviewGroupBox: minSize=" << previewGroupBoxMinSize << " maxSize=" << previewGroupBoxMaxSize << " size=" << m_previewGroupBox->size () << " layout=" << m_previewGroupBox->layout () << " resizeMode=" << previewGroupBoxResizeMode << endl; #endif if (m_previewGroupBox->layout ()) m_previewGroupBox->layout ()->setResizeMode (QLayout::FreeResize); #if DEBUG_KP_EFFECTS_DIALOG kdDebug () << "\tafter set resizeMode, previewGroupBox.size=" << m_previewGroupBox->size () << endl; #endif m_previewGroupBox->setFixedSize (m_previewGroupBox->size ()); #if DEBUG_KP_EFFECTS_DIALOG kdDebug () << "\tafter set fixedSize, previewGroupBox.size=" << m_previewGroupBox->size () << endl; #endif // Show widget m_settingsLayout->addWidget (m_colorEffectWidget); #if DEBUG_KP_EFFECTS_DIALOG kdDebug () << "\tafter addWidget, previewGroupBox.size=" << m_previewGroupBox->size () << endl; #endif m_colorEffectWidget->show (); #if DEBUG_KP_EFFECTS_DIALOG kdDebug () << "\tafter addWidget show, previewGroupBox.size=" << m_previewGroupBox->size () << endl; #endif m_previewGroupBox->setMinimumSize (previewGroupBoxMinSize); m_previewGroupBox->setMaximumSize (previewGroupBoxMaxSize); #if DEBUG_KP_EFFECTS_DIALOG kdDebug () << "\tafter set fixedSize, previewGroupBox.size=" << m_previewGroupBox->size () << endl; #endif if (m_previewGroupBox->layout ()) m_previewGroupBox->layout ()->setResizeMode (previewGroupBoxResizeMode); #if DEBUG_KP_EFFECTS_DIALOG kdDebug () << "\tafter restore resizeMode, previewGroupBox.size=" << m_previewGroupBox->size () << endl; #endif connect (m_colorEffectWidget, SIGNAL (settingsChangedNoWaitCursor ()), this, SLOT (slotUpdate ())); connect (m_colorEffectWidget, SIGNAL (settingsChanged ()), this, SLOT (slotUpdateWithWaitCursor ())); connect (m_colorEffectWidget, SIGNAL (settingsChangedDelayed ()), this, SLOT (slotDelayedUpdate ())); slotUpdateWithWaitCursor (); #if DEBUG_KP_EFFECTS_DIALOG kdDebug () << "\tafter slotUpdateWithWaitCursor, previewGroupBox.size=" << m_previewGroupBox->size () << endl; #endif } }
VCMatrix::VCMatrix(QWidget *parent, Doc *doc) : VCWidget(parent, doc) , m_matrixID(Function::invalidId()) , m_instantApply(true) , m_visibilityMask(VCMatrix::defaultVisibilityMask()) { /* Set the class name "VCLabel" as the object name as well */ setObjectName(VCMatrix::staticMetaObject.className()); setFrameStyle(KVCFrameStyleSunken); QHBoxLayout *hBox = new QHBoxLayout(this); //hBox->setContentsMargins(3, 3, 3, 10); //hBox->setSpacing(5); m_slider = new ClickAndGoSlider(); m_slider->setStyleSheet(CNG_DEFAULT_STYLE); m_slider->setFixedWidth(32); m_slider->setRange(0, 255); m_slider->setPageStep(1); m_slider->setInvertedAppearance(false); hBox->addWidget(m_slider); connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int))); QVBoxLayout *vbox = new QVBoxLayout(this); m_startColorButton = new QToolButton(this); m_startColorButton->setFixedSize(48, 48); m_startColorButton->setIconSize(QSize(42, 42)); QWidgetAction* scAction = new QWidgetAction(this); m_scCnGWidget = new ClickAndGoWidget(); m_scCnGWidget->setType(ClickAndGoWidget::RGB, NULL); scAction->setDefaultWidget(m_scCnGWidget); QMenu *startColorMenu = new QMenu(); startColorMenu->addAction(scAction); m_startColorButton->setMenu(startColorMenu); m_startColorButton->setPopupMode(QToolButton::InstantPopup); connect(m_scCnGWidget, SIGNAL(colorChanged(QRgb)), this, SLOT(slotStartColorChanged(QRgb))); m_endColorButton = new QToolButton(this); m_endColorButton->setFixedSize(48, 48); m_endColorButton->setIconSize(QSize(42, 42)); QWidgetAction* ecAction = new QWidgetAction(this); m_ecCnGWidget = new ClickAndGoWidget(); m_ecCnGWidget->setType(ClickAndGoWidget::RGB, NULL); ecAction->setDefaultWidget(m_ecCnGWidget); QMenu *endColorMenu = new QMenu(); endColorMenu->addAction(ecAction); m_endColorButton->setMenu(endColorMenu); m_endColorButton->setPopupMode(QToolButton::InstantPopup); connect(m_ecCnGWidget, SIGNAL(colorChanged(QRgb)), this, SLOT(slotEndColorChanged(QRgb))); m_label = new QLabel(this); m_label->setAlignment(Qt::AlignCenter); m_label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); vbox->addWidget(m_label); QHBoxLayout *btnHbox = new QHBoxLayout(this); btnHbox->addWidget(m_startColorButton); btnHbox->addWidget(m_endColorButton); vbox->addLayout(btnHbox); m_presetCombo = new QComboBox(this); //m_presetCombo->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); m_presetCombo->addItems(doc->rgbScriptsCache()->names()); connect(m_presetCombo, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotAnimationChanged(QString))); vbox->addWidget(m_presetCombo); hBox->addLayout(vbox); m_controlsLayout = new FlowLayout(); vbox->addLayout(m_controlsLayout); setType(VCWidget::AnimationWidget); setCaption(QString()); /* Initial size */ QSettings settings; QVariant var = settings.value(SETTINGS_RGBMATRIX_SIZE); if (var.isValid() == true) resize(var.toSize()); else resize(defaultSize); /* Update timer */ m_updateTimer = new QTimer(this); connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(slotUpdate())); m_updateTimer->setSingleShot(true); /* Update the slider according to current mode */ slotModeChanged(m_doc->mode()); setLiveEdit(m_liveEdit); }
ControlEditorDialog::ControlEditorDialog ( QWidget *parent, RosegardenDocument *doc, DeviceId device ): QMainWindow(parent), m_studio(&doc->getStudio()), m_doc(doc), m_device(device), m_modified(false) { RG_DEBUG << "ControlEditorDialog::ControlEditorDialog: device is " << m_device << endl; QWidget *mainFrame = new QWidget(this); QVBoxLayout *mainFrameLayout = new QVBoxLayout; setCentralWidget(mainFrame); setAttribute(Qt::WA_DeleteOnClose); // everything else failed, so screw it, let's just set the fscking minimum // width the brute force way setMinimumWidth(935); setWindowTitle(tr("Manage Controllers")); QString deviceName(tr("<no device>")); MidiDevice *md = dynamic_cast<MidiDevice *>(m_studio->getDevice(m_device)); if (md) deviceName = strtoqstr(md->getName()); // spacing hack! new QLabel("", mainFrame); new QLabel(tr(" Controllers for %1 (device %2)") .arg(deviceName) .arg(device), mainFrame); new QLabel("", mainFrame); QStringList sl; sl << tr("Name ") << tr("Type ") << tr("Number ") << tr("Description ") << tr("Min. value ") << tr("Max. value ") << tr("Default value ") << tr("Color ") << tr("Position on instrument panel"); m_treeWidget = new QTreeWidget(mainFrame); m_treeWidget->setHeaderLabels(sl); m_treeWidget->setSortingEnabled(true); mainFrameLayout->addWidget(m_treeWidget); QFrame *btnBox = new QFrame(mainFrame); mainFrameLayout->addWidget(btnBox); mainFrame->setLayout(mainFrameLayout); btnBox->setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); // QT3: I don't think it's necessary to replace the following ",4, 10" with // anything to explicitly set the dimensions of the HBox, but there might be // some compatibility trickery I'm not remembering, etc. Leaving as a // reminder in case the layout turns out broken: QHBoxLayout* layout = new QHBoxLayout(btnBox /*, 4, 10 */); m_addButton = new QPushButton(tr("Add"), btnBox); m_deleteButton = new QPushButton(tr("Delete"), btnBox); m_closeButton = new QPushButton(tr("Close"), btnBox); m_addButton->setToolTip(tr("Add a Control Parameter to the Studio")); m_deleteButton->setToolTip(tr("Delete a Control Parameter from the Studio")); m_closeButton->setToolTip(tr("Close the Control Parameter editor")); layout->addStretch(10); layout->addWidget(m_addButton); layout->addWidget(m_deleteButton); layout->addSpacing(30); layout->addWidget(m_closeButton); layout->addSpacing(5); connect(m_addButton, SIGNAL(released()), SLOT(slotAdd())); connect(m_deleteButton, SIGNAL(released()), SLOT(slotDelete())); setupActions(); connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()), this, SLOT(slotUpdate())); connect(m_treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), SLOT(slotEdit(QTreeWidgetItem *, int))); // Highlight all columns - enable extended selection mode // m_treeWidget->setAllColumnsShowFocus(true); m_treeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); initDialog(); // Set the top item in the list, if able. if (m_treeWidget->topLevelItemCount()) { m_treeWidget->setCurrentItem(m_treeWidget->topLevelItem(0)); } }
//------------------------------------------------------------------------------------------------- ExchangeRate::ExchangeRate() : QWidget(), nam(new QNetworkAccessManager(this)), iPrecision(2), bUseProxy(false), bProxyIsSocks(false), iPort(3128), bAuth(false), dMaxSum(100000000000000000000.05) { const QString strAppName = qAppName(), strAppDir = qApp->applicationDirPath(); strAppStg = strAppDir + '/' + strAppName + ".ini"; QTranslator *translator = new QTranslator(this); if (translator->load(strAppName, strAppDir) || translator->load(strAppName + '_' + QLocale::system().name(), strAppDir)) qApp->installTranslator(translator); leUah = new QLineEdit(this); QVBoxLayout *vblSpacing = new QVBoxLayout; vblSpacing->addSpacing(15); leUsd = new QLineEdit(this); leEur = new QLineEdit(this); leRub = new QLineEdit(this); gbMain = new QGroupBox(this); gbMain->setEnabled(false); QFormLayout *frml = new QFormLayout(gbMain); frml->addRow("UAH:", leUah); frml->addRow(vblSpacing); frml->addRow("USD:", leUsd); frml->addRow("EUR:", leEur); frml->addRow("RUB:", leRub); QPushButton *pbUpdate = new QPushButton(style()->standardIcon(QStyle::SP_BrowserReload), tr("Update"), this); lblInfo = new QLabel(this); QFont fontSaved = lblInfo->font(); fontSaved.setItalic(true); lblInfo->setFont(fontSaved); QHBoxLayout *hblUpdate = new QHBoxLayout; hblUpdate->setContentsMargins(0, 0, 0, 0); hblUpdate->addWidget(pbUpdate); hblUpdate->addWidget(lblInfo); lblNote = new QLabel("?\n1 USD = ?\n1 EUR = ?\n1 UAH = ?", this); QGroupBox *gbNote = new QGroupBox(this); gbNote->setMinimumWidth(170); QVBoxLayout *vbNote = new QVBoxLayout(gbNote); vbNote->addLayout(hblUpdate); vbNote->addWidget(lblNote); QLabel *lblVer = new QLabel(cFullVersion, this); QPushButton *pbSettings = new QPushButton(style()->standardIcon(QStyle::SP_FileDialogDetailedView), 0, this); QHBoxLayout *hblBottom = new QHBoxLayout; hblBottom->addStretch(); hblBottom->addWidget(lblVer); hblBottom->addWidget(pbSettings); QVBoxLayout *vblRight = new QVBoxLayout; vblRight->addWidget(gbNote); vblRight->addLayout(hblBottom, Qt::AlignRight); QHBoxLayout *hblMain = new QHBoxLayout(this); hblMain->addWidget(gbMain); hblMain->addLayout(vblRight); this->setMaximumHeight(this->minimumSizeHint().height()); //connects connect(leUah, SIGNAL(textEdited(QString)), this, SLOT(slotFromUah(QString))); connect(leUsd, SIGNAL(textEdited(QString)), this, SLOT(slotFromUsd(QString))); connect(leEur, SIGNAL(textEdited(QString)), this, SLOT(slotFromEur(QString))); connect(leRub, SIGNAL(textEdited(QString)), this, SLOT(slotFromRub(QString))); connect(pbUpdate, SIGNAL(clicked()), this, SLOT(slotUpdate())); connect(pbSettings, SIGNAL(clicked()), this, SLOT(slotShowSettings())); connect(nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotReplyFin(QNetworkReply*))); //settings QSettings stg(strAppStg, QSettings::IniFormat); stg.setIniCodec("UTF-8"); if (stg.childGroups().contains("Settings")) { stg.beginGroup("Settings"); const QString strDate = stg.value("DateTime").toString(); if (QDateTime::fromString(strDate, "dd.MM.yyyy").isValid() && (dUahPerUsd = stg.value("USD").toDouble()) > 3.0 && dUahPerUsd < 80.0 && (dUahPerEur = stg.value("EUR").toDouble()) > 3.0 && dUahPerEur < 80.0 && (dUahPerRub = stg.value("RUB").toDouble()) > 0.1 && dUahPerRub < 1.0) { lblNote->setText(strDate + "\n1 USD = " + QString::number(dUahPerUsd, 'f', 6) + " UAH\n1 EUR = " + QString::number(dUahPerEur, 'f', 6) + " UAH\n1 UAH = " + QString::number(1.0/dUahPerRub, 'f', 6) + " RUB"); gbMain->setEnabled(true); } int iTemp = stg.value("Precision", -1).toInt(); if (iTemp >= 0 && iTemp <= 10) iPrecision = iTemp; if (stg.value("UseProxy").toString() == "1") bUseProxy = true; if (stg.value("ProxyType") == "SOCKS5") bProxyIsSocks = true; strServer = stg.value("Server").toString(); iTemp = stg.value("Port").toInt(); if (iTemp > 0 && iTemp <= 65535) iPort = iTemp; if (stg.value("Auth").toString() == "1") bAuth = true; strUser = stg.value("User").toString(); strPassword = stg.value("Password").toString(); stg.endGroup(); if (bUseProxy) { QNetworkProxy netProxy(bProxyIsSocks ? QNetworkProxy::Socks5Proxy : QNetworkProxy::HttpProxy, strServer, iPort); if (bAuth) { netProxy.setUser(strUser); netProxy.setPassword(strPassword); } nam->setProxy(netProxy); } } this->restoreGeometry(QSettings("UserPrograms", strAppName).value("Geometry").toByteArray()); }
DlgPrefController::DlgPrefController(QWidget* parent, Controller* controller, ControllerManager* controllerManager, UserSettingsPointer pConfig) : DlgPreferencePage(parent), m_pConfig(pConfig), m_pControllerManager(controllerManager), m_pController(controller), m_pDlgControllerLearning(NULL), m_pInputTableModel(NULL), m_pInputProxyModel(NULL), m_pOutputTableModel(NULL), m_pOutputProxyModel(NULL), m_bDirty(false) { m_ui.setupUi(this); initTableView(m_ui.m_pInputMappingTableView); initTableView(m_ui.m_pOutputMappingTableView); initTableView(m_ui.m_pScriptsTableWidget); connect(m_pController, SIGNAL(presetLoaded(ControllerPresetPointer)), this, SLOT(slotPresetLoaded(ControllerPresetPointer))); // TODO(rryan): Eh, this really isn't thread safe but it's the way it's been // since 1.11.0. We shouldn't be calling Controller methods because it lives // in a different thread. Booleans (like isOpen()) are fine but a complex // object like a preset involves QHash's and other data structures that // really don't like concurrent access. ControllerPresetPointer pPreset = m_pController->getPreset(); slotPresetLoaded(pPreset); m_ui.labelDeviceName->setText(m_pController->getName()); QString category = m_pController->getCategory(); if (!category.isEmpty()) { m_ui.labelDeviceCategory->setText(category); } else { m_ui.labelDeviceCategory->hide(); } // When the user picks a preset, load it. connect(m_ui.comboBoxPreset, SIGNAL(activated(int)), this, SLOT(slotLoadPreset(int))); // When the user toggles the Enabled checkbox, toggle. connect(m_ui.chkEnabledDevice, SIGNAL(clicked(bool)), this, SLOT(slotEnableDevice(bool))); // Connect our signals to controller manager. connect(this, SIGNAL(openController(Controller*)), m_pControllerManager, SLOT(openController(Controller*))); connect(this, SIGNAL(closeController(Controller*)), m_pControllerManager, SLOT(closeController(Controller*))); connect(this, SIGNAL(loadPreset(Controller*, ControllerPresetPointer)), m_pControllerManager, SLOT(loadPreset(Controller*, ControllerPresetPointer))); // Input mappings connect(m_ui.btnAddInputMapping, SIGNAL(clicked()), this, SLOT(addInputMapping())); connect(m_ui.btnRemoveInputMappings, SIGNAL(clicked()), this, SLOT(removeInputMappings())); connect(m_ui.btnLearningWizard, SIGNAL(clicked()), this, SLOT(showLearningWizard())); connect(m_ui.btnClearAllInputMappings, SIGNAL(clicked()), this, SLOT(clearAllInputMappings())); // Output mappings connect(m_ui.btnAddOutputMapping, SIGNAL(clicked()), this, SLOT(addOutputMapping())); connect(m_ui.btnRemoveOutputMappings, SIGNAL(clicked()), this, SLOT(removeOutputMappings())); connect(m_ui.btnClearAllOutputMappings, SIGNAL(clicked()), this, SLOT(clearAllOutputMappings())); // Scripts connect(m_ui.m_pScriptsTableWidget, SIGNAL(cellChanged(int, int)), this, SLOT(slotDirty())); connect(m_ui.btnAddScript, SIGNAL(clicked()), this, SLOT(addScript())); connect(m_ui.btnRemoveScript, SIGNAL(clicked()), this, SLOT(removeScript())); connect(m_ui.btnOpenScript, SIGNAL(clicked()), this, SLOT(openScript())); slotUpdate(); }
VCSpeedDial::VCSpeedDial(QWidget* parent, Doc* doc) : VCWidget(parent, doc) , m_currentFactor(1) , m_resetFactorOnDialChange(false) , m_absoluteValueMin(0) , m_absoluteValueMax(1000 * 10) { setFrameStyle(KVCFrameStyleSunken); QVBoxLayout* vBox = new QVBoxLayout(this); vBox->setMargin(0); QHBoxLayout* speedDialHBox = new QHBoxLayout(); vBox->addLayout(speedDialHBox); m_dial = new SpeedDial(this); speedDialHBox->addWidget(m_dial); connect(m_dial, SIGNAL(valueChanged(int)), this, SLOT(slotDialValueChanged())); connect(m_dial, SIGNAL(tapped()), this, SLOT(slotDialTapped())); m_factoredValue = m_dial->value(); setType(VCWidget::SpeedDialWidget); setCaption(tr("Duration")); QSettings settings; QVariant var = settings.value(SETTINGS_SPEEDDIAL_SIZE); if (var.isValid() == true) resize(var.toSize()); else resize(VCSpeedDial::defaultSize); var = settings.value(SETTINGS_SPEEDDIAL_VALUE); if (var.isValid() == true) m_dial->setValue(var.toUInt()); // Multiplier, factor, divider and reset box QHBoxLayout* multFactorDivHBox = new QHBoxLayout(); m_divButton = new QToolButton(); m_divButton->setIconSize(QSize(32, 32)); m_divButton->setIcon(QIcon(":/back.png")); m_divButton->setToolTip(tr("Divide the current time by 2")); connect(m_divButton, SIGNAL(clicked()), this, SLOT(slotDiv())); multFactorDivHBox->addWidget(m_divButton, Qt::AlignVCenter | Qt::AlignLeft); QVBoxLayout* labelsVboxBox = new QVBoxLayout(); m_multDivLabel = new QLabel(); m_multDivLabel->setAlignment(Qt::AlignCenter); m_multDivLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); labelsVboxBox->addWidget(m_multDivLabel, Qt::AlignVCenter | Qt::AlignLeft); m_multDivResultLabel = new QLabel(); m_multDivResultLabel->setAlignment(Qt::AlignCenter); m_multDivResultLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_multDivResultLabel->setBackgroundRole(QPalette::BrightText); labelsVboxBox->addWidget(m_multDivResultLabel); multFactorDivHBox->addLayout(labelsVboxBox); m_multButton = new QToolButton(); m_multButton->setIconSize(QSize(32, 32)); m_multButton->setIcon(QIcon(":/forward.png")); m_multButton->setToolTip(tr("Multiply the current time by 2")); connect(m_multButton, SIGNAL(clicked()), this, SLOT(slotMult())); multFactorDivHBox->addWidget(m_multButton, Qt::AlignVCenter | Qt::AlignLeft); m_multDivResetButton = new QToolButton(); m_multDivResetButton->setIconSize(QSize(32, 32)); m_multDivResetButton->setIcon(QIcon(":/fileclose.png")); m_multDivResetButton->setToolTip(tr("Reset the current factor to 1x")); connect(m_multDivResetButton, SIGNAL(clicked()), this, SLOT(slotMultDivReset())); multFactorDivHBox->addWidget(m_multDivResetButton); vBox->addLayout(multFactorDivHBox); // Update labels slotMultDivChanged(); // Apply button m_applyButton = new QPushButton(); m_applyButton->setStyleSheet(presetBtnSS.arg("#DDDDDD")); m_applyButton->setText(tr("Apply")); m_applyButton->setToolTip(tr("Send the current value to the function now")); connect(m_applyButton, SIGNAL(clicked()), this, SLOT(slotFactoredValueChanged())); vBox->addWidget(m_applyButton); // Presets m_presetsLayout = new FlowLayout(3); vBox->addLayout(m_presetsLayout); // Don't show Infinite button: it's handled by presets setVisibilityMask(SpeedDial::defaultVisibilityMask() & ~SpeedDial::Infinite); /* Update timer */ m_updateTimer = new QTimer(this); connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(slotUpdate())); m_updateTimer->setSingleShot(true); slotModeChanged(m_doc->mode()); setLiveEdit(m_liveEdit); }
DlgPrefLibrary::DlgPrefLibrary(QWidget * parent, UserSettingsPointer config, Library *pLibrary) : DlgPreferencePage(parent), m_dirListModel(), m_pconfig(config), m_pLibrary(pLibrary), m_baddedDirectory(false), m_iOriginalTrackTableRowHeight(Library::kDefaultRowHeightPx) { setupUi(this); slotUpdate(); checkbox_ID3_sync->setVisible(false); connect(this, SIGNAL(requestAddDir(QString)), m_pLibrary, SLOT(slotRequestAddDir(QString))); connect(this, SIGNAL(requestRemoveDir(QString, Library::RemovalType)), m_pLibrary, SLOT(slotRequestRemoveDir(QString, Library::RemovalType))); connect(this, SIGNAL(requestRelocateDir(QString,QString)), m_pLibrary, SLOT(slotRequestRelocateDir(QString,QString))); connect(PushButtonAddDir, SIGNAL(clicked()), this, SLOT(slotAddDir())); connect(PushButtonRemoveDir, SIGNAL(clicked()), this, SLOT(slotRemoveDir())); connect(PushButtonRelocateDir, SIGNAL(clicked()), this, SLOT(slotRelocateDir())); //connect(pushButtonM4A, SIGNAL(clicked()), this, SLOT(slotM4ACheck())); connect(pushButtonExtraPlugins, SIGNAL(clicked()), this, SLOT(slotExtraPlugins())); // plugins are loaded in src/main.cpp way early in boot so this is safe // here, doesn't need done at every slotUpdate QStringList plugins(SoundSourceProxy::getSupportedFileExtensionsByPlugins()); if (plugins.length() > 0) { pluginsLabel->setText(plugins.join(", ")); } // Set default direction as stored in config file int rowHeight = m_pLibrary->getTrackTableRowHeight(); spinBoxRowHeight->setValue(rowHeight); connect(spinBoxRowHeight, SIGNAL(valueChanged(int)), this, SLOT(slotRowHeightValueChanged(int))); connect(libraryFontButton, SIGNAL(clicked()), this, SLOT(slotSelectFont())); connect(this, SIGNAL(setTrackTableFont(QFont)), m_pLibrary, SLOT(slotSetTrackTableFont(QFont))); connect(this, SIGNAL(setTrackTableRowHeight(int)), m_pLibrary, SLOT(slotSetTrackTableRowHeight(int))); // TODO(XXX) this string should be extracted from the soundsources QString builtInFormatsStr = "Ogg Vorbis, FLAC, WAVe, AIFF"; #if defined(__MAD__) || defined(__APPLE__) builtInFormatsStr += ", MP3"; #endif #ifdef __OPUS__ builtInFormatsStr += ", Opus"; #endif #ifdef _MODPLUG_ builtInFormatsStr += ", ModPlug"; #endif builtInFormats->setText(builtInFormatsStr); }
void ProtocolDataWidget::onRecv(Message_ptr m) { Address from; if (From const* f = static_cast<From const*>(m->find(From::id))) { from = f->address(); } if (PFileSend const* pfs = static_cast<PFileSend const*>(m->find(IMProto::FileSend))) { QString const& sn = QString::fromUtf8(pfs->property_data(IMProto::EventSn)); QString const& kName = QString::fromUtf8(pfs->property_data(IMProto::FileKey)); QString const& fName = QString::fromUtf8(pfs->property_data(IMProto::FileName)); quint64 siz = QString::fromUtf8(pfs->property_data(IMProto::FileSize)).toULongLong(); //u16 port = QString::fromUtf8(pfs->property_data(IMProto::ListenPort)).toUShort(); QTreeWidgetItem* root = new QTreeWidgetItem; this->addTopLevelItem(root); m_RecvItemMap.insert(sn, root); QString const& sizstr = GetFormatedFileSize(siz); root->setText(COL_NAME, fName); root->setText(COL_SIZE, sizstr); root->setText(COL_TYPE, tr("File")); root->setText(COL_STATE, tr("waiting to receive")); root->setText(COL_PERCENT, "0%"); root->setData(COL_NAME, FileKeyRole, kName); root->setData(COL_NAME, FileSizeRole, siz); root->setData(COL_NAME, DirFileRole, "FILE"); root->setData(COL_NAME, SendRecvRole, "R"); root->setData(COL_NAME, TransStateRole, "WAIT"); root->setData(COL_NAME, TransItemSNRole, sn); root->setIcon(COL_NAME, QIcon(DataAccess::SkinPath() + "/download-file.png")); root->setIcon(COL_STATE, QIcon(DataAccess::SkinPath() + "/clock.png")); emit sigTips(tr("The other request to send %1:%2. Please switch to file transferring window to process.") .arg(tr("File")) .arg(fName)); } else if (PDirFileRecv const* pfr = static_cast<PDirFileRecv const*>(m->find(IMProto::DirFileRecv))) { QString const& sn = QString::fromUtf8(pfr->property_data(IMProto::EventSn)); QString const& kName = QString::fromUtf8(pfr->property_data(IMProto::FileKey)); u16 port = QString::fromUtf8(pfr->property_data(IMProto::ListenPort)).toUShort(); QTreeWidgetItem* item = m_SendItemMap.value(sn, 0); if (!item) { //QMessageBox::critical(this, tr("Error"), tr("Unable to find item in file SendItemMap. key: %1.").arg(keys[2])); return; } QString const& pfName = m_userItem->SendingFilesCollection()->value(kName); if (pfName.isEmpty()) { //QMessageBox::critical(this, tr("Error"), tr("Unable to find in SendingFilesCollection key: %1.").arg(keys[2])); return; } QFileInfo finfo(pfName); ProtocolDataTransfer* pdthr = 0; if (finfo.isFile()) { pdthr = new ProtocolDataTransfer(item, pfName, 0, port, m_userItem->IpAddress(), ProtocolDataTransfer::DoSendFile); connect(&m_timer, SIGNAL(timeout()), pdthr, SLOT(slotUpdate())); } else if (finfo.isDir()) { pdthr = new ProtocolDataTransfer(item, pfName, port, m_userItem->IpAddress(), ProtocolDataTransfer::DoSendDir); connect(&m_timer, SIGNAL(timeout()), pdthr, SLOT(slotUpdate())); } if (!pdthr) { return; } item->setData(COL_NAME, TransThreadRole, (quint64)pdthr); if (!m_timer.isActive()) { m_timer.start(1000); } pdthr->start(); } else if (ProfileWithProperties const* pds = static_cast<ProfileWithProperties const*>(m->find(IMProto::DirSend))) { QString const& sn = QString::fromUtf8(pds->property_data(IMProto::EventSn)); QString const& kName = QString::fromUtf8(pds->property_data(IMProto::FileKey)); QString const& dName = QString::fromUtf8(pds->property_data(IMProto::FileName)); quint64 siz = QString::fromUtf8(pds->property_data(IMProto::FileSize)).toULongLong(); //u16 port = QString::fromUtf8(pfs->property_data(IMProto::ListenPort)).toUShort(); QTreeWidgetItem* root = new QTreeWidgetItem; this->addTopLevelItem(root); m_RecvItemMap.insert(sn, root); QString const& sizstr = tr("unknown"); root->setText(COL_NAME, dName); root->setText(COL_SIZE, sizstr); root->setText(COL_TYPE, tr("Dir")); root->setText(COL_STATE, tr("waiting to receive")); root->setText(COL_PERCENT, "0%"); root->setData(COL_NAME, FileKeyRole, kName); root->setData(COL_NAME, FileSizeRole, siz); root->setData(COL_NAME, DirFileRole, "DIR"); root->setData(COL_NAME, SendRecvRole, "R"); root->setData(COL_NAME, TransStateRole, "WAIT"); root->setData(COL_NAME, TransItemSNRole, sn); root->setIcon(COL_NAME, QIcon(DataAccess::SkinPath() + "/download-folder.png")); root->setIcon(COL_STATE, QIcon(DataAccess::SkinPath() + "/clock.png")); emit sigTips(tr("The other request to send %1:%2. Please switch to file transferring window to process.") .arg(tr("Dir")) .arg(dName)); } else if (PDirFileSendCancel const* pfsc = static_cast<PDirFileSendCancel const*>(m->find(IMProto::DirFileSendCancel))) { QString const& sn = QString::fromUtf8(pfsc->property_data(IMProto::EventSn)); QTreeWidgetItem* item = m_RecvItemMap.value(sn); if (!item) { //QMessageBox::critical(this, tr("Error"), tr("Unable to find item in file RecvItemMap. key: %1.").arg(keys[2])); return; } QString tips = tr("The other canceled sending %1: %2.").arg(item->text(COL_TYPE)).arg(item->text(COL_NAME)); emit sigTips(tips); m_RecvItemMap.remove(sn); QString const& tsr = item->data(COL_NAME, TransStateRole).toString(); if (tsr == "START") { ProtocolDataTransfer* t = (ProtocolDataTransfer*)item->data(COL_NAME, TransThreadRole).toULongLong(); disconnect(&m_timer, SIGNAL(timeout()), t, SLOT(slotUpdate())); t->slotCancel(); } if (!delItemWhenFinished) { item->setData(COL_NAME, TransStateRole, "CANCEL"); item->setIcon(COL_STATE, QIcon(DataAccess::SkinPath() + "/warning.png")); item->setText(COL_STATE, tr("Canceled")); } else { this->takeTopLevelItem(this->indexOfTopLevelItem(item)); } } else if (ProfileWithProperties const* pfrc = static_cast<ProfileWithProperties const*>(m->find(IMProto::DirFileRecvCancel))) { QString const& sn = QString::fromUtf8(pfrc->property_data(IMProto::EventSn)); QTreeWidgetItem* item = m_SendItemMap.value(sn, 0); if (!item) { //QMessageBox::critical(this, tr("Error"), tr("Unable to find item in file SendItemMap. key: %1.").arg(keys[2])); return; } QString tips = tr("The other canceled receiving %1: %2.").arg(item->text(COL_TYPE)).arg(item->text(COL_NAME)); emit sigTips(tips); m_SendItemMap.remove(sn); QString const& tsr = item->data(COL_NAME, TransStateRole).toString(); if (tsr == "START") { ProtocolDataTransfer* t = (ProtocolDataTransfer*)item->data(COL_NAME, TransThreadRole).toLongLong(); disconnect(&m_timer, SIGNAL(timeout()), t, SLOT(slotUpdate())); t->slotCancel(); } if (!delItemWhenFinished) { item->setData(COL_NAME, TransStateRole, "CANCEL"); item->setIcon(COL_STATE, QIcon(DataAccess::SkinPath() + "/warning.png")); item->setText(COL_STATE, tr("Canceled")); } else { this->takeTopLevelItem(this->indexOfTopLevelItem(item)); } } }
void DlgPrefBeats::maxBpmRangeChanged(int value) { m_maxBpm = value; slotUpdate(); }
Pong::Pong(QRect rect, QObject * parent) : QGraphicsScene(rect, parent) { setBackgroundBrush(QBrush(Qt::black)); mSeed = (uint) QTime::currentTime().msec(); mRect = rect; mMode = MODE_SINGLE; mThisPIsLeftP = true; mStoppable = false; mPort = NULL; mStirr = 15; mStirrAngle = 135; mSpeedX = 10; mSpeedY = 10; mMaxSpeedX = 20; mMaxSpeedY = 20; mMinSpeedX = 1; mMinSpeedY = 1; mFrequency = 35; mActionPeriod = 15; mNumberOfBalls = 5; mPoints = 10; mPaddleHeight = 96; mPaddleInc = mPaddleHeight / 1.5; mLeftP = new Player(); mLeftP->r = new QGraphicsRectItem(0, 0, mRect.width() / 25, mRect.height() / 5); mLeftP->r->setPos(mLeftP->r->x(), mRect.height() / 2 - mLeftP->r->rect().height() / 2); mLeftP->r->setBrush(QBrush(PLAYER_BRUSH_COLOR)); addItem(mLeftP->r); mRightP = new Player(); mRightP->r = new QGraphicsRectItem(0, 0, mRect.width() / 25, mRect.height() / 5); mRightP->r->setPos(mRect.width() - mRightP->r->rect().width(), mRect.height() / 2 - mRightP->r->rect().height() / 2); mRightP->r->setBrush(QBrush(PLAYER_BRUSH_COLOR)); addItem(mRightP->r); dsmax = (qreal) (mMaxSpeedX - mSpeedX) / (mActionPeriod * mFrequency); dsmin = (qreal) (mSpeedX - mMinSpeedX) / (mActionPeriod * mFrequency); mScoreTextGroup = new QGraphicsItemGroup(); mSeparator = new QGraphicsSimpleTextItem(); mSeparator->setText(":"); mSeparator->setPen(QPen(Qt::black)); mSeparator->setBrush(QBrush(Qt::white)); mSeparator->setFont(QFont("Comic Sans", 25, QFont::Black)); mSeparator->setPos(mRect.width() / 2 - mSeparator->boundingRect().width() / 2, 0); mScoreTextGroup->addToGroup(mSeparator); mLeftPScoreText = new QGraphicsSimpleTextItem(); mLeftPScoreText->setText("0"); mLeftPScoreText->setPen(QPen(Qt::black)); mLeftPScoreText->setBrush(QBrush(Qt::white)); mLeftPScoreText->setFont(QFont("Comic Sans", 25, QFont::Black)); mLeftPScoreText->setPos(mRect.width() / 2 - mLeftPScoreText->boundingRect().width() - mSeparator->boundingRect().width() / 2, 0); mScoreTextGroup->addToGroup(mLeftPScoreText); mRightPScoreText = new QGraphicsSimpleTextItem(); mRightPScoreText->setText("0"); mRightPScoreText->setPen(QPen(Qt::black)); mRightPScoreText->setBrush(QBrush(Qt::white)); mRightPScoreText->setFont(QFont("Comic Sans", 25, QFont::Black)); mRightPScoreText->setPos(mRect.width() / 2 + mSeparator->boundingRect().width() / 2, 0); mScoreTextGroup->addToGroup(mRightPScoreText); addItem(mScoreTextGroup); mTimer = new QTimer(this); connect(mTimer, SIGNAL(timeout()), this, SLOT(slotUpdate())); mActionTimer = new QTimer(this); connect(mActionTimer, SIGNAL(timeout()), this, SLOT(slotAction())); slotNewGame(); }
void ProtocolDataWidget::slotCancel() { QTreeWidgetItem* item = this->currentItem(); if (!item) { QMessageBox::information(this, tr("Tips"), tr("Please choose the item that you want to operate.")); return; } QString const& kName = item->data(COL_NAME, FileKeyRole).toString(); if (m_userItem->SendingFilesCollection()->value(kName, "").isEmpty()) { QMessageBox::critical(this, tr("Error"), tr("Unable to find key: %1 in SendingFilesCollection.").arg(kName)); return; } QString const& tsr = item->data(COL_NAME, TransStateRole).toString(); if (tsr == "START" || tsr == "WAIT") { QString const& srr = item->data(COL_NAME, SendRecvRole).toString(); QString const& sn = item->data(COL_NAME, TransItemSNRole).toString(); if (srr == "S") { Message_ptr m(new Message); PDirFileSendCancel* pfsc = new PDirFileSendCancel(IMProto::DirFileSendCancel); pfsc->add(IMProto::EventSn, sn.toUtf8().data()); m->add(Profile_ptr (pfsc)); m->add(Profile_ptr (new To(m_userItem->Addr()))); DataAccess::sendMsg(m); QString tips = tr("You canceled sending %1: %2.").arg(item->text(COL_TYPE)).arg(item->text(COL_NAME)); emit sigTips(tips); m_SendItemMap.remove(sn); } else if (srr == "R") { Message_ptr m(new Message); PDirFileRecvCancel* pfrc = new PDirFileRecvCancel(IMProto::DirFileRecvCancel); pfrc->add(IMProto::EventSn, sn.toUtf8().data()); m->add(Profile_ptr (pfrc)); m->add(Profile_ptr (new To(m_userItem->Addr()))); DataAccess::sendMsg(m); QString tips = tr("You canceled receiving %1: %2.").arg(item->text(COL_TYPE)).arg(item->text(COL_NAME)); emit sigTips(tips); m_RecvItemMap.remove(sn); } if (tsr == "START") { ProtocolDataTransfer* t = (ProtocolDataTransfer*)item->data(COL_NAME, TransThreadRole).toULongLong(); disconnect(&m_timer, SIGNAL(timeout()), t, SLOT(slotUpdate())); t->slotCancel(); } if (!delItemWhenFinished) { item->setData(COL_NAME, TransStateRole, "CANCEL"); item->setIcon(COL_STATE, QIcon(DataAccess::SkinPath() + "/warning.png")); item->setText(COL_STATE, tr("Canceled")); } else { this->takeTopLevelItem(this->indexOfTopLevelItem(item)); } } }
void DlgPrefBeats::slotReanalyzeChanged(int value) { m_bReanalyze = static_cast<bool>(value); slotUpdate(); }
void ProtocolDataWidget::slotSave() { QTreeWidgetItem* item = this->currentItem(); if (!item) { QMessageBox::information(this, tr("Tips"), tr("Please choose the item that you want to operate.")); return; } QString const& kName = item->data(COL_NAME, FileKeyRole).toString(); if (m_userItem->SendingFilesCollection()->value(kName, "").isEmpty()) { QMessageBox::critical(this, tr("Error"), tr("Unable to find key: %1 in ReceivingFilesCollection.").arg(kName)); return; } QString const& fType = item->data(COL_NAME, DirFileRole).toString(); QString const& srr = item->data(COL_NAME, SendRecvRole).toString(); QString const& state = item->data(COL_NAME, TransStateRole).toString(); if (srr == "S") { QMessageBox::information(this, tr("Tips"), tr("You can't save a send item.")); return; } if (state == "WAIT") { quint64 siz = item->data(0, FileSizeRole).toULongLong(); quint16 port = DataAccess::genTcpPort(); ProtocolDataTransfer* pdthr = 0; if (fType == "FILE") { QString const &saveName = QFileDialog::getSaveFileName(this, tr("Choose Save File Name"), m_DataAccess.SaveDir() + "/" + item->text(COL_NAME)); if (saveName.isEmpty()) { return; } QFileInfo finfo(saveName); m_DataAccess.updateSaveDir(finfo.absolutePath()); pdthr = new ProtocolDataTransfer(item, saveName, siz, port); connect(&m_timer, SIGNAL(timeout()), pdthr, SLOT(slotUpdate())); } else if (fType == "DIR") { QString dir = QFileDialog::getExistingDirectory(this, tr("Choose Save Directory Name"), m_DataAccess.SaveDir()); if (dir.isEmpty()) { return; } m_DataAccess.updateSaveDir(dir); QString saveDir; if (dir.endsWith("/")) { saveDir = dir + item->text(COL_NAME); } else { saveDir = dir + "/" + item->text(COL_NAME); } QDir qDir; qDir.mkpath(saveDir); pdthr = new ProtocolDataTransfer(item, saveDir, port); connect(&m_timer, SIGNAL(timeout()), pdthr, SLOT(slotUpdate())); } if (!pdthr) { return; } m_timer.start(1000); pdthr->start(); QString const& sn = m_RecvItemMap.key(item); Message_ptr m(new Message); PDirFileRecv* pfr = new PDirFileRecv(IMProto::DirFileRecv); pfr->add(IMProto::ListenPort, QString::number(port).toUtf8().data(), false); pfr->add(IMProto::EventSn, sn.toUtf8().data(), false); pfr->add(IMProto::FileKey, kName.toUtf8().data(), false); pfr->update_size(); m->add(Profile_ptr (pfr)); m->add(Profile_ptr(new To(m_userItem->Addr()))); DataAccess::sendMsg(m); item->setData(COL_NAME, TransThreadRole, (quint64)pdthr); } }
void DlgPrefBeats::fastAnalysisEnabled(int i) { m_FastAnalysisEnabled = static_cast<bool>(i); slotUpdate(); }
LibraryScanner::LibraryScanner(QWidget* pParentWidget, TrackCollection* collection) : m_pCollection(collection), m_libraryHashDao(m_database), m_cueDao(m_database), m_playlistDao(m_database), m_crateDao(m_database), m_directoryDao(m_database), m_analysisDao(m_database, collection->getConfig()), m_trackDao(m_database, m_cueDao, m_playlistDao, m_crateDao, m_analysisDao, m_libraryHashDao, collection->getConfig()) { // Don't initialize m_database here, we need to do it in run() so the DB // conn is in the right thread. qDebug() << "Starting LibraryScanner thread."; // Move LibraryScanner to its own thread so that our signals/slots will // queue to our event loop. moveToThread(this); m_pool.moveToThread(this); unsigned static id = 0; // the id of this LibraryScanner, for debugging purposes setObjectName(QString("LibraryScanner %1").arg(++id)); m_pool.setMaxThreadCount(kScannerThreadPoolSize); // Listen to signals from our public methods (invoked by other threads) and // connect them to our slots to run the command on the scanner thread. connect(this, SIGNAL(startScan()), this, SLOT(slotStartScan())); // Force the GUI thread's TrackInfoObject cache to be cleared when a library // scan is finished, because we might have modified the database directly // when we detected moved files, and the TIOs corresponding to the moved // files would then have the wrong track location. connect(this, SIGNAL(scanFinished()), &(collection->getTrackDAO()), SLOT(clearCache())); connect(this, SIGNAL(trackAdded(TrackPointer)), &(collection->getTrackDAO()), SLOT(databaseTrackAdded(TrackPointer))); connect(this, SIGNAL(tracksMoved(QSet<int>, QSet<int>)), &(collection->getTrackDAO()), SLOT(databaseTracksMoved(QSet<int>, QSet<int>))); connect(this, SIGNAL(tracksChanged(QSet<int>)), &(collection->getTrackDAO()), SLOT(databaseTracksChanged(QSet<int>))); // Parented to pParentWidget so we don't need to delete it. LibraryScannerDlg* pProgress = new LibraryScannerDlg(pParentWidget); connect(this, SIGNAL(progressLoading(QString)), pProgress, SLOT(slotUpdate(QString))); connect(this, SIGNAL(progressHashing(QString)), pProgress, SLOT(slotUpdate(QString))); connect(this, SIGNAL(scanStarted()), pProgress, SLOT(slotScanStarted())); connect(this, SIGNAL(scanFinished()), pProgress, SLOT(slotScanFinished())); connect(pProgress, SIGNAL(scanCancelled()), this, SLOT(cancel())); connect(&m_trackDao, SIGNAL(progressVerifyTracksOutside(QString)), pProgress, SLOT(slotUpdate(QString))); connect(&m_trackDao, SIGNAL(progressCoverArt(QString)), pProgress, SLOT(slotUpdateCover(QString))); start(); }
void DlgPrefBeats::analyzerEnabled(int i) { m_banalyzerEnabled = static_cast<bool>(i); slotUpdate(); }