// ------------------------------------------------------------- TRasterMapsDialog::TRasterMapsDialog(IMapAdapterInterfaces MapInterfaces_, QString Organization_, QString Application_, QWidget *Parent_) : QDialog(Parent_), PI(acos(-1.0)), m_Organization(Organization_), m_Application(Application_), m_Mode(Consts::ListMode), m_KeyControlPressed(false) { setWindowTitle(QNetMapTranslator::tr("Raster map list" /* Russian: Список растровых карт */)); QPalette palette/*(palette())*/; palette.setColor(backgroundRole(), Qt::white); setPalette(palette); setAutoFillBackground(true); setMinimumSize(800, 600); // карта w_MapWidget = new TMapWidget(MapInterfaces_, "", 12, QPointF(0,0), Organization_, Application_); // Лайаут основной setLayout(&m_MainVerticalLayout); m_MainVerticalLayout.setSpacing(8); m_MainVerticalLayout.setMargin(8); // Лайаут для размещения элементов верхней строки с подсказкой QHBoxLayout *TopLayout = new QHBoxLayout; m_MainVerticalLayout.addLayout(TopLayout); TopLayout->addWidget(&m_TextHint); hint(QNetMapTranslator::tr("Select the map or action" /* Russian: Выберите карту или действие */)); TopLayout->addStretch(); // Лайаут для списка, кнопок и карты QHBoxLayout *MiddleLayout = new QHBoxLayout; m_MainVerticalLayout.addLayout(MiddleLayout); // Лайаут для списка и кнопок QVBoxLayout *ListLayout = new QVBoxLayout; // Лайаут для карты QVBoxLayout *MapLayout = new QVBoxLayout; // Путь к карте MapLayout->addWidget(&m_MapPath); // Рамка для виджета карты QFrame *MapWidgetFrame = new QFrame; MapWidgetFrame->setFrameStyle(QFrame::Box | QFrame::Plain); QHBoxLayout *MapWidgetFrameLayout = new QHBoxLayout(MapWidgetFrame); MapWidgetFrameLayout->setMargin(0); MapWidgetFrameLayout->addWidget(w_MapWidget); MapLayout->addWidget(MapWidgetFrame); // лайоут для списка точек привязки w_MapAnchors = new QVBoxLayout; w_MapAnchors->setMargin(0); MapLayout->addLayout(w_MapAnchors); // Список карт QStringList ListMaps; IMapAdapterInterfaces RasterMapInterfaces = w_MapWidget->rasterMapInterfaces(); foreach(IMapAdapterInterface* Interface, RasterMapInterfaces) { ListMaps << Interface->pluginName(); } m_Model.setStringList(ListMaps); m_MapsListView.setModel(&m_Model); ListLayout->addWidget(&m_MapsListView); QGroupBox *ListGroup = new QGroupBox(QNetMapTranslator::tr("Raster maps" /* Russian: Растровые карты */)); ListGroup->setMaximumWidth(200); ListGroup->setLayout(ListLayout); // кнопки m_CenterMapButton.setText(QNetMapTranslator::tr("Map's center" /* Russian: Центр карты */)); m_LinkingButton.setText(QNetMapTranslator::tr("Add reference points..." /* Russian: Привязать... */)); m_DeleteLinkingButton.setText(QNetMapTranslator::tr("Delete reference points" /* Russian: Удалить привязку */)); m_AddButton.setText(QNetMapTranslator::tr("Add to list..." /* Russian: Добавить в список... */)); m_DeleteButton.setText(QNetMapTranslator::tr("Delete from list" /* Ru: Удалить из списка */)); m_ExitDialogButton.setText(QNetMapTranslator::tr("OK")); ListLayout->addWidget(&m_CenterMapButton); ListLayout->addWidget(&m_LinkingButton); ListLayout->addWidget(&m_DeleteLinkingButton); ListLayout->addWidget(&m_AddButton); ListLayout->addWidget(&m_DeleteButton); ListLayout->addItem(new QSpacerItem(0, 7)); ListLayout->addWidget(&m_ExitDialogButton); // Кнопки подтверждения / отмены m_ButtonBox.setMinimumSize(QSize(0, 30)); m_ButtonBox.setOrientation(Qt::Horizontal); m_ButtonBox.setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); // находим кнопку ОК и делаем ее недоступной QList<QAbstractButton*> ListButtons = m_ButtonBox.buttons(); foreach(QAbstractButton* Button, ListButtons) { if(m_ButtonBox.buttonRole(Button) == QDialogButtonBox::AcceptRole) { w_ButtonOK = Button; w_ButtonOK->setEnabled(false); break; } } MapLayout->addWidget(&m_ButtonBox); m_ButtonBox.setVisible(false); MiddleLayout->addWidget(ListGroup); MiddleLayout->addLayout(MapLayout); // устанавливаем текущей первую карту в списке if(m_Model.rowCount()) mapNameClicked(m_Model.index(0, 0)); // сигналы QNM_DEBUG_CHECK(connect(&m_MapsListView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(mapNameClicked(const QModelIndex&)))); QNM_DEBUG_CHECK(connect(&m_MapsListView, SIGNAL(activated(const QModelIndex&)), this, SLOT(mapNameClicked(const QModelIndex&)))); QNM_DEBUG_CHECK(connect(&m_ButtonBox, SIGNAL(accepted()), this, SLOT(acceptLinking()))); QNM_DEBUG_CHECK(connect(&m_ButtonBox, SIGNAL(rejected()), this, SLOT(rejectLinking()))); QNM_DEBUG_CHECK(connect(&m_AddButton, SIGNAL(clicked()), this, SLOT(addMap()))); QNM_DEBUG_CHECK(connect(&m_DeleteButton, SIGNAL(clicked()), this, SLOT(deleteMap()))); QNM_DEBUG_CHECK(connect(&m_LinkingButton, SIGNAL(clicked()), this, SLOT(viewMap()))); QNM_DEBUG_CHECK(connect(&m_DeleteLinkingButton, SIGNAL(clicked()), this, SLOT(deleteLinking()))); QNM_DEBUG_CHECK(connect(&m_CenterMapButton, SIGNAL(clicked()), this, SLOT(viewCenterMap()))); QNM_DEBUG_CHECK(connect(&m_ExitDialogButton, SIGNAL(clicked()), this, SLOT(accept()))); // widgetsEnabling(); }
void PMainWindow::slotConfig() { /* * have a tab with the possible views * a tab for globals image cache size.. scaled loading * and one tab for the KeyConfigs */ QDialog dlg(this, 0, true); dlg.setCaption( tr("Opie Eye - Config" ) ); QHBoxLayout *lay = new QHBoxLayout(&dlg); Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); lay->addWidget( wid ); BaseSetup*bSetup = new BaseSetup(m_cfg,wid); wid->addTab(bSetup,"SettingsIcon","Basics setup"); ViewMap *vM = viewMap(); ViewMap::Iterator _it = vM->begin(); QMap<PDirView*, QWidget*> lst; for( ; _it != vM->end(); ++_it ) { PDirView *view = (_it.data())(*m_cfg); PInterfaceInfo *inf = view->interfaceInfo(); QWidget *_wid = inf->configWidget( *m_cfg ); if (!_wid) continue; _wid->reparent(wid, QPoint() ); lst.insert( view, _wid ); wid->addTab( _wid, "fileopen", inf->name() ); } /* * Add the KeyConfigWidget */ Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); QWidget*w = m_stack->visibleWidget(); bool reminfo = false; if ( !m_info ) { reminfo = true; initInfo(); m_info->hide(); } keyWid->insert( tr("Imageinfo Keyboard Actions"), m_info->manager() ); bool remdisp = false; if ( !m_disp ) { remdisp = true; initDisp(); m_disp->hide(); } keyWid->insert( tr("Imageview Keyboard Actions"), m_disp->manager() ); keyWid->load(); wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); wid->setCurrentTab(0); bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); /* * clean up *apply changes */ QMap<PDirView*, QWidget*>::Iterator it; for ( it = lst.begin(); it != lst.end(); ++it ) { if ( act ) it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); delete it.key(); } if ( act ) { keyWid->save(); m_disp->manager()->save(); m_info->manager()->save(); m_view->manager()->save(); bSetup->save_values(); m_view->resetView(); readConfig(); } delete keyWid; m_stack->raiseWidget(w); if (remdisp) { m_disp->hide(); } if (reminfo) { m_info->hide(); } if (m_disp) { m_disp->setIntensity(m_Intensity,true); } }
bool TeSQLite::insertView(TeView *view) { errorMessage_ = ""; // save it's projection TeProjection* proj = view->projection(); if ( !proj || !insertProjection(proj)) { errorMessage_ = "Error inserting projection"; return false; } string sql = "INSERT INTO te_view (projection_id, name, user_name, visibility, lower_x, lower_y, upper_x, upper_y, current_theme) VALUES("; sql += Te2String(proj->id()); sql += ", '"; sql += view->name(); sql += "', '"; sql += view->user(); sql += "', "; sql += Te2String(view->isVisible()) + ", "; sql += Te2String(view->getCurrentBox().lowerLeft().x(),15) + ", "; sql += Te2String(view->getCurrentBox().lowerLeft().y(),15) + ", "; sql += Te2String(view->getCurrentBox().upperRight().x(),15) + ", "; sql += Te2String(view->getCurrentBox().upperRight().y(),15) + ", "; if(view->getCurrentTheme() == -1) sql += "null "; else sql += Te2String(view->getCurrentTheme()); sql += ")"; if(this->execute(sql)) { //int newId = getMaxValue(this, "te_view", "view_id"); int newId = getLastInsertedSerial(); if(newId >= 0) { view->id(newId); } } else return false; for(unsigned int th = 0; th < view->size(); ++th) { TeViewNode* node = view->get (th); if (node->type() == TeTHEME) { TeTheme *theme = (TeTheme*) node; insertTheme (theme); } else { TeViewTree* tree = (TeViewTree*)node; insertViewTree (tree); } } viewMap()[view->id()] = view; return true; }