void soundKonverter::showConfigDialog() { ConfigDialog *dialog = new ConfigDialog( config, this/*, ConfigDialog::Page(configStartPage)*/ ); connect( dialog, SIGNAL(updateFileList()), m_view, SLOT(updateFileList()) ); dialog->resize( size() ); dialog->exec(); delete dialog; }
void FileFilterBaseItem::setFilter(const QString &filter) { if (filter == m_filter) return; m_filter = filter; m_regExpList.clear(); m_fileSuffixes.clear(); foreach (const QString &pattern, filter.split(QLatin1Char(';'))) { if (pattern.isEmpty()) continue; // decide if it's a canonical pattern like *.x if (pattern.startsWith(QLatin1String("*."))) { const QString suffix = pattern.right(pattern.size() - 1); if (!suffix.contains(QLatin1Char('*')) && !suffix.contains(QLatin1Char('?')) && !suffix.contains(QLatin1Char('['))) { m_fileSuffixes << suffix; continue; } } m_regExpList << QRegExp(pattern, Qt::CaseInsensitive, QRegExp::Wildcard); } updateFileList(); }
void PresentationAudioPage::slotSoundFilesButtonDown() { int Cpt = 0; for (int i = 0 ; i < m_SoundFilesListBox->count() ; ++i) { if (m_SoundFilesListBox->currentRow() == i) ++Cpt; } if (Cpt == 0) { return; } if (Cpt > 1) { QMessageBox::critical(this, QString(), i18n("You can only move files down one at a time.")); return; } int Index = m_SoundFilesListBox->currentRow(); if (Index == m_SoundFilesListBox->count()) { return; } PresentationAudioListItem* const pitem = static_cast<PresentationAudioListItem*>(m_SoundFilesListBox->takeItem(Index)); m_SoundFilesListBox->insertItem(Index + 1, pitem); m_SoundFilesListBox->setCurrentItem(pitem); updateFileList(); }
void FileSelector::homePressed() { char *home = getenv("HOME"); m_curDirectory = home; updateFileList(); }
void MythUIFileBrowser::backPressed() { if (m_isRemote) { m_subDirectory = m_parentDir; if (m_subDirectory.startsWith(m_baseDirectory)) { m_subDirectory.remove(0, m_baseDirectory.length()); if (m_subDirectory.startsWith("/")) m_subDirectory.remove(0, 1); } m_storageGroupDir = m_parentSGDir; } else { // move up one directory int pos = m_subDirectory.lastIndexOf('/'); if (pos > 0) m_subDirectory = m_subDirectory.left(pos); else m_subDirectory = "/"; } updateFileList(); }
void SoundtrackDialog::slotSoundFilesButtonDown() { int Cpt = 0; for (int i = 0 ; i < m_SoundFilesListBox->count() ; ++i) if (m_SoundFilesListBox->currentRow() == i) ++Cpt; if (Cpt == 0) return; if (Cpt > 1) { KMessageBox::error(this, i18n("You can only move files down one at a time.")); return; } int Index = m_SoundFilesListBox->currentRow(); if (Index == m_SoundFilesListBox->count()) return; SoundItem* pitem = static_cast<SoundItem*>(m_SoundFilesListBox->takeItem(Index)); m_SoundFilesListBox->insertItem(Index + 1, pitem); m_SoundFilesListBox->setCurrentItem(pitem); updateFileList(); }
void PresentationAudioPage::slotSoundFilesButtonAdd() { QPointer<QFileDialog> dlg = new QFileDialog(this, i18n("Select sound files"), d->sharedData->soundtrackPath.adjusted(QUrl::RemoveFilename).path()); QStringList atm; atm << QLatin1String("audio/mp3"); atm << QLatin1String("audio/wav"); atm << QLatin1String("audio/ogg"); atm << QLatin1String("audio/flac"); dlg->setMimeTypeFilters(atm); dlg->setAcceptMode(QFileDialog::AcceptOpen); dlg->setFileMode(QFileDialog::ExistingFiles); dlg->exec(); QList<QUrl> urls = dlg->selectedUrls(); if (!urls.isEmpty()) { addItems(urls); updateFileList(); } delete dlg; }
void PresentationAudioPage::slotAddDropItems(const QList<QUrl>& filesUrl) { if (!filesUrl.isEmpty()) { addItems(filesUrl); updateFileList(); } }
void MythUIFileBrowser::editLostFocus() { QString newPath = m_locationEdit->GetText(); SetPath(newPath); updateFileList(); }
void SoundtrackDialog::slotAddDropItems(const KUrl::List& filesUrl) { if (!filesUrl.isEmpty()) { addItems(filesUrl); updateFileList(); } }
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; }
Utils::FileSystemWatcher *FileFilterBaseItem::dirWatcher() { if (!m_dirWatcher) { m_dirWatcher = new Utils::FileSystemWatcher(1, this); // Separate id, might exceed OS limits. m_dirWatcher->setObjectName(QLatin1String("FileFilterBaseItemWatcher")); connect(m_dirWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(updateFileList())); } return m_dirWatcher; }
FileFilterBaseItem::FileFilterBaseItem(QObject *parent) : QmlProjectContentItem(parent), m_recurse(RecurseDefault) { m_updateFileListTimer.setSingleShot(true); m_updateFileListTimer.setInterval(50); connect(&m_dirWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(updateFileList())); connect(&m_updateFileListTimer, SIGNAL(timeout()), this, SLOT(updateFileListNow())); }
void FileFilterBaseItem::setDirectory(const QString &dirPath) { if (m_rootDir == dirPath) return; m_rootDir = dirPath; emit directoryChanged(); updateFileList(); }
void SoundtrackDialog::slotSoundFilesButtonLoad() { QPointer<KFileDialog> dlg = new KFileDialog(QString(), QString(), this); dlg->setOperationMode(KFileDialog::Opening); dlg->setMode(KFile::File); dlg->setFilter(QString("*.m3u|Playlist (*.m3u)")); dlg->setWindowTitle(i18n("Load playlist")); if (dlg->exec() != KFileDialog::Accepted) { delete dlg; return; } QString filename = dlg->selectedFile(); if (!filename.isEmpty()) { QFile file(filename); if (file.open(QIODevice::ReadOnly|QIODevice::Text)) { QTextStream in(&file); KUrl::List playlistFiles; while (!in.atEnd()) { QString line = in.readLine(); // we ignore the extended information of the m3u playlist file if (line.startsWith('#') || line.isEmpty()) continue; KUrl fUrl(line); if (fUrl.isValid()) { if (fUrl.isLocalFile()) { playlistFiles << fUrl; } } } if (!playlistFiles.isEmpty()) { m_SoundFilesListBox->clear(); addItems(playlistFiles); updateFileList(); } } } delete dlg; }
void FileSelector::backPressed() { // move up one directory int pos = m_curDirectory.lastIndexOf('/'); if (pos > 0) m_curDirectory = m_curDirectory.left(pos); else m_curDirectory = "/"; updateFileList(); }
void PresentationAudioPage::slotSoundFilesButtonLoad() { QPointer<QFileDialog> dlg = new QFileDialog(this, i18n("Load playlist"), QString(), i18n("Playlist (*.m3u)")); dlg->setAcceptMode(QFileDialog::AcceptOpen); dlg->setFileMode(QFileDialog::ExistingFile); if (dlg->exec() != QDialog::Accepted) { delete dlg; return; } QString filename = dlg->selectedFiles().isEmpty() ? QString() : dlg->selectedFiles().at(0); if (!filename.isEmpty()) { QFile file(filename); if (file.open(QIODevice::ReadOnly|QIODevice::Text)) { QTextStream in(&file); QList<QUrl> playlistFiles; while (!in.atEnd()) { QString line = in.readLine(); // we ignore the extended information of the m3u playlist file if (line.startsWith(QLatin1Char('#')) || line.isEmpty()) continue; QUrl fUrl(line); if (fUrl.isValid()) { if (fUrl.isLocalFile()) { playlistFiles << fUrl; } } } if (!playlistFiles.isEmpty()) { m_SoundFilesListBox->clear(); addItems(playlistFiles); updateFileList(); } } } delete dlg; }
void FileFilterBaseItem::setRecursive(bool recurse) { bool oldRecursive = recursive(); if (recurse) m_recurse = Recurse; else m_recurse = DoNotRecurse; if (recurse != oldRecursive) updateFileList(); }
/** *\fn void addFile() *\brief 添加一个新文件 *\return void 无 */ void CBrowseWnd::addFile() { int fileId = 0; int count = ListView_GetItemCount(list_.m_hWnd); char filename[256] = ""; for (int i = 0; i < count; i++) { ListView_GetItemText(list_.m_hWnd, i, 0, filename, sizeof(filename)-1); if (NULL != strstr(filename, NEW_FILE_NAME)) { if (atoi(&filename[strlen(NEW_FILE_NAME)]) >= fileId) { fileId = atoi(&filename[strlen(NEW_FILE_NAME)]) + 1; } } } sprintf_s(filename, NEW_FILE_NAME"%d", fileId); char path[1024] = ""; GetCurrentDirectory(MAX_PATH, path); int len = strlen(path); sprintf_s(&path[len], sizeof(path)-len-1, "\\%s\\%s", tempPath_, filename); char localPath[1024] = ""; PathCanonicalize(localPath, path); char remotePath[1024] = ""; path_.GetWindowText(remotePath, sizeof(remotePath)-1); strcat_s(remotePath, filename); if (!PathFileExists(tempPath_)) { ::CreateDirectory(tempPath_, NULL); } FILE *file = NULL; fopen_s(&file, localPath, "w+"); fwrite(filename, 1, strlen(filename), file); fclose(file); int ret = sftp_upload_file(&ssh_param_, localPath, remotePath); if (0 != ret) return; updateFileList(TreeView_GetSelection(tree_.m_hWnd)); }
void FileSelector::itemClicked(MythUIButtonListItem *item) { if (!item) return; FileData *fileData = qVariantValue<FileData*>(item->GetData()); if (fileData->directory) { if (fileData->filename == "..") { // move up on directory int pos = m_curDirectory.lastIndexOf('/'); if (pos > 0) m_curDirectory = m_curDirectory.left(pos); else m_curDirectory = "/"; } else { if (!m_curDirectory.endsWith("/")) m_curDirectory += "/"; m_curDirectory += fileData->filename; } updateFileList(); } else { if (m_selectorType == FSTYPE_FILELIST) { QString fullPath = m_curDirectory; if (!fullPath.endsWith("/")) fullPath += "/"; fullPath += fileData->filename; if (item->state() == MythUIButtonListItem::FullChecked) { m_selectedList.removeAll(fullPath); item->setChecked(MythUIButtonListItem::NotChecked); } else { if (m_selectedList.indexOf(fullPath) == -1) m_selectedList.append(fullPath); item->setChecked(MythUIButtonListItem::FullChecked); } } } }
void SoundtrackDialog::readSettings() { m_rememberSoundtrack->setChecked(m_sharedData->soundtrackRememberPlaylist); m_loopCheckBox->setChecked(m_sharedData->soundtrackLoop); connect( m_sharedData->mainPage, SIGNAL(signalTotalTimeChanged(const QTime&)), this, SLOT(slotImageTotalTimeChanged(const QTime&) ) ); // if tracks are already set in m_sharedData, add them now if (!m_sharedData->soundtrackUrls.isEmpty()) addItems(m_sharedData->soundtrackUrls); updateFileList(); updateTracksNumber(); }
void MythUIFileBrowser::homePressed() { if (m_isRemote) { m_subDirectory = ""; m_storageGroupDir = ""; } else { char *home = getenv("HOME"); m_subDirectory = home; } updateFileList(); }
void MythUIFileBrowser::PathClicked(MythUIButtonListItem *item) { if (!item) return; MFileInfo finfo = item->GetData().value<MFileInfo>(); if (finfo.isFile()) { if (m_retObject) { DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, 0, finfo.filePath(), item->GetData()); QCoreApplication::postEvent(m_retObject, dce); } Close(); return; } if (!finfo.isDir()) return; if (finfo.isParentDir()) { backPressed(); } else { if (finfo.isRemote()) { m_subDirectory = finfo.subDir(); m_storageGroupDir = finfo.storageGroupDir(); } else { m_subDirectory = finfo.filePath(); m_storageGroupDir = ""; } } updateFileList(); }
void SoundtrackDialog::slotSoundFilesButtonDelete() { int Index = m_SoundFilesListBox->currentRow(); if( Index < 0 ) return; SoundItem* pitem = static_cast<SoundItem*>(m_SoundFilesListBox->takeItem(Index)); m_urlList.removeAll(pitem->url()); m_soundItems->remove(pitem->url()); m_timeMutex->lock(); m_tracksTime->remove(pitem->url()); updateTracksNumber(); m_timeMutex->unlock(); delete pitem; slotSoundFilesSelected(m_SoundFilesListBox->currentRow()); if (m_SoundFilesListBox->count() == 0) m_previewButton->setEnabled(false); updateFileList(); }
/** *\fn void runSftp(const char *path) *\brief 运行SFTP客户端 *\param[in] const char * path *\return void 无 */ void CBrowseWnd::runSftp(const char *path) { _beginthread(sftp_thread_func, 0, &ssh_param_); // 等待连接完成 for (int i = 0; i < 100; i++) { if (NULL != ssh_param_.channel) break; Sleep(100); } if (NULL == path) return; HTREEITEM item = createItem(path); updateFileList(item); processExpand_ = true; }
bool MythUIFileBrowser::Create() { if (!CopyWindowFromBase(m_widgetName, this)) return false; m_fileList = dynamic_cast<MythUIButtonList *>(GetChild("filelist")); m_locationEdit = dynamic_cast<MythUITextEdit *>(GetChild("location")); m_okButton = dynamic_cast<MythUIButton *>(GetChild("ok")); m_cancelButton = dynamic_cast<MythUIButton *>(GetChild("cancel")); m_backButton = dynamic_cast<MythUIButton *>(GetChild("back")); m_homeButton = dynamic_cast<MythUIButton *>(GetChild("home")); m_previewImage = dynamic_cast<MythUIImage *>(GetChild("preview")); m_infoText = dynamic_cast<MythUIText *>(GetChild("info")); m_filenameText = dynamic_cast<MythUIText *>(GetChild("filename")); m_fullpathText = dynamic_cast<MythUIText *>(GetChild("fullpath")); if (!m_fileList || !m_locationEdit || !m_okButton || !m_cancelButton) { LOG(VB_GENERAL, LOG_ERR, "MythUIFileBrowser: Your theme is missing" " some UI elements! Bailing out."); return false; } connect(m_fileList, SIGNAL(itemClicked(MythUIButtonListItem *)), SLOT(PathClicked(MythUIButtonListItem *))); connect(m_fileList, SIGNAL(itemSelected(MythUIButtonListItem *)), SLOT(PathSelected(MythUIButtonListItem *))); connect(m_locationEdit, SIGNAL(LosingFocus()), SLOT(editLostFocus())); connect(m_okButton, SIGNAL(Clicked()), SLOT(OKPressed())); connect(m_cancelButton, SIGNAL(Clicked()), SLOT(cancelPressed())); if (m_backButton) connect(m_backButton, SIGNAL(Clicked()), SLOT(backPressed())); if (m_homeButton) connect(m_homeButton, SIGNAL(Clicked()), SLOT(homePressed())); BuildFocusList(); updateFileList(); return true; }
void SoundtrackDialog::slotSoundFilesButtonAdd() { QPointer<KFileDialog> dlg = new KFileDialog(m_sharedData->soundtrackPath, "", this); // Setting available mime-types (filtering out non audio mime-types) dlg->setMimeFilter( Phonon::BackendCapabilities::availableMimeTypes().filter("audio/") ); dlg->setOperationMode(KFileDialog::Opening); dlg->setMode( KFile::Files ); dlg->setWindowTitle(i18n("Select sound files")); dlg->exec(); KUrl::List urls = dlg->selectedUrls(); if (!urls.isEmpty()) { addItems(urls); updateFileList(); } delete dlg; }
void PresentationAudioPage::slotSoundFilesButtonDelete() { int Index = m_SoundFilesListBox->currentRow(); if( Index < 0 ) return; PresentationAudioListItem* const pitem = static_cast<PresentationAudioListItem*>(m_SoundFilesListBox->takeItem(Index)); d->urlList.removeAll(pitem->url()); d->soundItems->remove(pitem->url()); d->timeMutex->lock(); d->tracksTime->remove(pitem->url()); updateTracksNumber(); d->timeMutex->unlock(); delete pitem; slotSoundFilesSelected(m_SoundFilesListBox->currentRow()); if (m_SoundFilesListBox->count() == 0) m_previewButton->setEnabled(false); updateFileList(); }
void FileFilterBaseItem::setPathsProperty(const QStringList &path) { m_explicitFiles = path; updateFileList(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //about window this->aboutWindow = new AboutWindow(); this->aboutWindow->hide(); this->aboutWindow->move(this->geometry().center()-this->aboutWindow->geometry().center()); //calibrate Dialog this->calibrateDialog = new CalibrateDialog(); this->calibrateDialog->hide(); this->calibrateDialog->move(this->geometry().center()-this->calibrateDialog->geometry().center()); //option Dialog this->optionDialog = new OptionDialog(); this->optionDialog->hide(); this->optionDialog->move(this->geometry().center()-this->optionDialog->geometry().center()); //slice dialog this->sliceDialog = new SliceDialog(ui->glWidget, this); this->sliceDialog->hide(); this->sliceDialog->move(this->geometry().center()-this->sliceDialog->geometry().center()); //macros window this->macrosWindow = new MacrosWindow(); this->macrosWindow->hide(); this->macrosWindow->move(this->geometry().center()-this->macrosWindow->geometry().center()); connect(this->macrosWindow, SIGNAL(buttonAdded(MacroButton*)), this, SLOT(addMacroBtn(MacroButton*))); connect(this->macrosWindow, SIGNAL(buttonRemoved(MacroButton*)), this, SLOT(removeMacroBtn(MacroButton*))); //sd card window this->sdCardWindow = new SDCardWindow(); this->sdCardWindow->hide(); this->sdCardWindow->move(this->geometry().center()-this->sdCardWindow->geometry().center()); connect(this->sdCardWindow, SIGNAL(sdFile_selected(QString)), this, SLOT(sdFile_selected(QString))); connect(this->optionDialog, SIGNAL(slicerPathChanged(QString)), this->sliceDialog, SLOT(updateSlicerPath(QString))); connect(this->optionDialog, SIGNAL(outputPathChanged(QString)), this->sliceDialog, SLOT(updateOutputPath(QString))); connect(this->optionDialog, SIGNAL(newSize(QVector3D)), this, SLOT(updatadeSize(QVector3D))); connect(this->optionDialog, SIGNAL(newList(QList<Material*>*)), this->sliceDialog, SLOT(setMaterialList(QList<Material*>*))); connect(this->sliceDialog, SIGNAL(fileSliced(QString)), this, SLOT(loadFile(QString))); //set version number this->setWindowTitle("YARRH v"+QString::number(VERSION_MAJOR)+"."+QString::number(VERSION_MINOR)+"."+QString::number(VERSION_REVISION)); this->aboutWindow->setVersion(VERSION_MAJOR,VERSION_MINOR,VERSION_REVISION); //setting up printer and its thread this->printerObj = new Printer(); QThread *qthread = new QThread(); //connecting ui to printer connect(printerObj, SIGNAL(write_to_console(QString)), ui->inConsole, SLOT(appendPlainText(QString)), Qt::QueuedConnection); connect(this->macrosWindow, SIGNAL(writeToPrinter(QString)), printerObj, SLOT(send_now(QString)),Qt::QueuedConnection); connect(ui->fanSpinBox, SIGNAL(valueChanged(int)), printerObj, SLOT(setFan(int)), Qt::QueuedConnection); ui->fanSpinBox->blockSignals(true); connect(this->printerObj, SIGNAL(SDFileList(QStringList)), this->sdCardWindow, SLOT(updateFileList(QStringList))); connect(this->printerObj, SIGNAL(uploadProgress(int,int)), this->sdCardWindow, SLOT(updateProgress(int,int))); this->sdCardWindow->setPrinter(this->printerObj); //connecting move btns connect(ui->homeX, SIGNAL(clicked()), printerObj, SLOT(homeX()), Qt::QueuedConnection); connect(ui->homeY, SIGNAL(clicked()), printerObj, SLOT(homeY()), Qt::QueuedConnection); connect(ui->homeAll, SIGNAL(clicked()), printerObj, SLOT(homeAll()), Qt::QueuedConnection); //connect monit temp checkbox connect(ui->graphGroupBox, SIGNAL(toggled(bool)), printerObj, SLOT(setMonitorTemperature(bool)),Qt::QueuedConnection); //connect printer to temp widget connect(printerObj, SIGNAL(currentTemp(double,double,double)), this, SLOT(drawTemp(double,double,double))); connect(printerObj, SIGNAL(progress(int,int)), this, SLOT(updateProgress(int,int))); connect(printerObj, SIGNAL(connected(bool)), this, SLOT(printerConnected(bool))); //setting ui temp from gcode connect(printerObj, SIGNAL(settingTemp1(double)), this, SLOT(setTemp1FromGcode(double))); connect(printerObj, SIGNAL(settingTemp3(double)), this, SLOT(setTemp3FromGcode(double))); //updating head position in ui connect(printerObj, SIGNAL(currentPosition(QVector3D)), this, SLOT(updateHeadPosition(QVector3D))); //print finished signal connect(printerObj, SIGNAL(printFinished(bool)), this, SLOT(printFinished(bool))); //connect calibration dialog to printer connect(calibrateDialog, SIGNAL(writeToPrinter(QString)), printerObj, SLOT(send_now(QString)),Qt::QueuedConnection); //connect z slider connect(ui->zSlider, SIGNAL(valueChanged(int)), this, SLOT(moveZ(int))); connect(ui->zSlider, SIGNAL(sliderMoved(int)), this, SLOT(updateZ(int))); //connect action load connect(ui->actionLoad, SIGNAL(triggered()), this, SLOT(loadFile())); printerObj->moveToThread(qthread); qthread->start(QThread::HighestPriority); this->portEnum = new QextSerialEnumerator(this); this->portEnum->setUpNotifications(); QList<QextPortInfo> ports = this->portEnum->getPorts(); //finding avalible ports foreach (QextPortInfo info, ports) { ui->portCombo->addItem(info.portName); }