void ScreenshotButton::onClick(wxCommandEvent& WXUNUSED(event)) { SetBitmapPressed(normal); //nechci aby na screenshotu vypadal zmacknuty Refresh(); wxBitmap screenshot; GetScreenshot(screenshot); //screenshot.ClearAlpha(); SetBitmapPressed(press); /**Ulozeni dp souboru**/ wxFileDialog fileDialog(this, _("Save a screenshot"), wxT(""), wxT("spektrograf.bmp"), wxT("Rastr (*.bmp) | *.bmp|Obrázek PNG (nedoporuèuje se) (*.png) | *.png|JPEG formát (*.jpg) | *.jpeg;*.jpg"), wxFD_SAVE); if(fileDialog.ShowModal() == wxID_OK) { wxFileName namePath(fileDialog.GetPath()); int fileType = wxBITMAP_TYPE_BMP; if( namePath.GetExt().CmpNoCase(wxT("jpeg")) == 0 ) fileType = wxBITMAP_TYPE_JPEG; if( namePath.GetExt().CmpNoCase(wxT("jpg")) == 0 ) fileType = wxBITMAP_TYPE_JPEG; if( namePath.GetExt().CmpNoCase(wxT("png")) == 0 ) fileType = wxBITMAP_TYPE_PNG; if( namePath.GetExt().CmpNoCase(wxT("bmp")) == 0 ) fileType = wxBITMAP_TYPE_BMP; wxImage tosave(screenshot.ConvertToImage()); if(tosave.HasAlpha()) tosave.ClearAlpha(); if(wxFileExists(fileDialog.GetPath())) { wxMessageDialog potvrd(this, _("Soubor existuje! Chcete jej pøepsat?"), _("Soubor existuje"), wxYES_NO|wxNO_DEFAULT|wxICON_WARNING); if(potvrd.ShowModal()==wxID_YES) tosave.SaveFile(fileDialog.GetPath(),(wxBitmapType)fileType); } else tosave.SaveFile(fileDialog.GetPath(),(wxBitmapType)fileType); } return; }
void ActionListViewItem::edit () { QWorkspace *ws = mainform->ws; aWindowsList *wl = mainform->wl; QString oclass = md->objClass( obj ); int objid = md->id( obj ); if ( wl->find( objid ) ) { wl->get( objid )->setFocus(); return; } if ( oclass == md_action ) { dEditAction * e = new dEditAction ( ws, 0, WDestructiveClose ); wl->insert( objid, e ); editor = e; QObject::connect( mainform, SIGNAL( tosave() ), editor, SLOT( updateMD() ) ); e->setData( this ); e->show(); e->moveToTopLeftCorner(); mainform->addTab(++mainform->lastTabId,e->name()); return; } }
w_sys_manage_operatorinformation::w_sys_manage_operatorinformation(QWidget *parent) : QDialog(parent), ui(new Ui_w_sys_manage_operatorinformation_Dialog) { ui->setupUi(this); //! tableview tablemodel=new lds_model_sqlrelationaltablemodel(this); tablemodel->setTable("cey_sys_operator"); tablemodel->setEditStrategy(QSqlTableModel::OnManualSubmit);tablemodel->setJoinMode(QSqlRelationalTableModel::LeftJoin); ui->tableView->setModel(tablemodel->fpmodel); tablemodel->save_set_header("vch_operID", tr("代码")); tablemodel->save_set_header("vch_operator", tr("姓名")); tablemodel->save_set_header("ch_flag", tr("是否生效")); QList<int> virtualheades=ui->tableView->rePecifyHeader(tablemodel->save_set_header_saver); ui->tableView->setItemDelegate(new lds_tableview_delegate_check(QVector<int>() << virtualheades[2] , ui->tableView)); tablemodel->select(); //! datawidget backheader::lds_com_setdatas(&w_sys_manage::MODEL_SYS_DISH_CONTROL, ui->comboBox_ch_pre_mode); mapper = new QDataWidgetMapper(this); mapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); mapper->setModel(tablemodel); mapper->setItemDelegate(new QSqlRelationalDelegate(mapper)); mapper->addMapping(ui->lineEdit_int_discount,tablemodel->fieldIndex("int_discount")); mapper->addMapping(ui->lineEdit_num_free,tablemodel->fieldIndex("num_free")); mapper->addMapping(ui->lineEdit_num_present,tablemodel->fieldIndex("num_present")); mapper->addMapping(ui->lineEdit_vch_operator,tablemodel->fieldIndex("vch_operator")); mapper->addMapping(ui->lineEdit_vch_operid,tablemodel->fieldIndex("vch_operid")); mapper->addMapping(ui->lineEdit_vch_password,tablemodel->fieldIndex("vch_password")); mapper->addMapping(ui->checkBox_ch_flag,tablemodel->fieldIndex("ch_flag"), "checked1");//将bool 转换为Y N mapper->addMapping(ui->checkBox_ch_free_flag,tablemodel->fieldIndex("ch_free_flag"), "checked1");//将bool 转换为Y N mapper->addMapping(ui->checkBox_ch_waiter,tablemodel->fieldIndex("ch_waiter"), "checked1");//将bool 转换为Y N mapper->addMapping(ui->comboBox_ch_pre_mode, tablemodel->fieldIndex("ch_pre_mode"), "comusrdata");//根据需要将index-1 //! toolbar ui->widget->setup(QStringList() << tr("新增") << tr("刷新") << tr("删除") << tr("保存") << tr("退出"), Qt::AlignRight); connect(ui->widget->index_widget(tr("新增")), SIGNAL(clicked()),this,SLOT(tonew())); connect(ui->widget->index_widget(tr("刷新")), SIGNAL(clicked()),this,SLOT(torefresh())); connect(ui->widget->index_widget(tr("删除")), SIGNAL(clicked()),this,SLOT(todel())); connect(ui->widget->index_widget(tr("保存")), SIGNAL(clicked()),this,SLOT(tosave())); connect(ui->widget->index_widget(tr("退出")), SIGNAL(clicked()),this,SLOT(toexit())); connect(ui->lineEdit_vch_operid,SIGNAL(textChanged(QString)),ui->lineEdit_vch_password, SLOT(setText(QString))); connect(ui->tableView,SIGNAL(selectchanged(int)),mapper,SLOT(setCurrentIndex(int))); //! ----------------------这儿采用下面的方法,来实现textChanged 对lineedit的实现---------------------begin connect(ui->lineEdit_vch_operid,SIGNAL(editingFinished()),ui->lineEdit_vch_password, SIGNAL(editingFinished())); connect(ui->lineEdit_vch_password,SIGNAL(editingFinished()),this,SLOT(mapper_setcur_tableviewcur())); connect(this,SIGNAL(lineedit_connect_change(QWidget *)), mapper->itemDelegate(),SIGNAL(commitData(QWidget*))); ui->lineEdit_vch_password->setEchoMode(QLineEdit::Password); //! ----------------------这儿采用下面的方法,来实现textChanged 对lineedit的实现---------------------end // ui->lineEdit_vch_password->setEnabled(false); mapper->toFirst(); }
status_t ThemeManager::SaveTheme(int32 id, bool excl) { FENTRY; status_t err; BString name, fname; BPath path; BDirectory dir; BDirectory tdir; BFile tfile; BMessage names; BString location; BMessage *theme; theme = ThemeAt(id); if (!theme) return EINVAL; err = find_directory(B_USER_SETTINGS_DIRECTORY, &path); if (err) return err; path.Append(Z_THEMES_FOLDER_NAME); err = dir.SetTo(path.Path()); if (err) return err; err = ThemeName(id, name); if (err) return err; fname = name; NormalizeThemeFolderName(fname); err = ThemeLocation(id, location); if (!err) { if (location.FindFirst("/boot/beos") >= 0) { PRINT(("trying to save theme '%s' to system dir!\n", name.String())); return B_PERMISSION_DENIED; } } path.Append(fname.String()); err = theme->ReplaceString(Z_THEME_LOCATION, path.Path()); if (err) err = theme->AddString(Z_THEME_LOCATION, path.Path()); if (dir.CreateDirectory(fname.String(), NULL) < B_OK) { if (excl) return B_FILE_EXISTS; } err = tdir.SetTo(&dir, fname.String()); if (err) return err; err = tdir.CreateFile(Z_THEME_FILE_NAME, &tfile); if (err) return err; BMessage tosave(*theme); err = tosave.RemoveName(Z_THEME_LOCATION); err = GetNames(names); err = DumpMessageToStream(&tosave, tfile, 0, &names); if (err) return err; return B_OK; }
void w_sys_manage_operatorinformation::toexit() { if(tablemodel->model_is_dirty()){ if(0==lds_messagebox::warning(this, tr("消息提示"),tr("有数据未保存,确认保存?")+tablemodel->dirty_err_string(), tr("确认"),tr("取消"))){ if(!tosave()){ return; } } } this->reject(); }