Example #1
0
void AddAction::updateFunctions()
{
	theFunctions->clear();
	if(theObjects->currentItem() && theObjects->currentItem()->parent())
	{	QStringList functions = getFunctions(nameProgramMap[theObjects->currentItem()->parent()], theObjects->currentItem()->text(0));
		for(QStringList::iterator i = functions.begin(); i != functions.end(); ++i)
		{	Prototype p((QString)(*i));
			new KListViewItem(theFunctions, p.name(), p.argumentList(), *i);
		}
	}
	updateOptions();
}
Example #2
0
void EditAction::readFrom()
{
	theRepeat->setChecked((*theAction).repeat());
	theAutoStart->setChecked((*theAction).autoStart());
	theDoBefore->setChecked((*theAction).doBefore());
	theDoAfter->setChecked((*theAction).doAfter());
	theDontSend->setChecked((*theAction).ifMulti() == IM_DONTSEND);
	theSendToTop->setChecked((*theAction).ifMulti() == IM_SENDTOTOP);
	theSendToBottom->setChecked((*theAction).ifMulti() == IM_SENDTOBOTTOM);
	theSendToAll->setChecked((*theAction).ifMulti() == IM_SENDTOALL);

	if((*theAction).isModeChange())
	{	// change mode
		theChangeMode->setChecked(true);
		if((*theAction).object().isEmpty())
			theModes->setCurrentText(i18n("[Exit current mode]"));
		else
			theModes->setCurrentText((*theAction).object());
	}
	else if((*theAction).isJustStart())
	{	// profile action
		theUseProfile->setChecked(true);
		const Profile *p = ProfileServer::profileServer()->profiles()[(*theAction).program()];
		theApplications->setCurrentText(p->name());
		updateFunctions();
		updateArguments();
		theJustStart->setChecked(true);
	}
	else if(ProfileServer::profileServer()->getAction((*theAction).program(), (*theAction).object(), (*theAction).method().prototype()))
	{	// profile action
		theUseProfile->setChecked(true);
		const ProfileAction *a = ProfileServer::profileServer()->getAction((*theAction).program(), (*theAction).object(), (*theAction).method().prototype());
		theApplications->setCurrentText(a->profile()->name());
		updateFunctions();
		theFunctions->setCurrentText(a->name());
		arguments = (*theAction).arguments();
		updateArguments();
		theNotJustStart->setChecked(true);
	}
	else
	{	// dcop action
		theUseDCOP->setChecked(true);
		theDCOPApplications->setCurrentText((*theAction).program());
		updateDCOPObjects();
		theDCOPObjects->setCurrentText((*theAction).object());
		updateDCOPFunctions();
		theDCOPFunctions->setCurrentText((*theAction).method().prototype());
		arguments = (*theAction).arguments();
		updateArguments();
	}
	updateOptions();
}
Example #3
0
ContestOptionsDialog::ContestOptionsDialog(QWidget *parent) : QDialog(parent)
{
    setupUi(this);
    connect(this, SIGNAL(rejected()), this, SLOT(rejectChanges()));
    connect(this, SIGNAL(accepted()), this, SLOT(updateOptions()));
    sent[0]=lineEditExch1;
    sent[1]=lineEditExch2;
    sent[2]=lineEditExch3;
    sent[3]=lineEditExch4;
    offValidator=new QIntValidator(this);
    offValidator->setBottom(1);
    offMinimumLineEdit->setValidator(offValidator);
}
Example #4
0
void AddAction::updateProfileFunctions()
{
	ProfileServer *theServer = ProfileServer::profileServer();
	theProfileFunctions->clear();
	profileFunctionMap.clear();
	if(!theProfiles->currentItem()) return;

	const Profile *p = theServer->profiles()[profileMap[theProfiles->currentItem()]];
	QDict<ProfileAction> dict = p->actions();
	for(QDictIterator<ProfileAction> i(dict); i.current(); ++i)
		profileFunctionMap[new QListViewItem(theProfileFunctions, i.current()->name(), QString().setNum(i.current()->arguments().count()), i.current()->comment())] = i.currentKey();
	updateParameters();
	updateOptions();
}
Example #5
0
bool Streamline::execute(){
    ready_ = false;
    if (!updateOptions()) return false; //Obligatory
   
    int cell = 0; 
    
    double p0[3] = {0,0,0};
    double p[3] = {0,0,0};
    double v[3] = {0,0,0};
    
    double t;
    double l;
    
    for (int i = 0; i< outputs_[0] -> numCells(); i++)
        outputs_[0] -> setC0Color(i, 0,0,0,0);
    
    for(int i = 0; i < nSeeds_; i++){
        
        setProgress(((double)i/nSeeds_)*100+1);
        
        p[0] = p0[0] = (seedPoint_[0] - seedRadius_) + 2*seedRadius_*((rand()%1000)/1000.);
        p[1] = p0[1] = (seedPoint_[1] - seedRadius_) + 2*seedRadius_*((rand()%1000)/1000.);
        p[2] = p0[2] = 0;        
                
        cell = input_ -> findCell(p0);
        t = 0;
        l = 0;
        
        for (;; t += fabs(dt_), p[0] = p0[0], p[1] = p0[1], p[2] = p0[2] ){
            if (cell == -1 || t >= maxTime_ || l >= maxLength_) break;
            
            outputs_[0] -> setC0Color(cell, 0,0,t/(maxTime_+0.000000001),t/(maxTime_+0.000000001));
            
            input_ -> getC1Vector(cell,p0,v);
            p0[0] += v[0]*dt_;
            p0[1] += v[1]*dt_;
            p0[2] += v[2]*dt_;
            
            l += sqrt((p0[0]-p[0])*(p0[0]-p[0])+(p0[1]-p[1])*(p0[1]-p[1])+(p0[2]-p[2])*(p0[2]-p[2]));
            
            cell = input_ -> findCell(p0);
            
            
        }
    }
    
    ready_ = true;
    return ready_;
}
TConnectionProcessor::TConnectionProcessor(IGuiUpdateSink& updateSink,
  const bts::profile_ptr& loadedProfile) :
  Profile(loadedProfile),
  TransmissionCancelled(false),
  ReceivingMail(false)
  {
  Sink = new TThreadSafeGuiNotifier(updateSink);

  App = bts::application::instance();
  
  App->set_application_delegate(this);

  Drafts = Profile->get_draft_db();
  OutboxQueue = new TOutboxQueue(*this, Profile);

  updateOptions();
  }
Example #7
0
void DialogueBoxWidget::updateDialogue(int index)
{
    if (!_currentDialogueNode->dialogue_parts.empty())
    {
        const std::string& content = _currentDialogueNode->dialogue_parts[_dialoguePartIndex];
        _ui->txtContent->setText(QString::fromStdString(std::move(content)));
    }
    else
    {
        this->hide();
    }

    updateOptions();

    this->adjustSize();
    this->updateGeometry();
}
ScriptEditorWidget::ScriptEditorWidget(QWidget * pParent)
    : QTextEdit(pParent)
{
	m_pSyntaxHighlighter = nullptr;
	setTabStopWidth(48);
	setAcceptRichText(false);
	setWordWrapMode(QTextOption::NoWrap);
	m_pParent = pParent;
	m_szHelp = "Nothing";
	updateOptions();
	m_szFind = "";
	m_pCompleter = nullptr;
	QStringList szListFunctionsCommands;
	QString tmp("kvscompleter.idx");
	iModulesCount = 0;
	iIndex = 0;
	QString szPath;
	g_pApp->getLocalKvircDirectory(szPath, KviApplication::ConfigPlugins, tmp);

	if(!KviFileUtils::fileExists(szPath))
	{
		if(!bSemaphore)
		{
			bSemaphore = true;
			m_pStartTimer = new QTimer();
			m_pStartTimer->setInterval(1000);
			connect(m_pStartTimer, SIGNAL(timeout()), this, SLOT(asyncCompleterCreation()));
			m_pStartTimer->start(500);
		}
		else
		{
			m_pStartTimer = new QTimer();
			m_pStartTimer->setInterval(2000);
			connect(m_pStartTimer, SIGNAL(timeout()), this, SLOT(checkReadyCompleter()));
			m_pStartTimer->start(1000);
		}
	}
	else
		loadCompleterFromFile();
}
Example #9
0
    void DialogueWindow::startDialogue(MWWorld::Ptr actor, std::string npcName)
    {
        mGoodbye = false;
        mEnabled = true;
        mPtr = actor;
        mTopicsList->setEnabled(true);
        setTitle(npcName);

        clearChoices();

        mTopicsList->clear();

        for (std::vector<DialogueText*>::iterator it = mHistoryContents.begin(); it != mHistoryContents.end(); ++it)
            delete (*it);
        mHistoryContents.clear();

        for (std::vector<Link*>::iterator it = mLinks.begin(); it != mLinks.end(); ++it)
            delete (*it);
        mLinks.clear();

        updateOptions();
    }
Example #10
0
/**
 * Execute Color Mapper method.
 * @return Execute status.
 */
bool ColorMapper::execute(){
    ready_ = false;
    if (!updateOptions() && !outputs_.size()) return false;
    
    double p[3] = {0,0,0};
    double v[3] = {0,0,0}; 
    std::vector <double> vMag(outputs_[0] -> numCells());
    
    for (int i = 0; i< outputs_[0] -> numCells(); i++){
        outputs_[0] -> getC1Vector(i,p,v);
        vMag[i] = sqrt(factor1_*v[0]*v[0] + factor2_*v[1]*v[1] + factor3_*v[2]*v[2]);
    }
    
    double scale = *std::max_element(vMag.begin(), vMag.end());
    if (fabs(scale) < 0.00000001) scale = 0.00000001; 
    for (int i = 0; i< outputs_[0] -> numCells(); i++){
        outputs_[0] -> setC0Color(i,0,0,vMag[i]/scale,1);
    }
    
    ready_ = true;
    return ready_;
}
Example #11
0
void OptionsDialog::saveScreen()
    {
    ScreenOptions options(mCurrentBuildConfig, mProjectOptions, mGuiOptions);
    options.screenToOptions();

    OovStatus status = mProjectOptions.writeFile();
    if(!status.ok())
        {
        OovString errStr = "Unable to write project options file: ";
        errStr += mProjectOptions.getFilename();
        OovError::report(ET_Error, errStr);
        }
    if(status.ok())
        {
        status = mGuiOptions.writeFile();
        if(!status.ok())
            {
            OovString errStr = "Unable to write GUI options file: ";
            errStr += mGuiOptions.getFilename();
            OovError::report(ET_Error, errStr);
            }
        }
    updateOptions();
    }
RDCartSlot::RDCartSlot(int slotnum,RDRipc *ripc,RDCae *cae,RDStation *station,
		       RDConfig *config,RDListSvcs *svcs_dialog,
		       RDSlotDialog *slot_dialog,RDCartDialog *cart_dialog,
		       RDCueEditDialog *cue_dialog,
		       const QString &caption,RDAirPlayConf *conf,
		       QWidget *parent)
  : QWidget(parent)
{
  slot_number=slotnum;
  slot_ripc=ripc;
  slot_cae=cae;
  slot_station=station;
  slot_config=config;
  slot_svcs_dialog=svcs_dialog;
  slot_slot_dialog=slot_dialog;
  slot_cart_dialog=cart_dialog;
  slot_cue_dialog=cue_dialog;
  slot_caption=caption;
  slot_airplay_conf=conf;

  slot_svc_names=NULL;
  slot_stop_requested=false;
  slot_logline=new RDLogLine();
  slot_pause_enabled=false;
  slot_user=NULL;
  slot_svcname="";
  slot_breakaway_cart=0;
  slot_breakaway_length=0;
  slot_timescaling_active=false;
  slot_temp_cart=false;

  //
  // Fonts
  //
  QFont big_font("helvetica",36,QFont::Bold);
  big_font.setPixelSize(36);
  QFont mid_font("helvetica",14,QFont::Bold);
  mid_font.setPixelSize(14);

  //
  // Palettes
  //
  slot_ready_color=
    QPalette(QColor(BUTTON_STOPPED_BACKGROUND_COLOR),backgroundColor());
  slot_playing_color=
    QPalette(QColor(BUTTON_PLAY_BACKGROUND_COLOR),backgroundColor());

  //
  // Slot Options
  //
  slot_options=new RDSlotOptions(station->name(),slotnum);
  slot_options->load();

  //
  // Play Deck
  //
  slot_deck=new RDPlayDeck(slot_cae,0,this);
  connect(slot_deck,SIGNAL(stateChanged(int,RDPlayDeck::State)),
	  this,SLOT(stateChangedData(int,RDPlayDeck::State)));
  connect(slot_deck,SIGNAL(position(int,int)),
	  this,SLOT(positionData(int,int)));
  connect(slot_deck,SIGNAL(hookEnd(int)),this,SLOT(hookEndData(int)));
  connect(slot_cae,SIGNAL(timescalingSupported(int,bool)),
	  this,SLOT(timescalingSupportedData(int,bool)));

  //
  // Start Button
  //
  slot_start_button=new QPushButton(QString().sprintf("%d",slotnum+1),this);
  slot_start_button->setGeometry(0,0,sizeHint().height(),sizeHint().height());
  slot_start_button->setFont(big_font);
  slot_start_button->setDisabled(true);
  connect(slot_start_button,SIGNAL(clicked()),this,SLOT(startData()));

  //
  // Slot Box
  //
  slot_box=new RDSlotBox(slot_deck,conf,this);
  slot_box->setBarMode(false);
  slot_box->setAllowDrags(station->enableDragdrop());
  slot_box->setAcceptDrops(station->enableDragdrop());
  slot_box->setGeometry(5+sizeHint().height(),0,
			slot_box->sizeHint().width(),
			slot_box->sizeHint().height());
  connect(slot_box,SIGNAL(doubleClicked()),this,SLOT(doubleClickedData()));
  connect(slot_box,SIGNAL(cartDropped(unsigned)),
	  this,SLOT(cartDroppedData(unsigned)));

  //
  // Load Button
  //
  slot_load_button=new QPushButton(tr("Load"),this);
  slot_load_button->
    setGeometry(sizeHint().height()+5+slot_box->sizeHint().width()+5,0,
		sizeHint().height(),sizeHint().height());
  slot_load_button->setFont(mid_font);
  connect(slot_load_button,SIGNAL(clicked()),this,SLOT(loadData()));

  //
  // Options Button
  //
  slot_options_button=new QPushButton(this);
  slot_options_button->
    setGeometry(2*sizeHint().height()+10+slot_box->sizeHint().width()+5,0,
		sizeHint().height(),sizeHint().height());
  slot_options_button->setFont(mid_font);
  connect(slot_options_button,SIGNAL(clicked()),this,SLOT(optionsData()));

  updateOptions();
  InitializeOptions();
}
Example #13
0
SofaConfiguration::SofaConfiguration(std::string path_, std::vector< DEFINES >& config):QMainWindow(),path(path_),data(config),saveButton(NULL)

{
    resize(800, 600);

    QWidget *appli = new QWidget(this);
    QVBoxLayout *layout = new QVBoxLayout(appli);



    QToolBox *global = new QToolBox(appli);
    global->setMaximumHeight(600);
    global->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);


    std::string currentCategory;

    std::set< std::string > alreadyBuiltCategories;

    QWidget *page=NULL;
    QVBoxLayout *pageLayout=NULL;
    for (unsigned int i=0; i<config.size(); ++i)
    {
        if (alreadyBuiltCategories.find(config[i].category) == alreadyBuiltCategories.end())
        {
            alreadyBuiltCategories.insert(config[i].category);
            if (page)
            {
                pageLayout->addItem( new QSpacerItem(10,10,QSizePolicy::Expanding, QSizePolicy::Expanding));
            }
            currentCategory = config[i].category;
            page = new QWidget(global);
            global->addItem(page,QString(currentCategory.c_str()));
            pageLayout=new QVBoxLayout(page);

            for (unsigned int j=0; j<config.size(); ++j)
            {
                if (config[j].category == currentCategory)
                {
                    ConfigWidget *o;
                    if (config[j].typeOption) o=new OptionConfigWidget(page, config[j]);
                    else                      o=new TextConfigWidget(page, config[j]);

                    pageLayout->addWidget(o);
                    options.push_back(o);
                    connect(o, SIGNAL(modified()), this, SLOT(updateOptions()));
                }
            }
        }
    }

    if (page)
    {
        pageLayout->addItem( new QSpacerItem(10,10,QSizePolicy::Expanding, QSizePolicy::Expanding));
    }
    updateConditions();

    saveButton = new QPushButton(QString("Save and Update Configuration"),appli);
    connect( saveButton, SIGNAL(clicked()), this, SLOT(saveConfiguration()));
    layout->addWidget(global);

#ifdef WIN32
    projectVC = new QLineEdit(QString("Project VC8.bat"),appli);
    layout->addWidget(projectVC);
#endif

    layout->addWidget(saveButton);
    this->setCentralWidget(appli);
}
Example #14
0
void CDbUrl::RemoveOption(const std::string &key)
{
  CUrlOptions::RemoveOption(key);
  updateOptions(); 
}
ExportDialog::ExportDialog(const QString& tableName, QWidget* parent, Qt::WFlags fl )
    : QDialog( parent, fl )
{
	setWindowTitle( tr( "QtiPlot - Export ASCII" ) );
	setSizeGripEnabled( true );

	ApplicationWindow *app = (ApplicationWindow *)parent;

	QGridLayout *gl1 = new QGridLayout();
    gl1->addWidget(new QLabel(tr("Table")), 0, 0);
	boxTable = new QComboBox();
	QStringList tables = app->tableNames() + app->matrixNames();
	boxTable->addItems(tables);
	boxTable->setCurrentIndex(0);

	boxTable->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
	gl1->addWidget(boxTable, 0, 1);

	boxAllTables = new QCheckBox(tr( "&All" ));
    boxAllTables->setChecked(false);
	gl1->addWidget(boxAllTables, 0, 2);

    QLabel *sepText = new QLabel( tr( "Separator" ) );
	gl1->addWidget(sepText, 1, 0);

    boxSeparator = new QComboBox();
	boxSeparator->addItem(tr("TAB"));
    boxSeparator->addItem(tr("SPACE"));
	boxSeparator->addItem(";" + tr("TAB"));
	boxSeparator->addItem("," + tr("TAB"));
	boxSeparator->addItem(";" + tr("SPACE"));
	boxSeparator->addItem("," + tr("SPACE"));
    boxSeparator->addItem(";");
    boxSeparator->addItem(",");
	boxSeparator->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
	boxSeparator->setEditable( true );
	gl1->addWidget(boxSeparator, 1, 1);
	setColumnSeparator(app->d_export_col_separator);

	QString help = tr("The column separator can be customized. The following special codes can be used:\n\\t for a TAB character \n\\s for a SPACE");
	help += "\n"+tr("The separator must not contain the following characters: 0-9eE.+-");

	boxSeparator->setWhatsThis(help);
	sepText->setWhatsThis(help);
	boxSeparator->setToolTip(help);
	sepText->setToolTip(help);

	boxNames = new QCheckBox(tr( "Include Column &Names" ));
    boxNames->setChecked( app->d_export_col_names );

	boxComments = new QCheckBox(tr( "Include Column Co&mments" ));
    boxComments->setChecked( app->d_export_col_comment );

    boxSelection = new QCheckBox(tr( "Export &Selection" ));
    boxSelection->setChecked( app->d_export_table_selection );

	QVBoxLayout *vl1 = new QVBoxLayout();
	vl1->addLayout( gl1 );
	vl1->addWidget( boxNames );
	vl1->addWidget( boxComments );
	vl1->addWidget( boxSelection );

	QHBoxLayout *hbox3 = new QHBoxLayout();
	buttonOk = new QPushButton(tr( "&OK" ));
    buttonOk->setDefault( true );
	hbox3->addWidget( buttonOk );
    buttonCancel = new QPushButton(tr( "&Cancel" ));
	hbox3->addWidget( buttonCancel );
	buttonHelp = new QPushButton(tr( "&Help" ));
	hbox3->addWidget( buttonHelp );
	hbox3->addStretch();

	QVBoxLayout *vl = new QVBoxLayout( this );
    vl->addLayout(vl1);
	vl->addStretch();
	vl->addLayout(hbox3);

    // signals and slots connections
    connect( boxTable, SIGNAL(activated(const QString &)), this, SLOT(updateOptions(const QString &)));
    connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
	connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( close() ) );
    connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( help() ) );
	connect( boxAllTables, SIGNAL( toggled(bool) ), this, SLOT( enableTableName(bool) ) );

    if (tables.contains(tableName)){
		boxTable->setCurrentIndex(boxTable->findText(tableName));
		updateOptions(tableName);
    }
}
Example #16
0
int webPage::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: loading((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 1: isLoading((*reinterpret_cast< QPixmap(*)>(_a[1]))); break;
        case 2: titleChanged((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 3: pageChanged((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 4: showSources((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 5: speedDial(); break;
        case 6: needPrint((*reinterpret_cast< QPrinter*(*)>(_a[1]))); break;
        case 7: openTab((*reinterpret_cast< webPage*(*)>(_a[1]))); break;
        case 8: setFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 9: startLoading(); break;
        case 10: finishLoading((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 11: changeTitle((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 12: changeUrl((*reinterpret_cast< QUrl(*)>(_a[1]))); break;
        case 13: goToHome(); break;
        case 14: loadUrl(); break;
        case 15: loadUrl((*reinterpret_cast< QUrl(*)>(_a[1]))); break;
        case 16: loadUrl((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 17: addToBookMark(); break;
        case 18: downloadFile((*reinterpret_cast< const QNetworkRequest(*)>(_a[1]))); break;
        case 19: downloadFile((*reinterpret_cast< QNetworkReply*(*)>(_a[1]))); break;
        case 20: loadBookMark(); break;
        case 21: showBookMark(); break;
        case 22: sources(); break;
        case 23: defineHome(); break;
        case 24: findNext(); break;
        case 25: findPrevious(); break;
        case 26: print(); break;
        case 27: createNewPage((*reinterpret_cast< WebView*(*)>(_a[1]))); break;
        case 28: createNewPage(); break;
        case 29: updateIcon(); break;
        case 30: copy(); break;
        case 31: authentification((*reinterpret_cast< QNetworkReply*(*)>(_a[1])),(*reinterpret_cast< QAuthenticator*(*)>(_a[2]))); break;
        case 32: inspectPage(); break;
        case 33: goToDial(); break;
        case 34: updateUrlIcon((*reinterpret_cast< QPixmap(*)>(_a[1]))); break;
        case 35: updateBookMark(); break;
        case 36: updateOptions(); break;
        case 37: showBar(); break;
        case 38: showPage(); break;
        case 39: showDial(); break;
        case 40: inCache(); break;
        case 41: showConsole(); break;
        case 42: zoomIn(); break;
        case 43: zoomOut(); break;
        case 44: restoreZoom(); break;
        case 45: savePage(); break;
        case 46: back(); break;
        case 47: forward(); break;
        default: ;
        }
        _id -= 48;
    }
    return _id;
}
Example #17
0
QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, QWidget* parent )
    : QWidget( parent ), mLBL( lbl ), mLayer( layer ), mMapCanvas( mapCanvas )
{
  if ( !layer ) return;

  setupUi( this );

  mRefFont = lblFontPreview->font();
  mPreviewSize = 24;

  connect( btnTextColor, SIGNAL( clicked() ), this, SLOT( changeTextColor() ) );
  connect( btnChangeFont, SIGNAL( clicked() ), this, SLOT( changeTextFont() ) );
  connect( mFontTranspSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ) );
  connect( chkBuffer, SIGNAL( toggled( bool ) ), this, SLOT( updatePreview() ) );
  connect( btnBufferColor, SIGNAL( clicked() ), this, SLOT( changeBufferColor() ) );
  connect( spinBufferSize, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ) );
  connect( mBufferTranspSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ) );
  connect( mBufferJoinStyleComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( updatePreview() ) );
  connect( mBufferTranspFillChbx, SIGNAL( toggled( bool ) ), this, SLOT( updatePreview() ) );
  connect( btnEngineSettings, SIGNAL( clicked() ), this, SLOT( showEngineConfigDialog() ) );
  connect( btnExpression, SIGNAL( clicked() ), this, SLOT( showExpressionDialog() ) );

  // set placement methods page based on geometry type
  switch ( layer->geometryType() )
  {
    case QGis::Point:
      stackedPlacement->setCurrentWidget( pagePoint );
      break;
    case QGis::Line:
      stackedPlacement->setCurrentWidget( pageLine );
      break;
    case QGis::Polygon:
      stackedPlacement->setCurrentWidget( pagePolygon );
      break;
    default:
      Q_ASSERT( 0 && "NOOOO!" );
  }

  //mTabWidget->setEnabled( chkEnableLabeling->isChecked() );
  chkMergeLines->setEnabled( layer->geometryType() == QGis::Line );
  chkAddDirectionSymbol->setEnabled( layer->geometryType() == QGis::Line );
  label_19->setEnabled( layer->geometryType() != QGis::Point );
  mMinSizeSpinBox->setEnabled( layer->geometryType() != QGis::Point );

  // load labeling settings from layer
  QgsPalLayerSettings lyr;
  lyr.readFromLayer( layer );
  populateFieldNames();
  populateDataDefinedCombos( lyr );
  populateFontCapitalsComboBox();

  chkEnableLabeling->setChecked( lyr.enabled );
  mTabWidget->setEnabled( lyr.enabled );
  cboFieldName->setEnabled( lyr.enabled );
  btnExpression->setEnabled( lyr.enabled );

  //Add the current expression to the bottom of the list.
  if ( lyr.isExpression && !lyr.fieldName.isEmpty() )
    cboFieldName->addItem( lyr.fieldName );

  // placement
  int distUnitIndex = lyr.distInMapUnits ? 1 : 0;
  mXQuadOffset = lyr.xQuadOffset;
  mYQuadOffset = lyr.yQuadOffset;
  mCentroidRadioWhole->setChecked( lyr.centroidWhole );
  mCentroidFrame->setVisible( false );
  switch ( lyr.placement )
  {
    case QgsPalLayerSettings::AroundPoint:
      radAroundPoint->setChecked( true );
      radAroundCentroid->setChecked( true );
      spinDistPoint->setValue( lyr.dist );
      mPointDistanceUnitComboBox->setCurrentIndex( distUnitIndex );
      mCentroidFrame->setVisible( layer->geometryType() == QGis::Polygon );

      //spinAngle->setValue( lyr.angle );
      break;
    case QgsPalLayerSettings::OverPoint:
      radOverPoint->setChecked( true );
      radOverCentroid->setChecked( true );

      mPointOffsetRadioAboveLeft->setChecked( mXQuadOffset == -1 && mYQuadOffset == 1 );
      mPointOffsetRadioAbove->setChecked( mXQuadOffset == 0 && mYQuadOffset == 1 );
      mPointOffsetRadioAboveRight->setChecked( mXQuadOffset == 1 && mYQuadOffset == 1 );
      mPointOffsetRadioLeft->setChecked( mXQuadOffset == -1 && mYQuadOffset == 0 );
      mPointOffsetRadioOver->setChecked( mXQuadOffset == 0 && mYQuadOffset == 0 );
      mPointOffsetRadioRight->setChecked( mXQuadOffset == 1 && mYQuadOffset == 0 );
      mPointOffsetRadioBelowLeft->setChecked( mXQuadOffset == -1 && mYQuadOffset == -1 );
      mPointOffsetRadioBelow->setChecked( mXQuadOffset == 0 && mYQuadOffset == -1 );
      mPointOffsetRadioBelowRight->setChecked( mXQuadOffset == 1 && mYQuadOffset == -1 );

      mPointOffsetXOffsetSpinBox->setValue( lyr.xOffset );
      mPointOffsetYOffsetSpinBox->setValue( lyr.yOffset );
      mPointOffsetUnitsComboBox->setCurrentIndex( lyr.labelOffsetInMapUnits ? 1 : 0 );
      mPointOffsetAngleSpinBox->setValue( lyr.angleOffset );
      mCentroidFrame->setVisible( layer->geometryType() == QGis::Polygon );

      break;
    case QgsPalLayerSettings::Line:
      radLineParallel->setChecked( true );
      radPolygonPerimeter->setChecked( true );
      break;
    case QgsPalLayerSettings::Curved:
      radLineCurved->setChecked( true );
      break;
    case QgsPalLayerSettings::Horizontal:
      radPolygonHorizontal->setChecked( true );
      radLineHorizontal->setChecked( true );
      break;
    case QgsPalLayerSettings::Free:
      radPolygonFree->setChecked( true );
      break;
    default:
      Q_ASSERT( 0 && "NOOO!" );
  }

  if ( lyr.placement == QgsPalLayerSettings::Line || lyr.placement == QgsPalLayerSettings::Curved )
  {
    spinDistLine->setValue( lyr.dist );
    mLineDistanceUnitComboBox->setCurrentIndex( distUnitIndex );
    chkLineAbove->setChecked( lyr.placementFlags & QgsPalLayerSettings::AboveLine );
    chkLineBelow->setChecked( lyr.placementFlags & QgsPalLayerSettings::BelowLine );
    chkLineOn->setChecked( lyr.placementFlags & QgsPalLayerSettings::OnLine );
    if ( !( lyr.placementFlags & QgsPalLayerSettings::MapOrientation ) )
      chkLineOrientationDependent->setChecked( true );
  }

  cboFieldName->setCurrentIndex( cboFieldName->findText( lyr.fieldName ) );
  chkEnableLabeling->setChecked( lyr.enabled );
  sliderPriority->setValue( lyr.priority );
  chkNoObstacle->setChecked( !lyr.obstacle );
  chkLabelPerFeaturePart->setChecked( lyr.labelPerPart );
  mPalShowAllLabelsForLayerChkBx->setChecked( lyr.displayAll );
  chkMergeLines->setChecked( lyr.mergeLines );
  mMinSizeSpinBox->setValue( lyr.minFeatureSize );
  chkAddDirectionSymbol->setChecked( lyr.addDirectionSymbol );
  wrapCharacterEdit->setText( lyr.wrapChar );
  chkPreserveRotation->setChecked( lyr.preserveRotation );

  mPreviewBackgroundBtn->setColor( lyr.previewBkgrdColor );
  setPreviewBackground( lyr.previewBkgrdColor );

  bool scaleBased = ( lyr.scaleMin != 0 && lyr.scaleMax != 0 );
  chkScaleBasedVisibility->setChecked( scaleBased );
  if ( scaleBased )
  {
    spinScaleMin->setValue( lyr.scaleMin );
    spinScaleMax->setValue( lyr.scaleMax );
  }

  bool buffer = ( lyr.bufferSize != 0 );
  chkBuffer->setChecked( buffer );
  if ( buffer )
  {
    spinBufferSize->setValue( lyr.bufferSize );
    if ( lyr.bufferSizeInMapUnits )
    {
      mBufferUnitComboBox->setCurrentIndex( 1 );
    }
    else
    {
      mBufferUnitComboBox->setCurrentIndex( 0 );
    }
    btnBufferColor->setColor( lyr.bufferColor );
    mBufferTranspSpinBox->setValue( lyr.bufferTransp );
    mBufferJoinStyleComboBox->setPenJoinStyle( lyr.bufferJoinStyle );
    mBufferTranspFillChbx->setChecked( !lyr.bufferNoFill );
  }

  bool formattedNumbers = lyr.formatNumbers;
  bool plusSign = lyr.plusSign;

  chkFormattedNumbers->setChecked( formattedNumbers );
  if ( formattedNumbers )
  {
    spinDecimals->setValue( lyr.decimals );
  }
  if ( plusSign )
  {
    chkPlusSign->setChecked( plusSign );
  }

  if ( lyr.fontSizeInMapUnits )
  {
    mFontSizeUnitComboBox->setCurrentIndex( 1 );
  }
  else
  {
    mFontSizeUnitComboBox->setCurrentIndex( 0 );
  }

  mRefFont = lyr.textFont;
  mFontSizeSpinBox->setValue( lyr.textFont.pointSizeF() );
  btnTextColor->setColor( lyr.textColor );
  mFontTranspSpinBox->setValue( lyr.textTransp );

  updateFontViaStyle( lyr.textNamedStyle );
  updateFont( mRefFont );

  updateUi();

  updateOptions();

  connect( chkBuffer, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) );
  connect( chkScaleBasedVisibility, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) );
  connect( chkFormattedNumbers, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) );
  connect( chkLineAbove, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) );
  connect( chkLineBelow, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) );

  // setup connection to changes in the placement
  QRadioButton* placementRadios[] =
  {
    radAroundPoint, radOverPoint, // point
    radLineParallel, radLineCurved, radLineHorizontal, // line
    radAroundCentroid, radPolygonHorizontal, radPolygonFree, radPolygonPerimeter // polygon
  };
  for ( unsigned int i = 0; i < sizeof( placementRadios ) / sizeof( QRadioButton* ); i++ )
  {
    connect( placementRadios[i], SIGNAL( toggled( bool ) ), this, SLOT( updateOptions() ) );
  }

  // setup connections for label quadrant offsets
  QRadioButton* quadrantRadios[] =
  {
    mPointOffsetRadioAboveLeft, mPointOffsetRadioAbove, mPointOffsetRadioAboveRight,
    mPointOffsetRadioLeft, mPointOffsetRadioOver, mPointOffsetRadioRight,
    mPointOffsetRadioBelowLeft, mPointOffsetRadioBelow, mPointOffsetRadioBelowRight
  };
  for ( unsigned int i = 0; i < sizeof( quadrantRadios ) / sizeof( QRadioButton* ); i++ )
  {
    connect( quadrantRadios[i], SIGNAL( toggled( bool ) ), this, SLOT( updateQuadrant() ) );
  }

  // Global settings group for groupboxes' saved/retored collapsed state
  // maintains state across different dialogs
  foreach ( QgsCollapsibleGroupBox *grpbox, findChildren<QgsCollapsibleGroupBox*>() )
  {
    grpbox->setSettingGroup( QString( "mAdvLabelingDlg" ) );
  }
Example #18
0
PluginMagForm::PluginMagForm(PluginMag* plugin, QWidget* parent, Qt::WindowFlags flags):PluginFormAbstract(plugin, tr("AM Measurements"), parent, flags)
{
    
    mIncRadio = new QRadioButton(tr("Inclination"));
    mDecRadio = new QRadioButton(tr("Declination"));
    mIntensityRadio = new QRadioButton(tr("Intensity"));
    
    connect(mIncRadio, SIGNAL(clicked()), this, SLOT(updateOptions()));
    connect(mDecRadio, SIGNAL(clicked()), this, SLOT(updateOptions()));
    connect(mIntensityRadio, SIGNAL(clicked()), this, SLOT(updateOptions()));
    
    mIncLab = new QLabel(tr("Inclination") + " :", this);
    mDecLab = new QLabel(tr("Declination") + " :", this);
    mDecIncLab = new QLabel(tr("Inclination") + " :", this);
    mIntensityLab = new QLabel(tr("Intensity") + " :", this);
    mAlpha95Lab = new QLabel(tr("Alpha 95") + " :", this);
    mRefLab = new QLabel(tr("Reference") + " :", this);
    
    mIncEdit = new QLineEdit(this);
    mDecEdit = new QLineEdit(this);
    mDecIncEdit = new QLineEdit(this);
    mIntensityEdit = new QLineEdit(this);
    mAlpha95Edit = new QLineEdit(this);
    
    mRefCombo = new QComboBox(this);
    QStringList refCurves = plugin->getRefsNames();
    for(int i = 0; i<refCurves.size(); ++i)
        mRefCombo->addItem(refCurves[i]);
    
    mIncEdit->setText("60");
    mDecEdit->setText("0");
    mDecIncEdit->setText("60");
    mIntensityEdit->setText("0");
    mAlpha95Edit->setText("1");
    
    mIncRadio->setChecked(true);
    mRefCombo->setCurrentIndex(mRefCombo->findText("i.ref",Qt::MatchEndsWith));
    
    QGridLayout* grid = new QGridLayout();
    grid->setContentsMargins(0, 0, 0, 0);
    
    grid->addWidget(mIncRadio, 0, 1);
    grid->addWidget(mDecRadio, 1, 1);
    grid->addWidget(mIntensityRadio, 2, 1);
    
    grid->addWidget(mIncLab, 3, 0, Qt::AlignRight | Qt::AlignVCenter);
    grid->addWidget(mIncEdit, 3, 1);
    
    grid->addWidget(mDecLab, 4, 0, Qt::AlignRight | Qt::AlignVCenter);
    grid->addWidget(mDecEdit, 4, 1);
    
    grid->addWidget(mDecIncLab, 3, 0, Qt::AlignRight | Qt::AlignVCenter);
    grid->addWidget(mDecIncEdit, 3, 1);
    
    grid->addWidget(mIntensityLab, 3, 0, Qt::AlignRight | Qt::AlignVCenter);
    grid->addWidget(mIntensityEdit, 3, 1);
    
    grid->addWidget(mAlpha95Lab, 5, 0, Qt::AlignRight | Qt::AlignVCenter);
    grid->addWidget(mAlpha95Edit, 5, 1);
    
    grid->addWidget(mRefLab, 6, 0, Qt::AlignRight | Qt::AlignVCenter);
    grid->addWidget(mRefCombo, 6, 1);
    
    setLayout(grid);
    
    
    
    updateOptions();
}
Example #19
0
QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, QWidget* parent )
    : QWidget( parent ), mLBL( lbl ), mLayer( layer ), mMapCanvas( mapCanvas )
{
  if ( !layer ) return;

  setupUi( this );

  mRefFont = lblFontPreview->font();
  mPreviewBackgroundBtn->setColor( Qt::white );
  connect( mPreviewBackgroundBtn, SIGNAL( clicked() ), this, SLOT( changePreviewBackground( ) ) );

  connect( btnTextColor, SIGNAL( clicked() ), this, SLOT( changeTextColor() ) );
  connect( btnChangeFont, SIGNAL( clicked() ), this, SLOT( changeTextFont() ) );
  connect( chkBuffer, SIGNAL( toggled( bool ) ), this, SLOT( updatePreview() ) );
  connect( btnBufferColor, SIGNAL( clicked() ), this, SLOT( changeBufferColor() ) );
  connect( spinBufferSize, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ) );
  connect( btnEngineSettings, SIGNAL( clicked() ), this, SLOT( showEngineConfigDialog() ) );
  connect( btnExpression, SIGNAL( clicked() ), this, SLOT( showExpressionDialog() ) );

  // set placement methods page based on geometry type
  switch ( layer->geometryType() )
  {
    case QGis::Point:
      stackedPlacement->setCurrentWidget( pagePoint );
      break;
    case QGis::Line:
      stackedPlacement->setCurrentWidget( pageLine );
      break;
    case QGis::Polygon:
      stackedPlacement->setCurrentWidget( pagePolygon );
      break;
    default:
      Q_ASSERT( 0 && "NOOOO!" );
  }

  //mTabWidget->setEnabled( chkEnableLabeling->isChecked() );
  chkMergeLines->setEnabled( layer->geometryType() == QGis::Line );
  chkAddDirectionSymbol->setEnabled( layer->geometryType() == QGis::Line );
  label_19->setEnabled( layer->geometryType() != QGis::Point );
  mMinSizeSpinBox->setEnabled( layer->geometryType() != QGis::Point );

  // load labeling settings from layer
  QgsPalLayerSettings lyr;
  lyr.readFromLayer( layer );
  populateFieldNames();
  populateDataDefinedCombos( lyr );

  chkEnableLabeling->setChecked( lyr.enabled );
  mTabWidget->setEnabled( lyr.enabled );
  cboFieldName->setEnabled( lyr.enabled );
  btnExpression->setEnabled( lyr.enabled );

  //Add the current expression to the bottom of the list.
  if ( lyr.isExpression && !lyr.fieldName.isEmpty() )
    cboFieldName->addItem( lyr.fieldName );

  // placement
  int distUnitIndex = lyr.distInMapUnits ? 1 : 0;
  switch ( lyr.placement )
  {
    case QgsPalLayerSettings::AroundPoint:
      radAroundPoint->setChecked( true );
      radAroundCentroid->setChecked( true );
      spinDistPoint->setValue( lyr.dist );
      mPointDistanceUnitComboBox->setCurrentIndex( distUnitIndex );
      //spinAngle->setValue(lyr.angle);
      break;
    case QgsPalLayerSettings::OverPoint:
      radOverPoint->setChecked( true );
      radOverCentroid->setChecked( true );
      break;
    case QgsPalLayerSettings::Line:
      radLineParallel->setChecked( true );
      radPolygonPerimeter->setChecked( true );
      break;
    case QgsPalLayerSettings::Curved:
      radLineCurved->setChecked( true );
      break;
    case QgsPalLayerSettings::Horizontal:
      radPolygonHorizontal->setChecked( true );
      radLineHorizontal->setChecked( true );
      break;
    case QgsPalLayerSettings::Free:
      radPolygonFree->setChecked( true );
      break;
    default:
      Q_ASSERT( 0 && "NOOO!" );
  }

  if ( lyr.placement == QgsPalLayerSettings::Line || lyr.placement == QgsPalLayerSettings::Curved )
  {
    spinDistLine->setValue( lyr.dist );
    mLineDistanceUnitComboBox->setCurrentIndex( distUnitIndex );
    chkLineAbove->setChecked( lyr.placementFlags & QgsPalLayerSettings::AboveLine );
    chkLineBelow->setChecked( lyr.placementFlags & QgsPalLayerSettings::BelowLine );
    chkLineOn->setChecked( lyr.placementFlags & QgsPalLayerSettings::OnLine );
    if ( !( lyr.placementFlags & QgsPalLayerSettings::MapOrientation ) )
      chkLineOrientationDependent->setChecked( true );
  }

  cboFieldName->setCurrentIndex( cboFieldName->findText( lyr.fieldName ) );
  chkEnableLabeling->setChecked( lyr.enabled );
  sliderPriority->setValue( lyr.priority );
  chkNoObstacle->setChecked( !lyr.obstacle );
  chkLabelPerFeaturePart->setChecked( lyr.labelPerPart );
  chkMergeLines->setChecked( lyr.mergeLines );
  mMinSizeSpinBox->setValue( lyr.minFeatureSize );
  chkAddDirectionSymbol->setChecked( lyr.addDirectionSymbol );
  wrapCharacterEdit->setText( lyr.wrapChar );
  chkPreserveRotation->setChecked( lyr.preserveRotation );

  bool scaleBased = ( lyr.scaleMin != 0 && lyr.scaleMax != 0 );
  chkScaleBasedVisibility->setChecked( scaleBased );
  if ( scaleBased )
  {
    spinScaleMin->setValue( lyr.scaleMin );
    spinScaleMax->setValue( lyr.scaleMax );
  }

  bool buffer = ( lyr.bufferSize != 0 );
  chkBuffer->setChecked( buffer );
  if ( buffer )
    spinBufferSize->setValue( lyr.bufferSize );

  btnTextColor->setColor( lyr.textColor );
  mFontTranspSpinBox->setValue( lyr.textTransp );
  btnBufferColor->setColor( lyr.bufferColor );
  mBufferTranspSpinBox->setValue( lyr.bufferTransp );

  bool formattedNumbers = lyr.formatNumbers;
  bool plusSign = lyr.plusSign;

  chkFormattedNumbers->setChecked( formattedNumbers );
  if ( formattedNumbers )
  {
    spinDecimals->setValue( lyr.decimals );
  }
  if ( plusSign )
  {
    chkPlusSign->setChecked( plusSign );
  }


  if ( lyr.fontSizeInMapUnits )
  {
    mFontSizeUnitComboBox->setCurrentIndex( 1 );
  }
  else
  {
    mFontSizeUnitComboBox->setCurrentIndex( 0 );
  }

  QFont textFont = lyr.textFont;
  updateFont( textFont );
  mFontSizeSpinBox->setValue( textFont.pointSizeF() );
  updateUi();

  updateOptions();

  connect( chkBuffer, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) );
  connect( chkScaleBasedVisibility, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) );
  connect( chkFormattedNumbers, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) );
  connect( chkLineAbove, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) );
  connect( chkLineBelow, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) );

  // setup connection to changes in the placement
  QRadioButton* placementRadios[] =
  {
    radAroundPoint, radOverPoint, // point
    radLineParallel, radLineCurved, radLineHorizontal, // line
    radAroundCentroid, radPolygonHorizontal, radPolygonFree, radPolygonPerimeter // polygon
  };
  for ( unsigned int i = 0; i < sizeof( placementRadios ) / sizeof( QRadioButton* ); i++ )
  {
    connect( placementRadios[i], SIGNAL( toggled( bool ) ), this, SLOT( updateOptions() ) );
  }
}
Example #20
0
void CDbUrl::AddOptions(const std::string &options)
{
  CUrlOptions::AddOptions(options);
  updateOptions();  
}