void fileSelectCb(Widget w, XEvent *event, String *params, Cardinal *num_params) { FileWindowRec *fw; int i; if ((fw = findFileWidget(w, &i))) fileSelect(fw, i); }
void VSCCameraAdd::SetupConnections() { connect( this->ui.radioButtonFile, SIGNAL( clicked() ), this, SLOT(radioButtonClicked())); connect( this->ui.radioButtonRtsp, SIGNAL( clicked() ), this, SLOT(radioButtonClicked())); connect( this->ui.radioButtonOnvif, SIGNAL( clicked() ), this, SLOT(radioButtonClicked())); connect( this->ui.pushButtonApply, SIGNAL( clicked() ), this, SLOT(applyConfig())); connect( this->ui.pushButtonFile, SIGNAL( clicked() ), this, SLOT(fileSelect())); }
void NewEditDLL::filesButton( WWindow * ) //--------------------------------------- { const char * result; if( _exeButton->checked() ) { WFileDialog fileSelect( this, EXEFilter ); result = fileSelect.getOpenFileName( NULL, "New Browser Editor EXE", WFOpenNew ); if( result && *result ) { _dllEdit->setText( result ); } } else { WFileDialog fileSelect( this, DLLFilter ); result = fileSelect.getOpenFileName( NULL, "New Browser Editor DLL", WFOpenNew ); if( result && *result ) { _dllEdit->setText( result ); } } }
void NewDBRFile::filesButton( WWindow * ) //--------------------------------------- { WFileDialog fileSelect( this, _filter ); const char * result; result = fileSelect.getOpenFileName( NULL, "New Browser Database File", WFOpenNew ); if( result && *result ) { _fileEdit->setText( result ); } }
ModuleConfigDialog::ModuleConfigDialog(QWidget *parent) : QDialog(parent), m_ui(new Ui::ModuleConfigDialog) { m_ui->setupUi(this); connect(m_ui->pushButton_ok, SIGNAL(clicked()), this, SLOT(bsave())); connect(m_ui->pushButton_cancel, SIGNAL(clicked()), this, SLOT(close())); connect(m_ui->toolButton_file, SIGNAL(clicked()), this, SLOT(fileSelect())); connect(m_ui->comboBox_type, SIGNAL(currentIndexChanged(int)), this, SLOT(moduleTypeChanged(int))); connect(m_ui->checkBox_useParentSettings, SIGNAL(stateChanged(int)), this, SLOT(useParentsSettingsChanged(int))); m_ui->comboBox_type->insertItems(0, Module::moduleTypeNames()); QStringList defaultModules; defaultModules << tr("Not a Default Module") << tr("Default Bible") << tr("Default Strong Dictionary") << tr("Default Grammar Dictionary") << tr("Default Dictionary") << tr("Default RMAC Module"); m_ui->comboBox_defaultModule->insertItems(0, defaultModules); QStringList contentTypes; contentTypes << tr("Unkown") << tr("Bible") << tr("Bible OT") << tr("Bible NT") << tr("Strongs") << tr("Strongs Greek") << tr("Strongs Hebrew") << tr("RMAC") << tr("Word Dictionary") << tr("Dictionary") << tr("Gram Dictionary"); m_ui->comboBox_contentType->insertItems(0, contentTypes); m_encodings << "Default" << "Apple Roman" << "Big5" << "Big5-HKSCS" << "EUC-JP" << "EUC-KR" << "GB18030-0" << "IBM 850" << "IBM 866" << "IBM 874" << "ISO 2022-JP" << "ISO 8859-1" << "ISO 8859-2" << "ISO 8859-3" << "ISO 8859-4" << "ISO 8859-5" << "ISO 8859-6" << "ISO 8859-7" << "ISO 8859-8" << "ISO 8859-9" << "ISO 8859-10" << "ISO 8859-13" << "ISO 8859-14" << "ISO 8859-15" << "ISO 8859-16" << "Iscii-Bng" << "Dev" << "Gjr" << "Knd" << "Mlm" << "Ori" << "Pnj" << "Tlg" << "Tml" << "JIS X 0201" << "JIS X 0208" << "KOI8-R" << "KOI8-U" << "MuleLao-1" << "ROMAN8" << "Shift-JIS" << "TIS-620" << "TSCII" << "UTF-8" << "UTF-16" << "UTF-16BE" << "UTF-16LE" << "UTF-32" << "UTF-32BE" << "UTF-32LE" << "Windows-1250" << "Windows-1251" << "Windows-1252" << "Windows-1253" << "Windows-1254" << "Windows-1255" << "Windows-1256" << "Windows-1257" << "Windows-1258" << "WINSAMI2"; m_ui->comboBox_encoding->clear(); m_ui->comboBox_encoding->insertItems(0, m_encodings); }
void filePopup(Widget w, XEvent *event, String *params, Cardinal *num_params) { Window root, child, win; Widget button; FileWindowRec *fw; int x, y, x_win, y_win; unsigned int mask; int item; fw = findFileWidgetByForm(w); if (!fw || fw->scrolled == None) return; win = XtWindow(fw->icon_box); XQueryPointer(dpy, win, &root, &child, &x, &y, &x_win, &y_win, &mask); if (child != None) { button = XtWindowToWidget(dpy, child); item = findFileItem(fw, button); XtVaSetValues(fw->form, XmNuserData, (XtPointer) item, NULL); fileSelect(fw, item); if (S_ISDIR(fw->files[item]->stats.st_mode)) { XmMenuPosition(fw->dirPopup, (XButtonPressedEvent *) event); XtManageChild(fw->dirPopup); } else if (fw->files[item]->stats.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { XmMenuPosition(fw->execPopup, (XButtonPressedEvent *) event); XtManageChild(fw->execPopup); } else { XmMenuPosition(fw->filePopup, (XButtonPressedEvent *) event); XtManageChild(fw->filePopup); } } else { XmMenuPosition(fw->formPopup, (XButtonPressedEvent *) event); XtManageChild(fw->formPopup); } }
void dirPopup(Widget w, XEvent *event, String *params, Cardinal *num_params) { int i; FileWindowRec *fw; Display *dpy; Window root, child; int x, y, x_win, y_win; unsigned int mask; i = findWidget(w, &fw); if (!fw) { /* error("Internal error:", "widget not found in dirPopup"); */ return; } popup_fw = fw; fileSelect(w, event, params, num_params); if (!strcmp(fw->files[i]->name, ".") || !strcmp(fw->files[i]->name, "..")) { grayOut(dir_popup_items[2]); grayOut(dir_popup_items[3]); grayOut(dir_popup_items[6]); } else { fillIn(dir_popup_items[2]); fillIn(dir_popup_items[3]); fillIn(dir_popup_items[6]); } dpy = XtDisplay(toplevel); XQueryPointer(dpy, DefaultRootWindow(dpy), &root, &child, &x, &y, &x_win, &y_win, &mask); XtVaSetValues(dir_popup_widget, XtNx, (XtArgVal) x, XtNy, (XtArgVal) y, NULL); XtPopupSpringLoaded(dir_popup_widget); }
int main() { llist entries; int status; char *form; status = read_cgi_input(&entries); form = cgi_val(entries, "submitSearch"); if (strcmp(form, "View") == 0) view(entries); else if (strcmp(form, "FileSelect") == 0) fileSelect(entries); else { html_header(); html_begin_body_options("Query Results", "bgcolor=#ffffff"); printf("<h1>Status = %d</h1>\n",status); h1("Query results"); print_entries(entries); html_end(); } list_clear(&entries); return 0; }
void DWindowUI::AddOptionUI(QBoxLayout *top) { QVBoxLayout *option = new QVBoxLayout(); option->setSpacing(7); //add close button QHBoxLayout *btlayout = new QHBoxLayout(); QPushButton *closeBt = new QPushButton(); QString style = "QPushButton{" "background:url(:/ui/images/window_close_normal.png);" "border:0px;" "}" "QPushButton:hover{" "background:url(:/ui/images/window_close_hover.png);" "border:0px;" "}" "QPushButton:pressed{" "background:url(:/ui/images/window_close_press.png);" "border:0px;" "}"; closeBt->setStyleSheet(style); QPixmap pixmap (":/ui/images/window_close_normal.png"); closeBt->setFixedSize(pixmap.size()); connect(closeBt, SIGNAL(clicked()), this, SLOT(close())); btlayout->setMargin(3); btlayout->addWidget(closeBt); btlayout->setAlignment(closeBt, Qt::AlignRight); //Add Logo QHBoxLayout *logolayout = new QHBoxLayout(); QLabel *logolabel = new QLabel(); logolabel->setPixmap(QPixmap(":/ui/images/logo.png")); logolayout->addSpacing(50); logolayout->addWidget(logolabel); QLabel *versionlabel = new QLabel("<p style='color:white; font-size:10px;'>0.99</p>"); logolayout->addWidget(versionlabel); logolayout->setAlignment(versionlabel, Qt::AlignBottom); logolayout->addStretch(); option->addLayout(btlayout); option->addLayout(logolayout); //Add Hint QLabel *easylabel = new QLabel(tr("<p style='color:white; font-size:14px;'>Easy to use without redundancy</p>")); easylabel->setFixedWidth(labelMaxWidth); option->addWidget(easylabel); //Add Description QString descriptions = tr("<a style='color:#a7a7a7; font-size:11px;'>Welcome to Deepin Boot Maker. After setting a few options, you'll be able to create a Deepin OS Startup Disk, which supports both BIOS and </a>" "<a style='color:#ebab4c; font-size:11px;'>UEFI</a><a style='color:#a7a7a7; font-size:11px;'> boot.</a>"); QLabel *descriptionslabel = new QLabel(descriptions); descriptionslabel->setFixedWidth(labelMaxWidth); descriptionslabel->setWordWrap(true); option->addWidget(descriptionslabel); //Add select option layout selectLayout_ = new QVBoxLayout(); //Add select iso hint QLabel *selectISO = new QLabel(tr("<p style='color:white; font-size:12px;'>Select the ISO File:</p>")); selectISO->setFixedWidth(labelMaxWidth); selectLayout_->addWidget(selectISO); isoFile_ = new DFileChooseInput(); isoFile_->setFixedHeight(22); isoFile_->setFixedWidth(210); connect(isoFile_, SIGNAL(filedSelected(QString)), this, SLOT(fileSelect(QString))); selectLayout_->addWidget(isoFile_); //Add select usb driver hint QLabel *selectUSB = new QLabel(tr("<p style='color:white; font-size:12px;'>Select the USB Flash Drive:</p>")); selectISO->setFixedWidth(labelMaxWidth); selectLayout_->addWidget(selectUSB); usbDriver_ = new DComboBox(); usbDriver_->setFixedWidth(210); selectLayout_->addWidget(usbDriver_); formatDisk_ = new DCheckBox(tr("<p style='color:white; font-size:12px;'>Format USB flash disk before installation to improve the making success rate.</p>")); formatDisk_->setFixedWidth(labelMaxWidth); connect(formatDisk_, SIGNAL(clicked()), this, SLOT(confirmFormat())); selectLayout_->addWidget(formatDisk_); bisoMode_ = new DCheckBox(tr("<p style='color:white; font-size:12px;'>Support BIOS. Unselect here.</p>")); bisoMode_->setFixedWidth(labelMaxWidth); selectLayout_->addWidget(bisoMode_); option->addStretch(); option->addLayout(selectLayout_); option->addSpacing(10); actionLayout_ = new QHBoxLayout(); startBt_ = new DPushButton(tr("Start")); connect(startBt_, SIGNAL(clicked()), this, SLOT(start())); actionLayout_->addSpacing(50); actionLayout_->addWidget(startBt_); actionLayout_->addStretch(); actionLayout_->setAlignment(startBt_, Qt::AlignCenter); option->addStretch(); option->addLayout(actionLayout_); option->addStretch(); option->addStretch(); top->addLayout(option); }
// ========================***************************============================== void fileSelect(const char *startdir, char *out_dir, char *out_fname, netbuf *buf, bool allow_cancel, bool allow_up) { bool select = false; static int size_list = 18; int num_files = 0; int sel_file = 0; int first_file = 0; // get list of files in current dir if (buf) ftpGetFileList("/", buf, num_files); else fileGetFileList(startdir, num_files); filePrintFileList(startdir, first_file, sel_file, num_files, allow_cancel); while (!select) { // get_event uint32 keys = keysCurrent(); // handle_event if (keys & KEY_DOWN) { if (sel_file < num_files-1) { sel_file++; if (sel_file >= first_file + size_list - 1) first_file = sel_file - (size_list - 1); filePrintFileList(startdir, first_file, sel_file, num_files, allow_cancel); } else { // wrap around to top of list sel_file = 0; first_file = 0; filePrintFileList(startdir, first_file, sel_file, num_files, allow_cancel); } } else if (keys & KEY_UP) { if (sel_file > 0) { sel_file--; if (sel_file < first_file) first_file = sel_file; filePrintFileList(startdir, first_file, sel_file, num_files, allow_cancel); } else { // wrap around to bottom of list sel_file = num_files - 1; first_file = sel_file - (size_list - 1); filePrintFileList(startdir, first_file, sel_file, num_files, allow_cancel); } } else if (keys & KEY_A) { // get selected file name char *buf2 = (char*)data; char fname[128]; for (int i = 0; i < sel_file; i++) { buf2 = strchr(buf2, '\n') + 1; } char c; sscanf(buf2, "%c%[^\n]", &c, fname); // gets 'd' or 'f' - dir or file // special cases if (stricmp(fname, ".") == 0) // don't do anything continue; if (stricmp(fname, "..") == 0) { // return to parent function (usually results in "back to higher level") while (keysCurrent() & (KEY_A | KEY_B)); if (!allow_up) continue; if (buf) FtpChdir("..", buf); return; } // get selected file properties char fullname[512]; sprintf(fullname, "%s%s", startdir, fname); struct stat statbuf; stat(fullname, &statbuf); if (c == 'd') { char fullpath[512]; sprintf(fullpath, "%s%s/", startdir, fname); if (buf) FtpChdir(fname, buf); fileSelect(fullpath, out_dir, out_fname, buf, allow_cancel, true); if ((keysCurrent() & (KEY_L | KEY_R)) && allow_cancel) return; while (keysCurrent() & (KEY_A | KEY_B)); // did we select a file? if so, keep returning to parent calling function if (strlen(out_fname)) return; // we did not select anything, so regenerate the old list num_files = 0; if (buf) ftpGetFileList("/", buf, num_files); else fileGetFileList(startdir, num_files); filePrintFileList(startdir, first_file, sel_file, num_files, allow_cancel); continue; } else { sprintf(out_dir, "%s", startdir); sprintf(out_fname, "%s", fname); while (keysCurrent() & (KEY_A | KEY_B)); return; } } else if (keys & KEY_B) { if (!allow_up) continue; if (buf) FtpChdir("..", buf); return; } else if (keys & (KEY_L | KEY_R)) { if (allow_cancel) { sprintf(out_dir, "%s", startdir); out_fname[0] = 0; return; } } for (int i = 0; i < 5; i++) swiWaitForVBlank(); } }
void EdModule::addButton( WWindow * ) //----------------------------------- { int i; int fileIdx; WFileNameList files; WFileDialog fileSelect( this, EdModuleFilter ); bool result; WFileName * file; bool found; result = fileSelect.getOpenFileName( files, NULL, "Select Module File(s)", WFOpenNew ); if( result ) { for( fileIdx = 0; fileIdx < files.count(); fileIdx += 1 ) { file = new WFileName( files.cStringAt( fileIdx ) ); if( *( file->ext() ) == '\0' ) { file->setExt("mbr"); } file->absoluteTo(); file->toLower(); found = false; if( !file->attribs() ) { errMessage( "Module %s%s does not exist", file->fName(), file->ext() ); found = true; } for( i = 0; i < _moduleBox->count() && !found; i += 1 ) { WString * str = (*_moduleBox)[ i ]->_str; if( *str == *file ) { errMessage( "Module %s%s already in project", file->fName(), file->ext() ); found = true; } } for( int i = 0; i < _removedModuleItems->entries() && !found; i++ ) { WString * str = (*_removedModuleItems)[ i ]->_str; if( *str == *file ) { ModuleItem * item = _removedModuleItems->removeAt( i ) ; item->_enabled = true; _moduleBox->insert( item ); found = true; } } if( !found ) { ModuleItem * item = new ModuleItem( file, true ); _moduleBox->insert( item ); } } /* for( i < files.count() ) */ } /* if( result ) */ _moduleBox->reset(); }