bool ImportCoverArtDialog::Create() { if (!LoadWindowFromXML("music-ui.xml", "import_coverart", this)) return false; bool err = false; UIUtilE::Assign(this, m_filenameText, "file", &err); UIUtilE::Assign(this, m_currentText, "position", &err); UIUtilE::Assign(this, m_statusText, "status", &err); UIUtilE::Assign(this, m_destinationText, "destination", &err); UIUtilE::Assign(this, m_coverartImage, "coverart", &err); UIUtilE::Assign(this, m_copyButton, "copy", &err); UIUtilE::Assign(this, m_exitButton, "exit", &err); UIUtilE::Assign(this, m_prevButton, "prev", &err); UIUtilE::Assign(this, m_nextButton, "next", &err); UIUtilE::Assign(this, m_typeList, "type", &err); if (err) { LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'import_coverart'"); return false; } if (m_typeList) { new MythUIButtonListItem(m_typeList, tr("Front Cover"), qVariantFromValue(0)); new MythUIButtonListItem(m_typeList, tr("Back Cover"), qVariantFromValue(1)); new MythUIButtonListItem(m_typeList, tr("CD"), qVariantFromValue(2)); new MythUIButtonListItem(m_typeList, tr("Inlay"), qVariantFromValue(3)); new MythUIButtonListItem(m_typeList, tr("<Unknown>"), qVariantFromValue(4)); connect(m_typeList, SIGNAL(itemSelected(MythUIButtonListItem *)), SLOT(selectorChanged())); } if (m_copyButton) connect(m_copyButton, SIGNAL(Clicked()), this, SLOT(copyPressed())); if (m_exitButton) connect(m_exitButton, SIGNAL(Clicked()), this, SLOT(Close())); if (m_prevButton) connect(m_prevButton, SIGNAL(Clicked()), this, SLOT(prevPressed())); if (m_nextButton) connect(m_nextButton, SIGNAL(Clicked()), this, SLOT(nextPressed())); BuildFocusList(); scanDirectory(); return true; }
bool ArchiveFileSelector::Create(void) { bool foundtheme = false; // Load the theme for this screen foundtheme = LoadWindowFromXML("mythnative-ui.xml", "archivefile_selector", this); if (!foundtheme) return false; bool err = false; UIUtilW::Assign(this, m_titleText, "title"); UIUtilE::Assign(this, m_fileButtonList, "filelist", &err); UIUtilE::Assign(this, m_locationEdit, "location_edit", &err); UIUtilE::Assign(this, m_backButton, "back_button", &err); UIUtilE::Assign(this, m_homeButton, "home_button", &err); UIUtilE::Assign(this, m_nextButton, "next_button", &err); UIUtilE::Assign(this, m_prevButton, "prev_button", &err); UIUtilE::Assign(this, m_cancelButton, "cancel_button", &err); UIUtilE::Assign(this, m_progTitle, "title_text", &err); UIUtilE::Assign(this, m_progSubtitle, "subtitle_text", &err); UIUtilE::Assign(this, m_progStartTime, "starttime_text", &err); if (err) { LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'archivefile_selector'"); return false; } if (m_titleText) m_titleText->SetText(tr("Find File To Import")); connect(m_nextButton, SIGNAL(Clicked()), this, SLOT(nextPressed())); connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(cancelPressed())); connect(m_prevButton, SIGNAL(Clicked()), this, SLOT(prevPressed())); connect(m_locationEdit, SIGNAL(LosingFocus()), this, SLOT(locationEditLostFocus())); m_locationEdit->SetText(m_curDirectory); connect(m_backButton, SIGNAL(Clicked()), this, SLOT(backPressed())); connect(m_homeButton, SIGNAL(Clicked()), this, SLOT(homePressed())); connect(m_fileButtonList, SIGNAL(itemSelected(MythUIButtonListItem *)), this, SLOT(itemSelected(MythUIButtonListItem *))); connect(m_fileButtonList, SIGNAL(itemClicked(MythUIButtonListItem *)), this, SLOT(itemClicked(MythUIButtonListItem *))); BuildFocusList(); SetFocusWidget(m_fileButtonList); updateSelectedList(); updateFileList(); return true; }
FaToDFA::FaToDFA(modes _mode, AlgorithmWidget* _algorithm_widget, FA_widget* _not_dfa_widget, FA_widget* _dfa_widget, QLabel* _var_widget, QObject* parrent) : Algorithm(parrent), mode(_mode), algorithm_widget(_algorithm_widget), not_dfa_widget(_not_dfa_widget), dfa_widget(_dfa_widget), var_widget(_var_widget) { actInstruction = HEADER; prewInstruction = HEADER; instruction_count = WHILE_NEW+1; initInstructions(); initBreakpoints(instruction_count); this->setColumnCount(1); this->setRowCount(instructions.count()); var_widget->setText(""); for(int i = 0; i < instructions.count();i++) { QModelIndex index = this->index(i,0,QModelIndex()); setData(index,instructions[i],Qt::EditRole); setData(index,true,Algorithm::HasBreakpoint_Role); setData(index,false,Algorithm::Breakpoint_Role); switch(i) { case HEADER: setData(index,false,Algorithm::HasBreakpoint_Role); break; } } // // Connect algorithm buttons. // connect(this->algorithm_widget,SIGNAL(playPressed(int)),this,SLOT(runAlgorithm(int))); connect(this->algorithm_widget,SIGNAL(stopPressed()),this,SLOT(stop())); connect(this->algorithm_widget,SIGNAL(prewPressed()),this,SLOT(prevStep())); connect(this->algorithm_widget,SIGNAL(nextPressed()),this,SLOT(nextStep())); connect(this->algorithm_widget, SIGNAL(checkSolutionPressed()), this, SLOT(checkSolution())); connect(this->algorithm_widget, SIGNAL(showCorrectSolutionPressed()), this, SLOT(showCorrectSolution())); connect(this->algorithm_widget, SIGNAL(showUserSolutionPressed()), this, SLOT(showUserSolution())); connect(this->algorithm_widget, SIGNAL(beginPressed()), this, SLOT(toBegin())); connect(this->algorithm_widget, SIGNAL(endPressed()), this, SLOT(toEnd())); // // Connect timers. // connect(play_timer, SIGNAL(timeout()), this, SLOT(nextStep())); connect(check_step_timer, SIGNAL(timeout()), this, SLOT(checkSolution())); // Connect Finite Automata widgets connect(not_dfa_widget,SIGNAL(FA_changed(FiniteAutomata*)),this,SLOT(setFA(FiniteAutomata*))); connect(dfa_widget,SIGNAL(FA_changed(FiniteAutomata*)),this,SLOT(setDFA(FiniteAutomata*))); not_dfa_widget->setFA(new FiniteAutomata()); algorithm_widget->enableShowButton(); }
bool ImportMusicDialog::Create() { if (!LoadWindowFromXML("music-ui.xml", "import_music", this)) return false; bool err = false; UIUtilE::Assign(this, m_locationEdit, "location", &err); UIUtilE::Assign(this, m_locationButton, "directoryfinder", &err); UIUtilE::Assign(this, m_scanButton, "scan", &err); UIUtilE::Assign(this, m_coverartButton, "coverart", &err); UIUtilE::Assign(this, m_filenameText, "filename", &err); UIUtilE::Assign(this, m_compartistText, "compartist", &err); UIUtilE::Assign(this, m_artistText, "artist", &err); UIUtilE::Assign(this, m_albumText, "album", &err); UIUtilE::Assign(this, m_titleText, "title", &err); UIUtilE::Assign(this, m_genreText, "genre", &err); UIUtilE::Assign(this, m_yearText, "year", &err); UIUtilE::Assign(this, m_trackText, "track", &err); UIUtilE::Assign(this, m_currentText, "position", &err); UIUtilE::Assign(this, m_statusText, "status", &err); UIUtilE::Assign(this, m_compilationCheck,"compilation", &err); UIUtilE::Assign(this, m_playButton, "play", &err); UIUtilE::Assign(this, m_nextnewButton, "nextnew", &err); UIUtilE::Assign(this, m_addButton, "add", &err); UIUtilE::Assign(this, m_addallnewButton, "addallnew", &err); UIUtilE::Assign(this, m_nextButton, "next", &err); UIUtilE::Assign(this, m_prevButton, "prev", &err); if (err) { LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'import_music'"); return false; } connect(m_prevButton, SIGNAL(Clicked()), SLOT(prevPressed())); connect(m_locationButton, SIGNAL(Clicked()), SLOT(locationPressed())); connect(m_scanButton, SIGNAL(Clicked()), SLOT(startScan())); connect(m_coverartButton, SIGNAL(Clicked()), SLOT(coverArtPressed())); connect(m_playButton, SIGNAL(Clicked()), SLOT(playPressed())); connect(m_nextnewButton, SIGNAL(Clicked()), SLOT(nextNewPressed())); connect(m_addButton, SIGNAL(Clicked()), SLOT(addPressed())); connect(m_addallnewButton, SIGNAL(Clicked()), SLOT(addAllNewPressed())); connect(m_nextButton, SIGNAL(Clicked()), SLOT(nextPressed())); fillWidgets(); BuildFocusList(); m_locationEdit->SetText(gCoreContext->GetSetting("MythMusicLastImportDir", "/")); return true; }
void PlayerWidget::mousePressEvent(QMouseEvent *e) { QPoint pos(myrtlpoint(e->pos())); if (e->button() == Qt::LeftButton) { _down = OverNone; if (_song && _over == OverPlay) { playPausePressed(); return; } else if (_over == OverPrev) { prevPressed(); } else if (_over == OverNext) { nextPressed(); } else if (_over == OverClose) { _down = OverClose; } else if (_over == OverVolume) { _down = OverVolume; _downCoord = pos.x() - _volumeRect.x(); cSetSongVolume(snap((_downCoord - ((_volumeRect.width() - st::playerVolume.pxWidth()) / 2)) / float64(st::playerVolume.pxWidth()), 0., 1.)); emit audioPlayer()->songVolumeChanged(); rtlupdate(_volumeRect); } else if (_over == OverPlayback) { SongMsgId playing; AudioPlayerState playingState = AudioPlayerStopped; int64 playingPosition = 0, playingDuration = 0; int32 playingFrequency = 0; audioPlayer()->currentState(&playing, &playingState, &playingPosition, &playingDuration, &playingFrequency); if (playing == _song && playingDuration) { if (playingState == AudioPlayerPlaying || playingState == AudioPlayerStarting || playingState == AudioPlayerResuming) { audioPlayer()->pauseresume(OverviewDocuments); } _down = OverPlayback; _downProgress = snap((pos.x() - _playbackRect.x()) / float64(_playbackRect.width()), 0., 1.); _downDuration = playingDuration; _downFrequency = (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency); rtlupdate(_playbackRect); updateDownTime(); } } else if (_over == OverFull && _song) { if (HistoryItem *item = App::histItemById(_song.msgId)) { App::main()->showMediaOverview(item->history()->peer, OverviewAudioDocuments); } } else if (_over == OverRepeat) { _repeat = !_repeat; updateOverRect(OverRepeat); } } }
CAlgorithmWidget::CAlgorithmWidget(QWidget *parent) : QWidget(parent), m_mode(AlgorithmModes::NONE), ui(new Ui::AlgorithmWidget) { ui->setupUi(this); showSolution = true; connect(this->ui->nextButton,SIGNAL(clicked()),this,SIGNAL(nextPressed())); connect(this->ui->prewButton,SIGNAL(clicked()),this,SIGNAL(prewPressed())); connect(this->ui->playButton,SIGNAL(clicked()),this,SLOT(emitPlay())); connect(this->ui->stopButton,SIGNAL(clicked()),this,SIGNAL(stopPressed())); connect(this->ui->checkButton,SIGNAL(clicked()),this,SIGNAL(checkSolutionPressed())); connect(this->ui->beginButton,SIGNAL(clicked()), this, SIGNAL(beginPressed())); connect(this->ui->endButton,SIGNAL(clicked()),this, SIGNAL(endPressed())); SetMode(m_mode); ui->Formal->removeTab(1); }
void eNFSSetup::okPressed() { int IP[4]; __u32 sip; for (int i=0; i<4; i++) IP[i]=ip->getNumber(i); eNumber::pack(sip, IP); if(sdir->getText().length()==0 || ldir->getText().length()==0) { errorMessage(_("invalid or missing dir or local dir")); return; } else { cmd.sprintf("/elitedvb/network/nfs%d/",cur_entry); eConfig::getInstance()->setKey((cmd+"ip").c_str(), sip); eConfig::getInstance()->setKey((cmd+"sdir").c_str(), sdir->getText().c_str()); eConfig::getInstance()->setKey((cmd+"ldir").c_str(), ldir->getText().c_str()); eConfig::getInstance()->setKey((cmd+"fstype").c_str(), (int)combo_fstype->getCurrent()->getKey()); eConfig::getInstance()->setKey((cmd+"options").c_str(), (int)combo_options->getCurrent()->getKey()); eConfig::getInstance()->setKey((cmd+"extraoptions").c_str(), extraoptions->getText().c_str()); eConfig::getInstance()->setKey((cmd+"username").c_str(), user->getText().c_str()); eConfig::getInstance()->setKey((cmd+"password").c_str(), pass->getText().c_str()); eConfig::getInstance()->setKey((cmd+"automount").c_str(), (int)doamount->isChecked()); } int tmp = (int)combo_fstype->getCurrent()->getKey(); eString tmp1 = _("NFS/CIFS-Entry stored. Further entry?\n"); eString tmp2 = _("NFS/CIFS-Setup..."); tmp1.strReplace("NFS/CIFS", tmp == 2 ? "SMBFS" : tmp == 1 ? "CIFS" : "NFS" ); tmp2.strReplace("NFS/CIFS", "NFS/CIFS/SMBFS" ); int res = eMessageBox::ShowBox( tmp1, tmp2, eMessageBox::btYes|eMessageBox::btNo, eMessageBox::btNo); if (res == eMessageBox::btYes) { nextPressed(); setFocus(ip); } }
void PlayerWidget::updateState(SongMsgId playing, AudioPlayerState playingState, int64 playingPosition, int64 playingDuration, int32 playingFrequency) { if (!playing) { audioPlayer()->currentState(&playing, &playingState, &playingPosition, &playingDuration, &playingFrequency); } bool songChanged = false; if (playing && _song != playing) { songChanged = true; _song = playing; if (HistoryItem *item = App::histItemById(_song.msgId)) { _history = item->history(); if (_history->peer->migrateFrom()) { _migrated = App::history(_history->peer->migrateFrom()->id); _msgmigrated = false; } else if (_history->peer->migrateTo()) { _migrated = _history; _history = App::history(_migrated->peer->migrateTo()->id); _msgmigrated = true; } findCurrent(); } else { _history = 0; _msgmigrated = false; _index = -1; } SongData *song = _song.song->song(); if (song->performer.isEmpty()) { _name.setText(st::linkFont, song->title.isEmpty() ? (_song.song->name.isEmpty() ? qsl("Unknown Track") : _song.song->name) : song->title, _textNameOptions); } else { TextCustomTagsMap custom; custom.insert(QChar('c'), qMakePair(textcmdStartLink(1), textcmdStopLink())); _name.setRichText(st::linkFont, QString::fromUtf8("[c]%1[/c] \xe2\x80\x93 %2").arg(textRichPrepare(song->performer)).arg(song->title.isEmpty() ? qsl("Unknown Track") : textRichPrepare(song->title)), _textNameOptions, custom); } updateControls(); } qint64 position = 0, duration = 0, display = 0; if (playing == _song) { if (!(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { display = position = playingPosition; duration = playingDuration; } else { display = playingDuration; } display = display / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency); } else if (_song) { display = _song.song->song()->duration; } bool showPause = false, stopped = ((playingState & AudioPlayerStoppedMask) || playingState == AudioPlayerFinishing); bool wasPlaying = !!_duration; if (!stopped) { showPause = (playingState == AudioPlayerPlaying || playingState == AudioPlayerResuming || playingState == AudioPlayerStarting); } QString time; float64 progress = 0.; int32 loaded; float64 loadProgress = 1.; if (duration || !_song || !_song.song || !_song.song->loading()) { time = (_down == OverPlayback) ? _time : formatDurationText(display); progress = duration ? snap(float64(position) / duration, 0., 1.) : 0.; loaded = duration ? _song.song->size : 0; } else { loaded = _song.song->loading() ? _song.song->loadOffset() : 0; time = formatDownloadText(loaded, _song.song->size); loadProgress = snap(float64(loaded) / qMax(_song.song->size, 1), 0., 1.); } if (time != _time || showPause != _showPause) { if (_time != time) { _time = time; _timeWidth = st::linkFont->width(_time); } _showPause = showPause; if (duration != _duration || position != _position || loaded != _loaded) { if (!songChanged && ((!stopped && duration && _duration) || (!duration && _loaded != loaded))) { a_progress.start(progress); a_loadProgress.start(loadProgress); _a_progress.start(); } else { a_progress = anim::fvalue(progress, progress); a_loadProgress = anim::fvalue(loadProgress, loadProgress); _a_progress.stop(); } _position = position; _duration = duration; _loaded = loaded; } update(); } else if (duration != _duration || position != _position || loaded != _loaded) { if (!songChanged && ((!stopped && duration && _duration) || (!duration && _loaded != loaded))) { a_progress.start(progress); a_loadProgress.start(loadProgress); _a_progress.start(); } else { a_progress = anim::fvalue(progress, progress); a_loadProgress = anim::fvalue(loadProgress, loadProgress); _a_progress.stop(); } _position = position; _duration = duration; _loaded = loaded; } if (wasPlaying && playingState == AudioPlayerStoppedAtEnd) { if (_repeat) { startPlay(_song.msgId); } else { nextPressed(); } } if (songChanged) { emit playerSongChanged(_song.msgId); } }
ConversionDlg::ConversionDlg ( QWidget*parent ) : QWidget(parent) { inValueChanged = false; QVBoxLayout *vbox = new QVBoxLayout(this); grid* g = new grid(3,this); g->setContentsMargins(3,3,3,3); vbox->addWidget(g); new QWidget(g); new QLabel(" Hex:",g); leditors[HexLE] = new QLineEdit(g); new QWidget(g); new QLabel(" ASCII:",g); leditors[AsciiLE] = new QLineEdit(g); byteSwapFlag[IntegerBS] = new QCheckBox("b/s",g); new QLabel(" Int:",g); leditors[IntegerLE] = new QLineEdit(g); byteSwapFlag[FloatBS] = new QCheckBox("b/s",g); new QLabel(" Float:",g); leditors[FloatLE] = new QLineEdit(g); byteSwapFlag[DoubleBS] = new QCheckBox("b/s",g); new QLabel(" Double:",g); leditors[DoubleLE] = new QLineEdit(g); // make sure to do an update if any of the byte swap flags toggle for(int i = MinBS; i < MaxBS; ++i) { connect(byteSwapFlag[i],SIGNAL(clicked()), this,SLOT(valueChanged())); // add tool tip byteSwapFlag[i]->setToolTip("Byte Swap Data"); } // setup validators leditors[DoubleLE]->setValidator( new QDoubleValidator(this) ); QDoubleValidator *vd = new QDoubleValidator(this); vd->setRange( FLT_MAX, FLT_MAX ); leditors[FloatLE]->setValidator( vd ); leditors[IntegerLE]->setValidator( new QIntValidator(this) ); leditors[HexLE]->setValidator( new HexValidator(this) ); // setup editor connections connect(leditors[DoubleLE],SIGNAL(textChanged(const QString& )), this,SLOT(doubleChanged(const QString&)) ); connect(leditors[FloatLE],SIGNAL(textChanged(const QString& )), this,SLOT(floatChanged(const QString&)) ); connect(leditors[IntegerLE],SIGNAL(textChanged(const QString&)), this,SLOT(integerChanged(const QString&)) ); connect(leditors[HexLE],SIGNAL(textChanged(const QString&)), this,SLOT(valueChanged(const QString&))); connect(leditors[AsciiLE],SIGNAL(textChanged(const QString&)), this,SLOT(asciiChanged(const QString&))); for( int i = MinLE; i < MaxLE; ++i ) { connect(leditors[i],SIGNAL(returnPressed()), this,SIGNAL(nextPressed())); } hbox * h = new hbox(this); vbox->addWidget(h); vbox->addStretch(1); QPushButton* prev = new QPushButton("<",h); QPushButton* next = new QPushButton(">",h); connect(prev,SIGNAL(clicked()),this,SIGNAL(prevPressed())); connect(next,SIGNAL(clicked()),this,SIGNAL(nextPressed())); setWindowTitle("Conversion Dialog"); }