void GrepWidget::find() { output->clear(); QString text = textComboBox->currentText(); updateComboBox(textComboBox); QStringList files; currentDir = m_mainWindow->m_projectWidget->rootDir; files = m_mainWindow->m_projectWidget->GetScriptFiles(); if (!text.isEmpty()) files = findFiles(files, text); showFiles(files); /* currentDir = QDir(path); QStringList files; if (fileName.isEmpty()) fileName = "*"; files = currentDir.entryList(QStringList(fileName), QDir::Files | QDir::NoSymLinks); if (!text.isEmpty()) files = findFiles(files, text); showFiles(files); */ }
//! [3] void Window::find() { filesTable->setRowCount(0); QString fileName = fileComboBox->currentText(); QString text = textComboBox->currentText(); QString path = directoryComboBox->currentText(); //! [3] updateComboBox(fileComboBox); updateComboBox(textComboBox); updateComboBox(directoryComboBox); //! [4] currentDir = QDir(path); QStringList files; if (fileName.isEmpty()) fileName = "*"; files = currentDir.entryList(QStringList(fileName), QDir::Files | QDir::NoSymLinks); if (!text.isEmpty()) files = findFiles(files, text); showFiles(files); }
//! [3] void Window::find() { filesTable->setRowCount(0); QString fileName = fileComboBox->currentText(); QString text = textComboBox->currentText(); QString path = QDir::cleanPath(directoryComboBox->currentText()); currentDir = QDir(path); //! [3] updateComboBox(fileComboBox); updateComboBox(textComboBox); updateComboBox(directoryComboBox); //! [4] QStringList filter; if (!fileName.isEmpty()) filter << fileName; QDirIterator it(path, filter, QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); QStringList files; while (it.hasNext()) files << it.next(); if (!text.isEmpty()) files = findFiles(files, text); files.sort(); showFiles(files); }
//------------------------------------------------------------------------------------ void MainWindow::addFilesFinished() { actExtract->setEnabled(mOfsFile.valid()); actClose->setEnabled(mOfsFile.valid()); actDefrag->setEnabled(mOfsFile.valid()); mProgressBar->setVisible(false); mProgressLabel->setVisible(false); mProgressTimer->stop(); showFiles(); }
void QtSpellCheckerWindow::setFromSettings() { ui_.spellChecker->setChecked(settings_->getSetting(SettingConstants::SPELL_CHECKER)); ui_.pathContent->setText(P2QSTRING(settings_->getSetting(SettingConstants::DICT_PATH))); ui_.currentLanguageValue->setText(P2QSTRING(settings_->getSetting(SettingConstants::DICT_FILE))); std::string currentPath = settings_->getSetting(SettingConstants::DICT_PATH); QString filename = "*.dic"; QDir dictDirectory = QDir(P2QSTRING(currentPath)); QStringList files = dictDirectory.entryList(QStringList(filename), QDir::Files); showFiles(files); setEnabled(settings_->getSetting(SettingConstants::SPELL_CHECKER)); }
void FileBrowser::createConnections() { connect(renameFileAction, SIGNAL(triggered()), this, SLOT(renameFile())); connect(removeFileAction, SIGNAL(triggered()), this, SLOT(removeFile())); connect(fileModel, SIGNAL(fileRenamed(QString, QString, QString)), this, SLOT(fileRenameDone())); auto stopEditingSlot = [&]() { fileModel->setReadOnly(true); }; connect(fileView, &QTreeView::doubleClicked, stopEditingSlot); connect(openFileAction, SIGNAL(triggered()), this, SLOT(openFile())); connect(zipFilesAction, SIGNAL(triggered()), this, SLOT(zipFiles())); connect(dirView, SIGNAL(clicked(QModelIndex)), this, SLOT(showFiles(QModelIndex))); }
EditFile::EditFile(QWidget *p, const char *name) : QFrame(p, name) { bDirMode = false; lay = new QHBoxLayout(this); edtFile = new QLineEdit(this); lay->addWidget(edtFile); lay->addSpacing(3); QPushButton *btnOpen = new QPushButton(this); lay->addWidget(btnOpen); btnOpen->setPixmap(Pict("fileopen")); connect(btnOpen, SIGNAL(clicked()), this, SLOT(showFiles())); connect(edtFile, SIGNAL(textChanged(const QString&)), this, SLOT(editTextChanged(const QString&))); }
void QMathMLFileViewer::fileFind() { filesTable->setRowCount(0); QString fileName = fileComboBox->currentText(); QString path = directoryComboBox->currentText(); updateComboBox(fileComboBox); updateComboBox(directoryComboBox); m_currentDir = QDir(path); if( fileName.isEmpty() ) fileName = DEFAULT_MASK; //QApplication::setOverrideCursor( Qt::WaitCursor ); QStringList files; if( isRecursive() ) { QProgressDialog progress("Searching files...", "Abort Search", 0, 100, this); progress.setWindowModality(Qt::WindowModal); progress.setMinimumDuration( 500 ); progress.setValue( 0 ); fileFind( files, m_currentDir, QStringList(fileName), &progress ); //progress.setValue( 100 + files.size() ); progress.setValue( progress.maximum() ); } else { //QStringList newFiles = m_currentDir.entryList(QStringList(fileName), QDir::Files | QDir::NoSymLinks); //for( QStringList::const_iterator item = newFiles.constBegin(); item != newFiles.constEnd(); item++ ) // files.append(m_currentDir.absoluteFilePath(*item)); files = m_currentDir.entryList(QStringList(fileName), QDir::Files | QDir::NoSymLinks); } if(files.size() > 0) { filesTable->show(); showFiles(files); filesTable->resizeRowsToContents(); filesTable->resizeColumnsToContents(); foundMessage->setText(QString(tr("%1 file(s) shown of %2 found").arg(filesTable->rowCount()).arg(files.size()))); emit hasFound( true ); } else { filesTable->hide(); foundMessage->setText(QString(tr("No files found to match %1")).arg(fileName)); emit hasFound( false ); } //QApplication::restoreOverrideCursor(); }
VerticalMenuWidget::VerticalMenuWidget(QWidget *parent) : AbstractMenuWidget(parent), ui(new Ui::VerticalMenuWidget) { ui->setupUi(this); connect(ui->btnAbout,SIGNAL(clicked()),this,SIGNAL(showAbout())); connect(ui->btnExit,SIGNAL(clicked()),this,SIGNAL(exitClicked())); connect(ui->btnFiles,SIGNAL(clicked()),this,SIGNAL(showFiles())); connect(ui->btnArtists,SIGNAL(clicked()),this,SIGNAL(showArtists())); connect(ui->btnAlbums,SIGNAL(clicked()),this,SIGNAL(showAlbums())); connect(ui->btnConnect,SIGNAL(clicked()),this,SIGNAL(connectClicked())); connect(ui->btnCurrentSong,SIGNAL(clicked()),this,SIGNAL(showCurrentSong())); connect(ui->btnSettings,SIGNAL(clicked()),this,SIGNAL(showSettings())); connect(ui->btnPlaylists,SIGNAL(clicked()),this,SIGNAL(showPlaylist())); }
void FindFileDialog::findFiles() { QRegExp filePattern(fileNameComboBox->currentText() + "*"); filePattern.setPatternSyntax(QRegExp::Wildcard); QDir directory(directoryComboBox->currentText()); QStringList allFiles = directory.entryList(QDir::Files | QDir::NoSymLinks); QStringList matchingFiles; foreach (QString file, allFiles) { if (filePattern.exactMatch(file)) matchingFiles << file; } showFiles(matchingFiles); }
void AttributesView::showInfo(Torrent *t) { mutex_info.lock(); torrent = t; switch (page_selected) { case 1: showInformation(); break; case 2: showPeers(); break; case 3: showFiles(); break; } mutex_info.unlock(); }
void QtSpellCheckerWindow::handlePathButton() { std::string currentPath = settings_->getSetting(SettingConstants::DICT_PATH); QString dirpath = QFileDialog::getExistingDirectory(this, tr("Dictionary Path"), P2QSTRING(currentPath)); if (dirpath != P2QSTRING(currentPath)) { ui_.languageView->clear(); settings_->storeSetting(SettingConstants::DICT_FILE, ""); ui_.currentLanguageValue->setText(" "); } if (!dirpath.isEmpty()) { if (!dirpath.endsWith("/")) { dirpath.append("/"); } settings_->storeSetting(SettingConstants::DICT_PATH, Q2PSTRING(dirpath)); QDir dictDirectory = QDir(dirpath); ui_.pathContent->setText(dirpath); QString filename = "*.dic"; QStringList files = dictDirectory.entryList(QStringList(filename), QDir::Files); showFiles(files); } }
//------------------------------------------------------------------------------------ void MainWindow::dblClick(int row, int column) { if(mOfsFile.valid()) { if(mCurrentFiles[row].flags & OFS::OFS_DIR) { if(mCurrentFiles[row].name == "..") { mCurrentDir.erase(mCurrentDir.length() - 1, 1); int pos = mCurrentDir.find_last_of("/"); mCurrentDir.erase(pos + 1, mCurrentDir.length() - pos - 1); } else { mCurrentDir = mCurrentDir + mCurrentFiles[row].name + "/"; } showFiles(); } } }
//--------------------------------------- void FRDialog::find() { QString s = ""; //holds list of errors bool er = false; if (ui->LEFind -> text().isEmpty()) { s.append(tr("- Please enter a find text.\n")); er = true; } if (er) { QMessageBox::critical(this, tr("Find error"), s); } else { ui->tableFiles->setRowCount(0); QString fileName = ""; QString text = ui->LEFind->text(); QString correctName; if (ui->cBBook->currentIndex() == 0) correctName = ""; if (ui->cBBook->currentIndex() != 0) { if (ui->cBChapter->currentIndex() == 0) { QString namebook = bookfiles.at(ui->cBBook->currentIndex()); correctName = "book_" + namebook; } else { QString namebook = bookfiles.at(ui->cBBook->currentIndex()); QString namechapter = ui->cBChapter->currentText(); namechapter .remove(tr("Chapter ")); namechapter = incstr(namechapter,GL_LENGT_ITEM_STRING, "_"); correctName = "book_"+namebook+"_chapter_"+namechapter; } } currentDir = Config::configuration()->CurPrjDir();/*QDir(correctName);*/ QStringList files1; if (fileName.isEmpty()) fileName = "*"; files1 = currentDir.entryList(QStringList(fileName), QDir::Files | QDir::NoSymLinks); QStringList files; if (!correctName.isEmpty()) { for (int i = 0; i < files1.size(); i++) { if(files1.at(i).indexOf(correctName) != -1) { files << files1.at(i); } } } else { files = files1; } if (!text.isEmpty()) files = findFiles(files, text); QStringList bookList = files; QStringList chapterList = files; updateItemforTable(bookList, chapterList); // qDebug() << "booklist = " << bookList // << " chapterlist = " << chapterList // << " bookfiles = " << bookfiles; showFiles(bookList, chapterList); } }
const char *FileBrowsePanel_Main(SDL_Surface *screen) { fprintf(stderr, "FileBrowsePanel_Main: Currently unsupported.\n"); return NULL; @OLD main function stuff // Create font font = Static_getFont("fonts/ariblk.ttf", 20); // Create a fileInfo type array containing content of current folder prevClicked = 0xFFFFFFFF; firstScreenIndex = 0; selIndex = 0xFFFFFFFF; // initialize screen context Screen_init(&sc, screen, 0); Screen_setBackground(&sc, "img/green-design-background.jpg"); sc.drag_on = false; tblist = NULL; getCurrentFolderContent(&tblist, &tblistCount, sc.screen, font, FBP_FILE_INFO_BGCOLOR_UNSEL, 0x000000, fileTypes, &nameHeight, textblock_filename_clicked); //~ u32 i=0; for (; i < tblistCount; i++) //~ fprintf(stderr, "widget[%u/%u] id=%u\t%s\n", i, tblistCount, //~ tblist[i].text_block.widget.id, tblist[i].text_block.text); u32 i; nameHeight += 5; char current_dir[PATH_MAX_SIZE]; getcwd(current_dir, PATH_MAX_SIZE); // Update actual folder path //~ TextBlock *tb_currentFolder = malloc(sizeof(TextBlock)); //~ tb_currentFolder->text = (char*) malloc(PATH_MAX_SIZE*sizeof(char)); //~ getcwd(tb_currentFolder->text, PATH_MAX_SIZE-1); //~ TextBlock_setFont(tb_currentFolder, font); //~ TextBlock_setBackgroundColor(tb_currentFolder, 0xD9FFAD); //~ TextBlock_setForegroundColor(tb_currentFolder, 0x000000); //~ TextBlock_refresh(tb_currentFolder); //~ Widget *tb_currentFolder_widget = &(tb_currentFolder->widget); //~ tb_currentFolder_widget->id = 4; //~ tb_currentFolder_widget->draggable = true; //~ tb_currentFolder_widget->mevent = true; border_rect = malloc(sizeof(Rectangle)); Rectangle *border_rect2 = malloc(sizeof(Rectangle)); Rectangle_new(border_rect, sc.screen, 0xE2F3D3); Rectangle_new(border_rect2, sc.screen, 0x2EAE00); border_rectWidget = &(border_rect->widget); border_rect2Widget = &(border_rect2->widget); u16 height = (W_SCREEN_HEIGHT<<1)/3; height -= (height-UPPER_RESERV)%nameHeight; border_rectWidget->pos.y = 100; border_rectWidget->pos.w = 850; border_rectWidget->pos.x = 100; border_rectWidget->pos.h = height; border_rect2Widget->pos.y = border_rectWidget->pos.y - 5; border_rect2Widget->pos.x = border_rectWidget->pos.x - 5; border_rect2Widget->pos.w = border_rectWidget->pos.w + 10; border_rect2Widget->pos.h = border_rectWidget->pos.h + 10; Rectangle_refresh(border_rect); Rectangle_refresh(border_rect2); // Preview view rectangle p_x = border_rect2Widget->maxx + 10; p_y = border_rect2Widget->pos.y + 10; p_w = W_SCREEN_WIDTH - border_rect2Widget->pos.w - border_rect2Widget->pos.x - 20; p_h = border_rect2Widget->pos.h - 20; Button *butOk = malloc(sizeof(Button)); Button *butAnuluj = malloc(sizeof(Button)); Button_new(butOk, sc.screen, "OK", true); Widget *butOk_widget = &(butOk->widget); butOk_widget->click_handler = button_ok_clicked; Button_applyDefaultStyle(butOk, 879, 874, font, 50, 5); Button_setFixedWidth(butOk, true); Button_new(butAnuluj, sc.screen, "Anuluj", true); Widget *butAnuluj_widget = &(butAnuluj->widget); butAnuluj_widget->click_handler = button_anuluj_clicked; Button_applyDefaultStyle(butAnuluj, 1061, 874, font, 33, 5); Button_setFixedWidth(butAnuluj, true); b8 got_event=false; sel = false; char *ret_path = NULL; preview = malloc(sizeof(Image)); Image_new(preview, NULL, 0, 0); // invisible preview image //~ border_rectWidget->pos.y = 100; //~ border_rectWidget->pos.w = W_SCREEN_WIDTH-200; //~ border_rect2Widget->pos.y = border_rectWidget->pos.y - 5; //~ border_rect2Widget->pos.w = border_rectWidget->pos.w + 10; //~ border_rectWidget->pos.x = (W_SCREEN_WIDTH-border_rectWidget->pos.w)>>1; //~ border_rect2Widget->pos.x = border_rectWidget->pos.x - 5; while (! sc.has_exited) { if (sc.need_reload) { sc.need_reload = false; SDL_BlitSurface(sc.background->widget.surf, NULL, sc.screen, NULL); if (preview->widget.visible) { Widget_draw(&(preview->widget), &sc, false); } u16 height = (W_SCREEN_HEIGHT<<1)/3; height -= (height-UPPER_RESERV)%nameHeight; border_rectWidget->pos.h = height; border_rect2Widget->pos.h = border_rectWidget->pos.h + 10; Rectangle_refresh(border_rect); Rectangle_refresh(border_rect2); Widget_draw(border_rect2Widget, &sc, false); Widget_draw(border_rectWidget, &sc, false); Widget_draw(butOk_widget, &sc, false); showFiles(); Widget_draw(butOk_widget, &sc, false); Widget_draw(butAnuluj_widget, &sc, true); } while (SDL_WaitEvent(sc.pevent)) { got_event = true; switch (sc.event.type) { case SDL_KEYDOWN: // only for testing purpouses if (sc.event.key.keysym.sym == SDLK_ESCAPE) sc.has_exited = true; else { if (sc.event.key.keysym.sym == SDLK_F2) { fprintf(stderr, "Debug list:\n"); for (i = 0; i < tblistCount; i++) { fprintf(stderr, "TextBlock [%u/%u] id=%u text=%s\n", i, tblistCount, tblist[i].text_block.widget.id, tblist[i].text_block.text); } } } break; case SDL_QUIT: sc.has_exited = true; break; case SDL_MOUSEBUTTONDOWN: if (sc.event.button.button == 4) { // wheel up if (firstScreenIndex > 0) { firstScreenIndex--; sc.need_reload = true; } break; } else { if (sc.event.button.button == 5) { // wheel down if (lastScreenIndex < tblistCount-1) { firstScreenIndex++; sc.need_reload = true; } break; } } default: Widget_mevent(butOk_widget, &sc);// if (sc.event_handled) break; Widget_mevent(butAnuluj_widget, &sc); //if (sc.event_handled) break; if (sc.event.type != SDL_MOUSEMOTION) { for (i = firstScreenIndex; i <= lastScreenIndex; i++) { Widget_mevent(&(tblist[i].text_block.widget), &sc); //if (sc.event_handled) break; } } break; } if (got_event) break; } } to_end: if ((sel) || (selIndex != 0xFFFFFFFF)) { ret_path = realpath(tblist[selIndex].text_block.text, ret_path); if (! ret_path) { fprintf(stderr, "FileBrowsePanel_Main:FileBrowsePanel > Failed to realpath on selected path %s\n", tblist[selIndex].text_block.text); } } // Remember to copy text of selected file for (i = 0; i < tblistCount; i++) { fprintf(stderr, "Delete TextBlock %u, %s\n", i, tblist[i].text_block.text); delete(&(tblist[i].text_block)); } free(tblist); delete(&sc); delete(butOk); delete(butAnuluj); delete(border_rect); delete(border_rect2); free(butOk); free(butAnuluj); free(border_rect); free(border_rect2); free(preview); if (chdir(current_dir)) { // go back to previous directory fprintf(stderr, "FileBrowsePanel_Main:FileBrowsePanel > Failed to go back to previous directory %s\n", current_dir); } fprintf(stderr, "FileBrowsePanel: Exiting\n"); return ret_path; **/ }