Exemplo n.º 1
0
    ui->partConditionTableView->horizontalHeader()->setResizeMode(PartConditionModel::ColumnDefault, QHeaderView::Fixed);
#endif
    _partConditionModel->select();
}

void OptionsDialog::setupConnections()
{
    connect(ui->pageSelectionWidget, SIGNAL(currentRowChanged(int)), this, SLOT(slotCurrentPageChanged(int)));

    QPushButton * applyButton = ui->buttonBox->button(QDialogButtonBox::Apply);
    connect(applyButton, SIGNAL(clicked()), this, SLOT(slotApplyChanges()));
    connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    connect(ui->makeUnitDefaultButton, SIGNAL(clicked()), this, SLOT(slotMakeCurrentUnitDefault()));
    connect(ui->partUnitsTableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),this, SLOT(slotUnitSelectionChanged(QItemSelection,QItemSelection)));
    connect(ui->partUnitsTableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(slotUnitDoubleClick(QModelIndex)));
    connect(_partUnitsModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(slotDataChanged()));    
    connect(ui->partUnitsTableView->itemDelegate(), SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)), this,SLOT(slotClosePartUnitEditor(QWidget*,QAbstractItemDelegate::EndEditHint)));

    connect(ui->addUnitButton, SIGNAL(clicked()), this, SLOT(slotAddUnit()));
    connect(ui->deleteUnitButton, SIGNAL(clicked()), this, SLOT(slotDeleteUnit()));

    connect(ui->paramUnitsTableView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(slotParamUnitRowChanged(QModelIndex,QModelIndex)));
    connect(_parameterUnitsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(slotDataChanged()));
    connect(ui->addParamUnitButton, SIGNAL(clicked()), this, SLOT(slotAddParamUnit()));
    connect(ui->deleteParamUnitButton, SIGNAL(clicked()), this, SLOT(slotDeleteParamUnit()));

    connect(ui->partConditionTableView->selectionModel(), SIGNAL(currentColumnChanged(QModelIndex,QModelIndex)), this, SLOT(slotPartConditionRowChanged(QModelIndex,QModelIndex)));
    connect(_partConditionModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(slotDataChanged()));
    connect(ui->addConditionButton, SIGNAL(clicked()), this, SLOT(slotAddPartCondition()));
Exemplo n.º 2
0
QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowFlags flags )
    : QDialog( parent, flags )
    , mDock( 0 )
    , mLayer( theLayer )
    , mRubberBand( 0 )
    , mCurrentSearchWidgetWrapper( 0 )
{
  setupUi( this );

  // Fix selection color on loosing focus (Windows)
  setStyleSheet( QgisApp::instance()->styleSheet() );

  setAttribute( Qt::WA_DeleteOnClose );

  QSettings settings;

  // Initialize the window geometry
  restoreGeometry( settings.value( "/Windows/BetterAttributeTable/geometry" ).toByteArray() );

  QgsAttributeEditorContext context;

  myDa = new QgsDistanceArea();

  myDa->setSourceCrs( mLayer->crs() );
  myDa->setEllipsoidalMode( QgisApp::instance()->mapCanvas()->mapSettings().hasCrsTransformEnabled() );
  myDa->setEllipsoid( QgsProject::instance()->readEntry( "Measure", "/Ellipsoid", GEO_NONE ) );

  context.setDistanceArea( *myDa );
  context.setVectorLayerTools( QgisApp::instance()->vectorLayerTools() );

  QgsFeatureRequest r;
  if ( mLayer->geometryType() != QGis::NoGeometry &&
       settings.value( "/qgis/attributeTableBehaviour", QgsAttributeTableFilterModel::ShowAll ).toInt() == QgsAttributeTableFilterModel::ShowVisible )
  {
    QgsMapCanvas *mc = QgisApp::instance()->mapCanvas();
    QgsRectangle extent( mc->mapSettings().mapToLayerCoordinates( theLayer, mc->extent() ) );
    r.setFilterRect( extent );

    QgsGeometry *g = QgsGeometry::fromRect( extent );
    mRubberBand = new QgsRubberBand( mc, true );
    mRubberBand->setToGeometry( g, theLayer );
    delete g;

    mActionShowAllFilter->setText( tr( "Show All Features In Initial Canvas Extent" ) );
  }

  // Initialize dual view
  mMainView->init( mLayer, QgisApp::instance()->mapCanvas(), r, context );

  // Initialize filter gui elements
  mFilterActionMapper = new QSignalMapper( this );
  mFilterColumnsMenu = new QMenu( this );
  mActionFilterColumnsMenu->setMenu( mFilterColumnsMenu );
  mApplyFilterButton->setDefaultAction( mActionApplyFilter );

  // Set filter icon in a couple of places
  QIcon filterIcon = QgsApplication::getThemeIcon( "/mActionFilter.svg" );
  mActionShowAllFilter->setIcon( filterIcon );
  mActionAdvancedFilter->setIcon( filterIcon );
  mActionSelectedFilter->setIcon( filterIcon );
  mActionVisibleFilter->setIcon( filterIcon );
  mActionEditedFilter->setIcon( filterIcon );

  // Connect filter signals
  connect( mActionAdvancedFilter, SIGNAL( triggered() ), SLOT( filterExpressionBuilder() ) );
  connect( mActionShowAllFilter, SIGNAL( triggered() ), SLOT( filterShowAll() ) );
  connect( mActionSelectedFilter, SIGNAL( triggered() ), SLOT( filterSelected() ) );
  connect( mActionVisibleFilter, SIGNAL( triggered() ), SLOT( filterVisible() ) );
  connect( mActionEditedFilter, SIGNAL( triggered() ), SLOT( filterEdited() ) );
  connect( mFilterActionMapper, SIGNAL( mapped( QObject* ) ), SLOT( filterColumnChanged( QObject* ) ) );
  connect( mFilterQuery, SIGNAL( returnPressed() ), SLOT( filterQueryAccepted() ) );
  connect( mActionApplyFilter, SIGNAL( triggered() ), SLOT( filterQueryAccepted() ) );
  connect( mSetStyles, SIGNAL( pressed() ), SLOT( openConditionalStyles() ) );

  // info from layer to table
  connect( mLayer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) );
  connect( mLayer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) );
  connect( mLayer, SIGNAL( layerDeleted() ), this, SLOT( close() ) );
  connect( mLayer, SIGNAL( selectionChanged() ), this, SLOT( updateTitle() ) );
  connect( mLayer, SIGNAL( featureAdded( QgsFeatureId ) ), this, SLOT( updateTitle() ) );
  connect( mLayer, SIGNAL( featuresDeleted( QgsFeatureIds ) ), this, SLOT( updateTitle() ) );
  connect( mLayer, SIGNAL( attributeAdded( int ) ), this, SLOT( columnBoxInit() ) );
  connect( mLayer, SIGNAL( attributeDeleted( int ) ), this, SLOT( columnBoxInit() ) );

  // connect table info to window
  connect( mMainView, SIGNAL( filterChanged() ), this, SLOT( updateTitle() ) );

  // info from table to application
  connect( this, SIGNAL( saveEdits( QgsMapLayer * ) ), QgisApp::instance(), SLOT( saveEdits( QgsMapLayer * ) ) );

  bool myDockFlag = settings.value( "/qgis/dockAttributeTable", false ).toBool();
  if ( myDockFlag )
  {
    mDock = new QgsAttributeTableDock( tr( "Attribute table - %1 (%n Feature(s))", "feature count", mMainView->featureCount() ).arg( mLayer->name() ), QgisApp::instance() );
    mDock->setAllowedAreas( Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea );
    mDock->setWidget( this );
    connect( this, SIGNAL( destroyed() ), mDock, SLOT( close() ) );
    QgisApp::instance()->addDockWidget( Qt::BottomDockWidgetArea, mDock );
  }

  columnBoxInit();
  updateTitle();

  mRemoveSelectionButton->setIcon( QgsApplication::getThemeIcon( "/mActionUnselectAttributes.png" ) );
  mSelectedToTopButton->setIcon( QgsApplication::getThemeIcon( "/mActionSelectedToTop.png" ) );
  mCopySelectedRowsButton->setIcon( QgsApplication::getThemeIcon( "/mActionCopySelected.png" ) );
  mZoomMapToSelectedRowsButton->setIcon( QgsApplication::getThemeIcon( "/mActionZoomToSelected.svg" ) );
  mPanMapToSelectedRowsButton->setIcon( QgsApplication::getThemeIcon( "/mActionPanToSelected.svg" ) );
  mInvertSelectionButton->setIcon( QgsApplication::getThemeIcon( "/mActionInvertSelection.png" ) );
  mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( "/mActionToggleEditing.svg" ) );
  mSaveEditsButton->setIcon( QgsApplication::getThemeIcon( "/mActionSaveEdits.svg" ) );
  mDeleteSelectedButton->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteSelected.svg" ) );
  mOpenFieldCalculator->setIcon( QgsApplication::getThemeIcon( "/mActionCalculateField.png" ) );
  mAddAttribute->setIcon( QgsApplication::getThemeIcon( "/mActionNewAttribute.png" ) );
  mRemoveAttribute->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteAttribute.png" ) );
  mTableViewButton->setIcon( QgsApplication::getThemeIcon( "/mActionOpenTable.png" ) );
  mAttributeViewButton->setIcon( QgsApplication::getThemeIcon( "/mActionPropertyItem.png" ) );
  mExpressionSelectButton->setIcon( QgsApplication::getThemeIcon( "/mIconExpressionSelect.svg" ) );
  mAddFeature->setIcon( QgsApplication::getThemeIcon( "/mActionNewTableRow.png" ) );

  // toggle editing
  bool canChangeAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::ChangeAttributeValues;
  bool canDeleteFeatures = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteFeatures;
  bool canAddAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::AddAttributes;
  bool canDeleteAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteAttributes;
  bool canAddFeatures = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::AddFeatures;

  mToggleEditingButton->blockSignals( true );
  mToggleEditingButton->setCheckable( true );
  mToggleEditingButton->setChecked( mLayer->isEditable() );
  mToggleEditingButton->setEnabled(( canChangeAttributes || canDeleteFeatures || canAddAttributes || canDeleteAttributes || canAddFeatures ) && !mLayer->isReadOnly() );
  mToggleEditingButton->blockSignals( false );

  mSaveEditsButton->setEnabled( mToggleEditingButton->isEnabled() && mLayer->isEditable() );
  mAddAttribute->setEnabled(( canChangeAttributes || canAddAttributes ) && mLayer->isEditable() );
  mDeleteSelectedButton->setEnabled( canDeleteFeatures && mLayer->isEditable() );
  mAddFeature->setEnabled( canAddFeatures && mLayer->isEditable() && mLayer->geometryType() == QGis::NoGeometry );
  mAddFeature->setHidden( !canAddFeatures || mLayer->geometryType() != QGis::NoGeometry );

  mMainViewButtonGroup->setId( mTableViewButton, QgsDualView::AttributeTable );
  mMainViewButtonGroup->setId( mAttributeViewButton, QgsDualView::AttributeEditor );

  // Load default attribute table filter
  QgsAttributeTableFilterModel::FilterMode defaultFilterMode = ( QgsAttributeTableFilterModel::FilterMode ) settings.value( "/qgis/attributeTableBehaviour", QgsAttributeTableFilterModel::ShowAll ).toInt();

  switch ( defaultFilterMode )
  {
    case QgsAttributeTableFilterModel::ShowVisible:
      filterVisible();
      break;

    case QgsAttributeTableFilterModel::ShowSelected:
      filterSelected();
      break;

    case QgsAttributeTableFilterModel::ShowAll:
    default:
      filterShowAll();
      break;
  }

  mUpdateExpressionText->registerGetExpressionContextCallback( &_getExpressionContext, mLayer );

  mFieldModel = new QgsFieldModel();
  mFieldModel->setLayer( mLayer );
  mFieldCombo->setModel( mFieldModel );
  connect( mRunFieldCalc, SIGNAL( clicked() ), this, SLOT( updateFieldFromExpression() ) );
  connect( mRunFieldCalcSelected, SIGNAL( clicked() ), this, SLOT( updateFieldFromExpressionSelected() ) );
  // NW TODO Fix in 2.6 - Doesn't work with field model for some reason.
//  connect( mUpdateExpressionText, SIGNAL( returnPressed() ), this, SLOT( updateFieldFromExpression() ) );
  connect( mUpdateExpressionText, SIGNAL( fieldChanged( QString, bool ) ), this, SLOT( updateButtonStatus( QString, bool ) ) );
  mUpdateExpressionText->setLayer( mLayer );
  mUpdateExpressionText->setLeftHandButtonStyle( true );
  editingToggled();
}
Exemplo n.º 3
0
void TimelineDock::restoreSelection()
{
    m_selection = m_savedSelection;
    emit selectionChanged();
    emitSelectedFromSelection();
}
Exemplo n.º 4
0
// Initialize the dialog widgets and connect the signals/slots
void SearchDialog::createDialogContent()
{
	ui->setupUi(dialog);
	connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
	connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
	connect(ui->lineEditSearchSkyObject, SIGNAL(textChanged(const QString&)),
		this, SLOT(onSearchTextChanged(const QString&)));
	connect(ui->pushButtonGotoSearchSkyObject, SIGNAL(clicked()), this, SLOT(gotoObject()));
	onSearchTextChanged(ui->lineEditSearchSkyObject->text());
	connect(ui->lineEditSearchSkyObject, SIGNAL(returnPressed()), this, SLOT(gotoObject()));
	connect(ui->lineEditSearchSkyObject, SIGNAL(selectionChanged()), this, SLOT(setHasSelectedFlag()));
	connect(ui->lineEditSearchSkyObject, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));

	ui->lineEditSearchSkyObject->installEventFilter(this);	

#ifdef Q_OS_WIN
	//Kinetic scrolling for tablet pc and pc
	QList<QWidget *> addscroll;
	addscroll << ui->objectsListWidget;
	installKineticScrolling(addscroll);
#endif

	populateCoordinateSystemsList();
	populateCoordinateAxis();
	int idx = ui->coordinateSystemComboBox->findData(getCurrentCoordinateSystemKey(), Qt::UserRole, Qt::MatchCaseSensitive);
	if (idx==-1)
	{
		// Use equatorialJ2000 as default
		idx = ui->coordinateSystemComboBox->findData(QVariant("equatorialJ2000"), Qt::UserRole, Qt::MatchCaseSensitive);
	}
	ui->coordinateSystemComboBox->setCurrentIndex(idx);
	connect(ui->coordinateSystemComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setCoordinateSystem(int)));
	connect(ui->AxisXSpinBox, SIGNAL(valueChanged()), this, SLOT(manualPositionChanged()));
	connect(ui->AxisYSpinBox, SIGNAL(valueChanged()), this, SLOT(manualPositionChanged()));
    
	connect(ui->alphaPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->betaPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->gammaPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->deltaPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->epsilonPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->zetaPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->etaPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->thetaPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->iotaPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->kappaPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->lambdaPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->muPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->nuPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->xiPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->omicronPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->piPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->rhoPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->sigmaPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->tauPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->upsilonPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->phiPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->chiPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->psiPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
	connect(ui->omegaPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));

	connect(ui->checkBoxUseSimbad, SIGNAL(clicked(bool)), this, SLOT(enableSimbadSearch(bool)));
	ui->checkBoxUseSimbad->setChecked(useSimbad);

	populateSimbadServerList();
	idx = ui->serverListComboBox->findData(simbadServerUrl, Qt::UserRole, Qt::MatchCaseSensitive);
	if (idx==-1)
	{
		// Use University of Strasbourg as default
		idx = ui->serverListComboBox->findData(QVariant(DEF_SIMBAD_URL), Qt::UserRole, Qt::MatchCaseSensitive);
	}
	ui->serverListComboBox->setCurrentIndex(idx);
	connect(ui->serverListComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectSimbadServer(int)));

	connect(ui->checkBoxUseStartOfWords, SIGNAL(clicked(bool)), this, SLOT(enableStartOfWordsAutofill(bool)));
	ui->checkBoxUseStartOfWords->setChecked(useStartOfWords);

	// list views initialization
	connect(ui->objectTypeComboBox, SIGNAL(activated(int)), this, SLOT(updateListWidget(int)));
	connect(ui->searchInListLineEdit, SIGNAL(textChanged(QString)), this, SLOT(searchListChanged(QString)));
	connect(ui->searchInEnglishCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateListTab()));
	connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateListTab()));
	updateListTab();

	// Set the focus directly on the line edit
	if (ui->lineEditSearchSkyObject->isEnabled())
		ui->lineEditSearchSkyObject->setFocus();
}
Exemplo n.º 5
0
QgsCompoundColorWidget::QgsCompoundColorWidget( QWidget *parent, const QColor& color, Layout widgetLayout )
    : QgsPanelWidget( parent )
    , mAllowAlpha( true )
    , mLastCustomColorIndex( 0 )
    , mPickingColor( false )
{
  setupUi( this );

  if ( widgetLayout == LayoutVertical )
  {
    // shuffle stuff around
    QVBoxLayout* newLayout = new QVBoxLayout();
    newLayout->addWidget( mTabWidget );
    newLayout->addWidget( mSlidersWidget );
    newLayout->addWidget( mPreviewWidget );
    newLayout->addWidget( mSwatchesWidget );
    delete layout();
    setLayout( newLayout );
  }

  QSettings settings;

  mSchemeList->header()->hide();
  mSchemeList->setColumnWidth( 0, 44 );

  //get schemes with ShowInColorDialog set
  refreshSchemeComboBox();
  QList<QgsColorScheme *> schemeList = QgsColorSchemeRegistry::instance()->schemes( QgsColorScheme::ShowInColorDialog );

  //choose a reasonable starting scheme
  int activeScheme = settings.value( "/Windows/ColorDialog/activeScheme", 0 ).toInt();
  activeScheme = activeScheme >= mSchemeComboBox->count() ? 0 : activeScheme;

  mSchemeList->setScheme( schemeList.at( activeScheme ) );

  mSchemeComboBox->setCurrentIndex( activeScheme );
  updateActionsForCurrentScheme();

  //listen out for selection changes in list, so we can enable/disable the copy colors option
  connect( mSchemeList->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), this, SLOT( listSelectionChanged( QItemSelection, QItemSelection ) ) );
  //copy action defaults to disabled
  mActionCopyColors->setEnabled( false );

  connect( mActionCopyColors, SIGNAL( triggered() ), mSchemeList, SLOT( copyColors() ) );
  connect( mActionPasteColors, SIGNAL( triggered() ), mSchemeList, SLOT( pasteColors() ) );
  connect( mActionExportColors, SIGNAL( triggered() ), this, SLOT( exportColors() ) );
  connect( mActionImportColors, SIGNAL( triggered() ), this, SLOT( importColors() ) );
  connect( mActionImportPalette, SIGNAL( triggered() ), this, SLOT( importPalette() ) );
  connect( mActionRemovePalette, SIGNAL( triggered() ), this, SLOT( removePalette() ) );
  connect( mActionNewPalette, SIGNAL( triggered() ), this, SLOT( newPalette() ) );
  connect( mRemoveColorsFromSchemeButton, SIGNAL( clicked() ), mSchemeList, SLOT( removeSelection() ) );

  QMenu* schemeMenu = new QMenu( mSchemeToolButton );
  schemeMenu->addAction( mActionCopyColors );
  schemeMenu->addAction( mActionPasteColors );
  schemeMenu->addSeparator();
  schemeMenu->addAction( mActionImportColors );
  schemeMenu->addAction( mActionExportColors );
  schemeMenu->addSeparator();
  schemeMenu->addAction( mActionNewPalette );
  schemeMenu->addAction( mActionImportPalette );
  schemeMenu->addAction( mActionRemovePalette );
  schemeMenu->addAction( mActionShowInButtons );
  mSchemeToolButton->setMenu( schemeMenu );

  connect( mSchemeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( schemeIndexChanged( int ) ) );
  connect( mSchemeList, SIGNAL( colorSelected( QColor ) ), this, SLOT( setColor( QColor ) ) );

  mOldColorLabel->hide();

  mVerticalRamp->setOrientation( QgsColorRampWidget::Vertical );
  mVerticalRamp->setInteriorMargin( 2 );
  mVerticalRamp->setShowFrame( true );

  mRedSlider->setComponent( QgsColorWidget::Red );
  mGreenSlider->setComponent( QgsColorWidget::Green );
  mBlueSlider->setComponent( QgsColorWidget::Blue );
  mHueSlider->setComponent( QgsColorWidget::Hue );
  mSaturationSlider->setComponent( QgsColorWidget::Saturation );
  mValueSlider->setComponent( QgsColorWidget::Value );
  mAlphaSlider->setComponent( QgsColorWidget::Alpha );

  mSwatchButton1->setShowMenu( false );
  mSwatchButton1->setBehaviour( QgsColorButton::SignalOnly );
  mSwatchButton2->setShowMenu( false );
  mSwatchButton2->setBehaviour( QgsColorButton::SignalOnly );
  mSwatchButton3->setShowMenu( false );
  mSwatchButton3->setBehaviour( QgsColorButton::SignalOnly );
  mSwatchButton4->setShowMenu( false );
  mSwatchButton4->setBehaviour( QgsColorButton::SignalOnly );
  mSwatchButton5->setShowMenu( false );
  mSwatchButton5->setBehaviour( QgsColorButton::SignalOnly );
  mSwatchButton6->setShowMenu( false );
  mSwatchButton6->setBehaviour( QgsColorButton::SignalOnly );
  mSwatchButton7->setShowMenu( false );
  mSwatchButton7->setBehaviour( QgsColorButton::SignalOnly );
  mSwatchButton8->setShowMenu( false );
  mSwatchButton8->setBehaviour( QgsColorButton::SignalOnly );
  mSwatchButton9->setShowMenu( false );
  mSwatchButton9->setBehaviour( QgsColorButton::SignalOnly );
  mSwatchButton10->setShowMenu( false );
  mSwatchButton10->setBehaviour( QgsColorButton::SignalOnly );
  mSwatchButton11->setShowMenu( false );
  mSwatchButton11->setBehaviour( QgsColorButton::SignalOnly );
  mSwatchButton12->setShowMenu( false );
  mSwatchButton12->setBehaviour( QgsColorButton::SignalOnly );
  mSwatchButton13->setShowMenu( false );
  mSwatchButton13->setBehaviour( QgsColorButton::SignalOnly );
  mSwatchButton14->setShowMenu( false );
  mSwatchButton14->setBehaviour( QgsColorButton::SignalOnly );
  mSwatchButton15->setShowMenu( false );
  mSwatchButton15->setBehaviour( QgsColorButton::SignalOnly );
  mSwatchButton16->setShowMenu( false );
  mSwatchButton16->setBehaviour( QgsColorButton::SignalOnly );
  //restore custom colors
  mSwatchButton1->setColor( settings.value( "/Windows/ColorDialog/customColor1", QVariant( QColor() ) ).value<QColor>() );
  mSwatchButton2->setColor( settings.value( "/Windows/ColorDialog/customColor2", QVariant( QColor() ) ).value<QColor>() );
  mSwatchButton3->setColor( settings.value( "/Windows/ColorDialog/customColor3", QVariant( QColor() ) ).value<QColor>() );
  mSwatchButton4->setColor( settings.value( "/Windows/ColorDialog/customColor4", QVariant( QColor() ) ).value<QColor>() );
  mSwatchButton5->setColor( settings.value( "/Windows/ColorDialog/customColor5", QVariant( QColor() ) ).value<QColor>() );
  mSwatchButton6->setColor( settings.value( "/Windows/ColorDialog/customColor6", QVariant( QColor() ) ).value<QColor>() );
  mSwatchButton7->setColor( settings.value( "/Windows/ColorDialog/customColor7", QVariant( QColor() ) ).value<QColor>() );
  mSwatchButton8->setColor( settings.value( "/Windows/ColorDialog/customColor8", QVariant( QColor() ) ).value<QColor>() );
  mSwatchButton9->setColor( settings.value( "/Windows/ColorDialog/customColor9", QVariant( QColor() ) ).value<QColor>() );
  mSwatchButton10->setColor( settings.value( "/Windows/ColorDialog/customColor10", QVariant( QColor() ) ).value<QColor>() );
  mSwatchButton11->setColor( settings.value( "/Windows/ColorDialog/customColor11", QVariant( QColor() ) ).value<QColor>() );
  mSwatchButton12->setColor( settings.value( "/Windows/ColorDialog/customColor12", QVariant( QColor() ) ).value<QColor>() );
  mSwatchButton13->setColor( settings.value( "/Windows/ColorDialog/customColor13", QVariant( QColor() ) ).value<QColor>() );
  mSwatchButton14->setColor( settings.value( "/Windows/ColorDialog/customColor14", QVariant( QColor() ) ).value<QColor>() );
  mSwatchButton15->setColor( settings.value( "/Windows/ColorDialog/customColor15", QVariant( QColor() ) ).value<QColor>() );
  mSwatchButton16->setColor( settings.value( "/Windows/ColorDialog/customColor16", QVariant( QColor() ) ).value<QColor>() );

  //restore sample radius
  mSpinBoxRadius->setValue( settings.value( "/Windows/ColorDialog/sampleRadius", 1 ).toInt() );
  mSamplePreview->setColor( QColor() );

  if ( color.isValid() )
  {
    setColor( color );
  }

  //restore active component radio button
  int activeRadio = settings.value( "/Windows/ColorDialog/activeComponent", 2 ).toInt();
  switch ( activeRadio )
  {
    case 0:
      mHueRadio->setChecked( true );
      break;
    case 1:
      mSaturationRadio->setChecked( true );
      break;
    case 2:
      mValueRadio->setChecked( true );
      break;
    case 3:
      mRedRadio->setChecked( true );
      break;
    case 4:
      mGreenRadio->setChecked( true );
      break;
    case 5:
      mBlueRadio->setChecked( true );
      break;
  }
  int currentTab = settings.value( "/Windows/ColorDialog/activeTab", 0 ).toInt();
  mTabWidget->setCurrentIndex( currentTab );

#ifdef Q_OS_MAC
  //disable color picker tab for OSX, as it is impossible to grab the mouse under OSX
  //see note for QWidget::grabMouse() re OSX Cocoa
  //http://qt-project.org/doc/qt-4.8/qwidget.html#grabMouse
  mTabWidget->removeTab( 3 );
#endif

  //setup connections
  connect( mColorBox, SIGNAL( colorChanged( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mColorWheel, SIGNAL( colorChanged( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mColorText, SIGNAL( colorChanged( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mVerticalRamp, SIGNAL( colorChanged( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mRedSlider, SIGNAL( colorChanged( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mGreenSlider, SIGNAL( colorChanged( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mBlueSlider, SIGNAL( colorChanged( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mHueSlider, SIGNAL( colorChanged( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mValueSlider, SIGNAL( colorChanged( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSaturationSlider, SIGNAL( colorChanged( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mAlphaSlider, SIGNAL( colorChanged( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mColorPreview, SIGNAL( colorChanged( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton1, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton2, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton3, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton4, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton5, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton6, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton7, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton8, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton9, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton10, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton11, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton12, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton13, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton14, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton15, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
  connect( mSwatchButton16, SIGNAL( colorClicked( QColor ) ), this, SLOT( setColor( QColor ) ) );
}
Exemplo n.º 6
0
void WSpacePlot::setMultiSelect(bool b) {
  multiSelect=b;
  clearSelection();
  emit selectionChanged();
}
Exemplo n.º 7
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    db(new Database("samplicity.db")),
    directoriesModel(new DirectoriesModel(*db)),
    samplesModel(new SamplesModel(*db)),
    tagsModel(new TagsModel(*db)),
    audioPlayer(new AudioPlayer),
    settings(Settings::getSettings()),
    writeSampleTags(true)
{
    ui->setupUi(this);

    // Initialize default values
    settings->value(LOOP_PLAYBACK, false);
    settings->value(DYNAMIC_SORTING, false);
    settings->value(VOLUME, 99);

    auto tagMode = settings->value("tagMode", TagMode::Filter).toInt();
    ui->filterRadioButton->setChecked(tagMode == TagMode::Filter);
    ui->applyRadioButton->setChecked(tagMode == TagMode::Apply);
    ui->tagMode->setId(ui->filterRadioButton, TagMode::Filter);
    ui->tagMode->setId(ui->applyRadioButton, TagMode::Apply);

    undoStack = new QUndoStack(this);
    // auto undoView = new QUndoView(undoStack);
    // undoView->show();

    ui->menuEdit->insertAction(ui->actionTags, undoStack->createUndoAction(this));
    ui->menuEdit->insertAction(ui->actionTags, undoStack->createRedoAction(this));

    ui->dirsTreeView->setModel(directoriesModel);

    // When you change the directory selection, refilter the samples
    QObject::connect(
        ui->dirsTreeView->selectionModel(),
        SIGNAL(selectionChanged(QItemSelection const&, QItemSelection const&)),
        this,
        SLOT(directorySelectionChanged(QItemSelection const&, QItemSelection const&))
        );

//    ui->samplesTreeView->setModel(samplesModel);
    samplesProxyModel.setSourceModel(samplesModel);
    samplesProxyModel.setSortCaseSensitivity(Qt::CaseInsensitive);
    samplesProxyModel.sort(0, Qt::AscendingOrder);
    samplesProxyModel.setDynamicSortFilter(settings->value(DYNAMIC_SORTING).toBool());
    ui->samplesTreeView->setModel(&samplesProxyModel);
    ui->samplesTreeView->setSortingEnabled(true);
    auto modelTest = new ModelTest(samplesModel, this);

    // Make it such that when any directories/files are added or changed,
    // the samples view is refreshed
    QObject::connect(
        directoriesModel,
        SIGNAL(modelReset()),
        samplesModel,
        SLOT(reset()));

    QObject::connect(
        ui->samplesTreeView->selectionModel(),
        SIGNAL(currentChanged(QModelIndex,QModelIndex)),
        this,
        SLOT(sampleSelectionChanged(QModelIndex, QModelIndex))
        );

    ui->tagsTreeView->setModel(tagsModel);
//    tagsProxyModel.setSourceModel(tagsModel);
//    tagsProxyModel.setSortCaseSensitivity(Qt::CaseInsensitive);
//    ui->tagsTreeView->setModel(&tagsProxyModel);
//    ui->tagsTreeView->setSortingEnabled(true);
//    tagsProxyModel.sort(0, Qt::AscendingOrder);
    // auto modelTest = new ModelTest(tagsModel, this);

    QObject::connect(
                ui->filterRadioButton,
                SIGNAL(toggled(bool)),
                this,
                SLOT(tagModeToggled(bool))
                );
    QObject::connect(
                ui->applyRadioButton,
                SIGNAL(toggled(bool)),
                this,
                SLOT(tagModeToggled(bool))
                );

    // When tags selections are changed, we need to apply/filter
    QObject::connect(
                ui->tagsTreeView->selectionModel(),
                SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
                this,
                SLOT(tagSelectionChanged(QItemSelection,QItemSelection))
                );

    restoreGeometry(settings->value("geometry").toByteArray());
    restoreState(settings->value("windowState").toByteArray());
    ui->samplesTreeView->header()->restoreState(settings->value("samplesTreeViewState").toByteArray());

    // Change volume in audio player
    QObject::connect(
                ui->volumeSlider,
                SIGNAL(valueChanged(int)),
                audioPlayer,
                SLOT(setVolume(int))
                );

    // Default settings
    ui->actionLoop_Playback->setChecked(settings->value(LOOP_PLAYBACK).toBool());
    ui->actionDynamic_Sorting->setChecked(settings->value(DYNAMIC_SORTING).toBool());
    ui->volumeSlider->setValue(settings->value(VOLUME).toInt());
}
void ScreenWindow::clearSelection()
{
    _screen->clearSelection();

    emit selectionChanged();
}
Exemplo n.º 9
0
KMConfigFonts::KMConfigFonts(TQWidget *parent, const char *name)
: KMConfigPage(parent, name)
{
	setPageName(i18n("Fonts"));
	setPageHeader(i18n("Font Settings"));
	setPagePixmap("fonts");

	TQGroupBox	*box = new TQGroupBox(0, Qt::Vertical, i18n("Fonts Embedding"), this);
	TQGroupBox	*box2 = new TQGroupBox(0, Qt::Vertical, i18n("Fonts Path"), this);

	m_embedfonts = new TQCheckBox(i18n("&Embed fonts in PostScript data when printing"), box);
	m_fontpath = new TDEListView(box2);
	m_fontpath->addColumn("");
	m_fontpath->header()->setStretchEnabled(true, 0);
	m_fontpath->header()->hide();
	m_fontpath->setSorting(-1);
	m_addpath = new KURLRequester(box2);
	m_addpath->setMode(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly);
	m_up = new KPushButton(KGuiItem(i18n("&Up"), "up"), box2);
	m_down = new KPushButton(KGuiItem(i18n("&Down"), "down"), box2);
	m_add = new KPushButton(KGuiItem(i18n("&Add"), "add"), box2);
	m_remove = new KPushButton(KGuiItem(i18n("&Remove"), "editdelete"), box2);
	TQLabel	*lab0 = new TQLabel(i18n("Additional director&y:"), box2);
	lab0->setBuddy(m_addpath);

	TQVBoxLayout	*l0 = new TQVBoxLayout(TQT_TQLAYOUT(box->layout()), KDialog::spacingHint());
	l0->addWidget(m_embedfonts);
	TQVBoxLayout	*l1 = new TQVBoxLayout(TQT_TQLAYOUT(box2->layout()), KDialog::spacingHint());
	l1->addWidget(m_fontpath);
	TQHBoxLayout	*l2 = new TQHBoxLayout(0, 0, KDialog::spacingHint());
	l1->addLayout(l2);
	l2->addWidget(m_up);
	l2->addWidget(m_down);
	l2->addWidget(m_remove);
	l1->addSpacing(10);
	l1->addWidget(lab0);
	l1->addWidget(m_addpath);
	TQHBoxLayout	*l3 = new TQHBoxLayout(0, 0, KDialog::spacingHint());
	l1->addLayout(l3);
	l3->addStretch(1);
	l3->addWidget(m_add);
	TQVBoxLayout	*l4 = new TQVBoxLayout(this, 0, KDialog::spacingHint());
	l4->addWidget(box);
	l4->addWidget(box2);

	TQWhatsThis::add(m_embedfonts,
			i18n("These options will automatically put fonts in the PostScript file "
                             "which are not present on the printer. Font embedding usually produces better print results "
			     "(closer to what you see on the screen), but larger print data as well."));
	TQWhatsThis::add(m_fontpath, 
			i18n("When using font embedding you can select additional directories where "
			     "KDE should search for embeddable font files. By default, the X server "
			     "font path is used, so adding those directories is not needed. The default "
			     "search path should be sufficient in most cases."));

	connect(m_remove, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemove()));
	connect(m_add, TQT_SIGNAL(clicked()), TQT_SLOT(slotAdd()));
	connect(m_up, TQT_SIGNAL(clicked()), TQT_SLOT(slotUp()));
	connect(m_down, TQT_SIGNAL(clicked()), TQT_SLOT(slotDown()));
	connect(m_fontpath, TQT_SIGNAL(selectionChanged()), TQT_SLOT(slotSelected()));
	connect(m_addpath, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotTextChanged(const TQString&)));
	m_add->setEnabled(false);
	m_remove->setEnabled(false);
	m_up->setEnabled(false);
	m_down->setEnabled(false);
}
Exemplo n.º 10
0
dtkComposerScene::dtkComposerScene(QObject *parent) : QGraphicsScene(parent), d(new dtkComposerScenePrivate)
{
    d->factory = NULL;
    d->stack = NULL;
    d->graph = NULL;

    // BspTreeIndex causes some bugs with (at least) "enter group"
    setItemIndexMethod( QGraphicsScene::NoIndex);

    d->root_node = new dtkComposerSceneNodeComposite;
    d->root_node->setRoot(true);
    d->root_node->setTitle("Root");

    d->current_node = d->root_node;
    d->current_edge = NULL;

    d->reparent_origin = NULL;
    d->reparent_target = NULL;

    d->masked_edges = false;

    d->mask_edges_action = new QAction("Mask Edges", this);
    d->mask_edges_action->setShortcut(QKeySequence(Qt::ControlModifier  + Qt::Key_M));

    d->unmask_edges_action = new QAction("Unmask Edges", this);
    d->unmask_edges_action->setShortcut(QKeySequence(Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_M));

    d->flag_as_blue_action = new QAction("Flag as blue", this);
    d->flag_as_blue_action->setShortcut(QKeySequence(Qt::ControlModifier + Qt::AltModifier + Qt::ShiftModifier + Qt::Key_B));
    d->flag_as_blue_action->setIcon(QIcon(":dtkComposer/dtkComposerNodeFlag-blue.png"));

    d->flag_as_gray_action = new QAction("Flag as gray", this);
    d->flag_as_gray_action->setShortcut(QKeySequence(Qt::ControlModifier + Qt::AltModifier + Qt::ShiftModifier + Qt::Key_W));
    d->flag_as_gray_action->setIcon(QIcon(":dtkComposer/dtkComposerNodeFlag-gray.png"));

    d->flag_as_green_action = new QAction("Flag as green", this);
    d->flag_as_green_action->setShortcut(QKeySequence(Qt::ControlModifier + Qt::AltModifier + Qt::ShiftModifier + Qt::Key_G));
    d->flag_as_green_action->setIcon(QIcon(":dtkComposer/dtkComposerNodeFlag-green.png"));

    d->flag_as_orange_action = new QAction("Flag as orange", this);
    d->flag_as_orange_action->setShortcut(QKeySequence(Qt::ControlModifier + Qt::AltModifier + Qt::ShiftModifier + Qt::Key_O));
    d->flag_as_orange_action->setIcon(QIcon(":dtkComposer/dtkComposerNodeFlag-orange.png"));

    d->flag_as_pink_action = new QAction("Flag as pink", this);
    d->flag_as_pink_action->setShortcut(QKeySequence(Qt::ControlModifier + Qt::AltModifier + Qt::ShiftModifier + Qt::Key_P));
    d->flag_as_pink_action->setIcon(QIcon(":dtkComposer/dtkComposerNodeFlag-pink.png"));

    d->flag_as_red_action = new QAction("Flag as red", this);
    d->flag_as_red_action->setShortcut(QKeySequence(Qt::ControlModifier + Qt::AltModifier + Qt::ShiftModifier + Qt::Key_R));
    d->flag_as_red_action->setIcon(QIcon(":dtkComposer/dtkComposerNodeFlag-red.png"));

    d->flag_as_yellow_action = new QAction("Flag as yellow", this);
    d->flag_as_yellow_action->setShortcut(QKeySequence(Qt::ControlModifier + Qt::AltModifier + Qt::ShiftModifier + Qt::Key_Y));
    d->flag_as_yellow_action->setIcon(QIcon(":dtkComposer/dtkComposerNodeFlag-yellow.png"));

    connect(this, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));

    connect(d->mask_edges_action, SIGNAL(triggered()), this, SLOT(onMaskEdge()));
    connect(d->unmask_edges_action, SIGNAL(triggered()), this, SLOT(onUnMaskEdge()));

    connect(d->flag_as_blue_action, SIGNAL(triggered()), this, SLOT(onFlagAsBlue()));
    connect(d->flag_as_gray_action, SIGNAL(triggered()), this, SLOT(onFlagAsGray()));
    connect(d->flag_as_green_action, SIGNAL(triggered()), this, SLOT(onFlagAsGreen()));
    connect(d->flag_as_orange_action, SIGNAL(triggered()), this, SLOT(onFlagAsOrange()));
    connect(d->flag_as_pink_action, SIGNAL(triggered()), this, SLOT(onFlagAsPink()));
    connect(d->flag_as_red_action, SIGNAL(triggered()), this, SLOT(onFlagAsRed()));
    connect(d->flag_as_yellow_action, SIGNAL(triggered()), this, SLOT(onFlagAsYellow()));

    this->setItemIndexMethod(QGraphicsScene::NoIndex);
}
Exemplo n.º 11
0
UserInfo::UserInfo(unsigned long uin, unsigned short grpId, int page)
        : UserInfoBase(NULL, "userinfo", WType_TopLevel | WStyle_Dialog| WDestructiveClose)
{
    SET_WNDPROC("userinfo")

    inSave = false;
    setButtonsPict(this);

    m_nUin   = uin;
    m_nGrpId = grpId;

    ICQUser *u = NULL;
    if (uin){
        u = pClient->getUser(uin);
        if (u == NULL) return;
    }
    ICQGroup *g = NULL;
    if (grpId){
        g = pClient->getGroup(grpId);
        if (g == NULL) return;
    }

    lstBars->clear();
    lstBars->header()->hide();
    lstBars->setSorting(1);
    connect(lstBars, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));

    itemMain = new QListViewItem(lstBars, i18n("User info"), QString::number(SETUP_DETAILS));
    itemMain->setOpen(true);

    if (u){
        addWidget(p_MainInfo, SETUP_MAININFO, i18n("Main info"), "main");
        if (u->Type == USER_TYPE_ICQ){
            addWidget(p_HomeInfo, SETUP_HOMEINFO, i18n("Home info"), "home");
            addWidget(p_WorkInfo, SETUP_WORKINFO, i18n("Work info"), "work");
            addWidget(p_MoreInfo, SETUP_MOREINFO, i18n("More info"), "more");
            addWidget(p_AboutInfo, SETUP_ABOUT, i18n("About info"), "info");
            addWidget(p_InterestsInfo, SETUP_INTERESTS, i18n("Interests"), "interest");
            addWidget(p_PastInfo, SETUP_PAST, i18n("Group/Past"), "past");
        }
        addWidget(p_PhoneBookDlg, SETUP_PHONE, i18n("Phone book"), "phone");
    }

    if ((uin == 0) || (u->Type == USER_TYPE_ICQ)){
        itemMain = new QListViewItem(lstBars, i18n("Preferences"), QString::number(SETUP_PREFERENCES));
        itemMain->setOpen(true);
        addWidget(p_AlertDialog, SETUP_ALERT, i18n("Alert"), "alert");
        addWidget(p_AcceptDialog, SETUP_ACCEPT, i18n("Accept"), "message");
        addWidget(p_SoundSetup, SETUP_SOUND, i18n("Sound"), "sound");
    }
    if (g || (u && (u->Type == USER_TYPE_ICQ))){
        itemMain = new QListViewItem(lstBars, i18n("Auto reply"), QString::number(SETUP_AUTOREPLY));
        itemMain->setOpen(true);
        addWidget(p_MsgDialog, SETUP_AR_AWAY,
                  SIMClient::getStatusText(ICQ_STATUS_AWAY), SIMClient::getStatusIcon(ICQ_STATUS_AWAY),
                  ICQ_STATUS_AWAY);
        addWidget(p_MsgDialog, SETUP_AR_NA,
                  SIMClient::getStatusText(ICQ_STATUS_NA), SIMClient::getStatusIcon(ICQ_STATUS_NA),
                  ICQ_STATUS_NA);
        addWidget(p_MsgDialog, SETUP_AR_OCCUPIED,
                  SIMClient::getStatusText(ICQ_STATUS_OCCUPIED), SIMClient::getStatusIcon(ICQ_STATUS_OCCUPIED),
                  ICQ_STATUS_OCCUPIED);
        addWidget(p_MsgDialog, SETUP_AR_DND,
                  SIMClient::getStatusText(ICQ_STATUS_DND), SIMClient::getStatusIcon(ICQ_STATUS_DND),
                  ICQ_STATUS_DND);
        addWidget(p_MsgDialog, SETUP_AR_FREEFORCHAT,
                  SIMClient::getStatusText(ICQ_STATUS_FREEFORCHAT), SIMClient::getStatusIcon(ICQ_STATUS_FREEFORCHAT),
                  ICQ_STATUS_FREEFORCHAT);
    }
    raiseWidget(page ? page : (u ? SETUP_MAININFO : SETUP_ALERT));

    connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*)));
    connect(btnSave, SIGNAL(clicked()), this, SLOT(saveInfo()));
    connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
    if (u && (u->Type == USER_TYPE_ICQ)){
        connect(btnUpdate, SIGNAL(clicked()), this, SLOT(update()));
    }else{
        btnUpdate->hide();
    }
    loadInfo();
    setTitle();
    setIcon();
}
Exemplo n.º 12
0
/**
  This is a generic class for importing line-oriented data from text files. It
  provides a dialog for file selection, preview, separator selection and column
  assignment as well as generic conversion routines. For conversion to special
  data objects, this class has to be inherited by a special class, which
  reimplements the convertRow() function.
*/
KImportDialog::KImportDialog(QWidget *parent)
    : KDialogBase(parent, "importdialog", true, i18n("Import Text File"), Ok | Cancel),
      mSeparator(","),
      mCurrentRow(0)
{
    mData.setAutoDelete(true);

    QVBox *topBox = new QVBox(this);
    setMainWidget(topBox);
    topBox->setSpacing(spacingHint());

    QHBox *fileBox = new QHBox(topBox);
    fileBox->setSpacing(spacingHint());
    new QLabel(i18n("File to import:"), fileBox);
    KURLRequester *urlRequester = new KURLRequester(fileBox);
    urlRequester->setFilter("*.csv");
    connect(urlRequester, SIGNAL(returnPressed(const QString &)),
            SLOT(setFile(const QString &)));
    connect(urlRequester, SIGNAL(urlSelected(const QString &)),
            SLOT(setFile(const QString &)));
    connect(urlRequester->lineEdit(), SIGNAL(textChanged(const QString &)),
            SLOT(slotUrlChanged(const QString &)));
    mTable = new QTable(5, 5, topBox);
    mTable->setMinimumHeight(150);
    connect(mTable, SIGNAL(selectionChanged()), SLOT(tableSelected()));

    QHBox *separatorBox = new QHBox(topBox);
    separatorBox->setSpacing(spacingHint());

    new QLabel(i18n("Separator:"), separatorBox);

    mSeparatorCombo = new KComboBox(separatorBox);
    mSeparatorCombo->insertItem(",");
    mSeparatorCombo->insertItem(i18n("Tab"));
    mSeparatorCombo->insertItem(i18n("Space"));
    mSeparatorCombo->insertItem("=");
    mSeparatorCombo->insertItem(";");
    connect(mSeparatorCombo, SIGNAL(activated(int)),
            this, SLOT(separatorClicked(int)));
    mSeparatorCombo->setCurrentItem(0);

    QHBox *rowsBox = new QHBox(topBox);
    rowsBox->setSpacing(spacingHint());

    new QLabel(i18n("Import starts at row:"), rowsBox);
    mStartRow = new QSpinBox(rowsBox);
    mStartRow->setMinValue(1);
    /*
      new QLabel( i18n( "And ends at row:" ), rowsBox );
      mEndRow = new QSpinBox( rowsBox );
      mEndRow->setMinValue( 1 );
    */
    QVBox *assignBox = new QVBox(topBox);
    assignBox->setSpacing(spacingHint());

    QHBox *listsBox = new QHBox(assignBox);
    listsBox->setSpacing(spacingHint());

    mHeaderList = new QListView(listsBox);
    mHeaderList->addColumn(i18n("Header"));
    connect(mHeaderList, SIGNAL(selectionChanged(QListViewItem *)),
            this, SLOT(headerSelected(QListViewItem *)));
    connect(mHeaderList, SIGNAL(doubleClicked(QListViewItem *)),
            SLOT(assignColumn(QListViewItem *)));

    mFormatCombo = new KComboBox(listsBox);
    mFormatCombo->setDuplicatesEnabled(false);

    QPushButton *assignButton = new QPushButton(i18n("Assign to Selected Column"),
            assignBox);
    connect(assignButton, SIGNAL(clicked()), SLOT(assignColumn()));

    QPushButton *removeButton = new QPushButton(i18n("Remove Assignment From Selected Column"),
            assignBox);
    connect(removeButton, SIGNAL(clicked()), SLOT(removeColumn()));

    QPushButton *assignTemplateButton = new QPushButton(i18n("Assign with Template..."),
            assignBox);
    connect(assignTemplateButton, SIGNAL(clicked()), SLOT(assignTemplate()));

    QPushButton *saveTemplateButton = new QPushButton(i18n("Save Current Template"),
            assignBox);
    connect(saveTemplateButton, SIGNAL(clicked()), SLOT(saveTemplate()));

    resize(500, 300);

    connect(this, SIGNAL(okClicked()), SLOT(applyConverter()));
    connect(this, SIGNAL(applyClicked()), SLOT(applyConverter()));
    enableButtonOK(!urlRequester->lineEdit()->text().isEmpty());
}
Exemplo n.º 13
0
HtmlEditor::HtmlEditor(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui_MainWindow)
        , sourceDirty(true)
        , highlighter(0)
        , ui_dialog(0)
        , insertHtmlDialog(0)
{
    ui->setupUi(this);
    ui->tabWidget->setTabText(0, "Normal View");
    ui->tabWidget->setTabText(1, "HTML Source");
    connect(ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(changeTab(int)));
    resize(600, 600);

    highlighter = new Highlighter(ui->plainTextEdit->document());

    QWidget *spacer = new QWidget(this);
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    ui->standardToolBar->insertWidget(ui->actionZoomOut, spacer);

    zoomLabel = new QLabel;
    ui->standardToolBar->insertWidget(ui->actionZoomOut, zoomLabel);

    zoomSlider = new QSlider(this);
    zoomSlider->setOrientation(Qt::Horizontal);
    zoomSlider->setMaximumWidth(150);
    zoomSlider->setRange(25, 400);
    zoomSlider->setSingleStep(25);
    zoomSlider->setPageStep(100);
    connect(zoomSlider, SIGNAL(valueChanged(int)), SLOT(changeZoom(int)));
    ui->standardToolBar->insertWidget(ui->actionZoomIn, zoomSlider);

    connect(ui->actionFileNew, SIGNAL(triggered()), SLOT(fileNew()));
    connect(ui->actionFileOpen, SIGNAL(triggered()), SLOT(fileOpen()));
    connect(ui->actionFileSave, SIGNAL(triggered()), SLOT(fileSave()));
    connect(ui->actionFileSaveAs, SIGNAL(triggered()), SLOT(fileSaveAs()));
    connect(ui->actionExit, SIGNAL(triggered()), SLOT(close()));
    connect(ui->actionInsertImage, SIGNAL(triggered()), SLOT(insertImage()));
    connect(ui->actionCreateLink, SIGNAL(triggered()), SLOT(createLink()));
    connect(ui->actionInsertHtml, SIGNAL(triggered()), SLOT(insertHtml()));
    connect(ui->actionZoomOut, SIGNAL(triggered()), SLOT(zoomOut()));
    connect(ui->actionZoomIn, SIGNAL(triggered()), SLOT(zoomIn()));

    // these are forward to internal QWebView
    FORWARD_ACTION(ui->actionEditUndo, QWebPage::Undo);
    FORWARD_ACTION(ui->actionEditRedo, QWebPage::Redo);
    FORWARD_ACTION(ui->actionEditCut, QWebPage::Cut);
    FORWARD_ACTION(ui->actionEditCopy, QWebPage::Copy);
    FORWARD_ACTION(ui->actionEditPaste, QWebPage::Paste);
    FORWARD_ACTION(ui->actionFormatBold, QWebPage::ToggleBold);
    FORWARD_ACTION(ui->actionFormatItalic, QWebPage::ToggleItalic);
    FORWARD_ACTION(ui->actionFormatUnderline, QWebPage::ToggleUnderline);

    // Qt 4.5.0 has a bug: always returns 0 for QWebPage::SelectAll
    connect(ui->actionEditSelectAll, SIGNAL(triggered()), SLOT(editSelectAll()));

    connect(ui->actionStyleParagraph, SIGNAL(triggered()), SLOT(styleParagraph()));
    connect(ui->actionStyleHeading1, SIGNAL(triggered()), SLOT(styleHeading1()));
    connect(ui->actionStyleHeading2, SIGNAL(triggered()), SLOT(styleHeading2()));
    connect(ui->actionStyleHeading3, SIGNAL(triggered()), SLOT(styleHeading3()));
    connect(ui->actionStyleHeading4, SIGNAL(triggered()), SLOT(styleHeading4()));
    connect(ui->actionStyleHeading5, SIGNAL(triggered()), SLOT(styleHeading5()));
    connect(ui->actionStyleHeading6, SIGNAL(triggered()), SLOT(styleHeading6()));
    connect(ui->actionStylePreformatted, SIGNAL(triggered()), SLOT(stylePreformatted()));
    connect(ui->actionStyleAddress, SIGNAL(triggered()), SLOT(styleAddress()));
    connect(ui->actionFormatFontName, SIGNAL(triggered()), SLOT(formatFontName()));
    connect(ui->actionFormatFontSize, SIGNAL(triggered()), SLOT(formatFontSize()));
     connect(ui->actionFormatTextColor, SIGNAL(triggered()), SLOT(formatTextColor()));
    connect(ui->actionFormatBackgroundColor, SIGNAL(triggered()), SLOT(formatBackgroundColor()));

    // no page action exists yet for these, so use execCommand trick
    connect(ui->actionFormatStrikethrough, SIGNAL(triggered()), SLOT(formatStrikeThrough()));
    connect(ui->actionFormatAlignLeft, SIGNAL(triggered()), SLOT(formatAlignLeft()));
    connect(ui->actionFormatAlignCenter, SIGNAL(triggered()), SLOT(formatAlignCenter()));
    connect(ui->actionFormatAlignRight, SIGNAL(triggered()), SLOT(formatAlignRight()));
    connect(ui->actionFormatAlignJustify, SIGNAL(triggered()), SLOT(formatAlignJustify()));
    connect(ui->actionFormatDecreaseIndent, SIGNAL(triggered()), SLOT(formatDecreaseIndent()));
    connect(ui->actionFormatIncreaseIndent, SIGNAL(triggered()), SLOT(formatIncreaseIndent()));
    connect(ui->actionFormatNumberedList, SIGNAL(triggered()), SLOT(formatNumberedList()));
    connect(ui->actionFormatBulletedList, SIGNAL(triggered()), SLOT(formatBulletedList()));


    // necessary to sync our actions
    connect(ui->webView->page(), SIGNAL(selectionChanged()), SLOT(adjustActions()));

    connect(ui->webView->page(), SIGNAL(contentsChanged()), SLOT(adjustSource()));
    ui->webView->setFocus();

    setCurrentFileName(QString());

    QString initialFile = ":/example.html";
    const QStringList args = QCoreApplication::arguments();
    if (args.count() == 2)
        initialFile = args.at(1);

    if (!load(initialFile))
        fileNew();

    adjustActions();
    adjustSource();
    setWindowModified(false);
    changeZoom(100);
}
Exemplo n.º 14
0
// The address book is not practical enough yet to be of much use
// Leave all this code commented until it gets improved
address_book::address_book (QWidget *parent) : QWidget(parent)
{
  m_is_modified = false;
  Q3BoxLayout* top_layout = new Q3VBoxLayout (this);
  top_layout->setMargin (4);
  top_layout->setSpacing (4);
  Q3HBox* hb = new Q3HBox (this);
  hb->setSpacing (6);
  top_layout->addWidget (hb);

  Q3VBox* box_left = new Q3VBox (hb);
  Q3VBox* box_right = new Q3VBox (hb);

  // left pane: search criteria and results
  Q3GroupBox* search_box = new Q3GroupBox (3, Qt::Horizontal, tr("Search"), box_left);
  Q3VBox* labels_box = new Q3VBox(search_box);
  Q3VBox* fields_box = new Q3VBox(search_box);
  m_email_search_w = new QLineEdit (fields_box);
  (void)new QLabel (tr("Address"), labels_box);

  m_name_search_w = new QLineEdit (fields_box);
  (void)new QLabel (tr("Name"), labels_box);

  m_nick_search_w = new QLineEdit (fields_box);
  (void)new QLabel (tr("Alias"), labels_box);

  QPushButton* button_search = new QPushButton (tr("Search"), search_box);
  connect (button_search, SIGNAL(clicked()), this, SLOT(search()));

  Q3GroupBox* result_box = new Q3GroupBox (1, Qt::Vertical, tr("Results"), box_left);
  m_result_list_w = new Q3ListView (result_box);
  m_result_list_w->addColumn (tr("Email address"));
  m_result_list_w->addColumn (tr("# msgs"), 50);
  connect(m_result_list_w, SIGNAL(selectionChanged()),
	  this, SLOT(address_selected()));

  // right pane: properties of the selected address
  Q3GroupBox* prop_box = new Q3GroupBox (tr("Properties"), box_right);
  Q3GridLayout *grid_layout = new Q3GridLayout (prop_box, 6, 2);
  grid_layout->setSpacing (4);
  // set a marging big enough for the QGroupBox title not being overwritten
  grid_layout->setMargin (15);
  int g_row = 0;		// grid row

  m_email_w = new QLineEdit (prop_box);
  grid_layout->addWidget (new QLabel (tr("Address:"), prop_box),g_row,0);
  grid_layout->addWidget (m_email_w, g_row, 1);

  g_row++;
  m_name_w = new QLineEdit (prop_box);
  grid_layout->addWidget (new QLabel (tr("Name:"), prop_box), g_row, 0);
  grid_layout->addWidget (m_name_w, g_row, 1);

  g_row++;
  m_nick_w = new QLineEdit (prop_box);
  grid_layout->addWidget (new QLabel (tr("Alias:"), prop_box), g_row, 0);
  grid_layout->addWidget (m_nick_w, g_row, 1);

  g_row++;
  m_notes_w = new Q3MultiLineEdit (prop_box);
  grid_layout->addWidget (new QLabel (tr("Notes:"), prop_box), g_row, 0);
  grid_layout->addWidget (m_notes_w, g_row, 1);

  g_row++;
  m_invalid_w = new QCheckBox (prop_box);
  grid_layout->addWidget (new QLabel (tr("Invalid:"), prop_box), g_row, 0);
  grid_layout->addWidget (m_invalid_w, g_row, 1);

  g_row++;
  QPushButton* button_aliases = new QPushButton(tr("Other addresses..."), prop_box);
  grid_layout->addWidget (button_aliases, 5, 1);
  connect (button_aliases, SIGNAL(clicked()), this, SLOT(aliases()));

  // buttons at the bottom of the window
  Q3HBox* buttons_box = new Q3HBox (this);
  buttons_box->setSpacing (4);
  top_layout->addWidget (buttons_box);

  new Q3HBox (buttons_box);	// takes the left space
  QPushButton* b1 = new QPushButton (tr("New"), buttons_box);
  connect (b1, SIGNAL(clicked()), this, SLOT(new_address()));
  QPushButton* b2 = new QPushButton (tr("Apply"), buttons_box);
  connect (b2, SIGNAL(clicked()), this, SLOT(apply()));
  QPushButton* b3 = new QPushButton (tr("OK"), buttons_box);
  connect (b3, SIGNAL(clicked()), this, SLOT(OK()));
  QPushButton* b4 = new QPushButton (tr("Cancel"), buttons_box);
  connect (b4, SIGNAL(clicked()), this, SLOT(cancel()));
}
CurveEditor::CurveEditor(QWidget *parent) :
    QFrame(parent)
{
    positiveUp = true;
    scene = new CurvesView(this);
    // a gradient background


     QLinearGradient gradient(QPointF(0, 0), QPointF(0, 5000));
     gradient.setSpread(QGradient::PadSpread);
     gradient.setColorAt(0,qRgb(100, 100, 100));
     gradient.setColorAt(0.75,qRgb(230, 230, 230));

    connect(scene, SIGNAL(zoomChanged(QPointF,QPointF)), this, SLOT(zoom(QPointF,QPointF)));
    connect(scene, SIGNAL(curvesChanged(float, float)), this, SLOT(curvesHaveChanged(float, float)));

    list = new CurvesList(this);
    model = new CurveVariableListModel();

    //setup model and selection model to synchronize the variables, list and the graphics scene
    list->setModel(model);
    connect(scene, SIGNAL(selectionChanged()), list, SLOT(update()));
    connect(list->selectionModel(),SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, SLOT(handleSelection(const QItemSelection &, const QItemSelection &)));
    connect(this,SIGNAL(viewScaleChanged(QPointF)),model,SLOT(setViewScale(QPointF)));
    connect(this,SIGNAL(viewScaleChanged(QPointF)),scene->getCursor(),SLOT(setViewScale(QPointF)));
    connect(this,SIGNAL(viewScaleChanged(QPointF)),scene->getFrameCursor(),SLOT(setViewScale(QPointF)));
    connect(this,SIGNAL(moveFrameCursorTo(float)),scene,SLOT(moveFrameCursor(float)));

    scene->setModel(model);
    scene->setSelectionModel(list->selectionModel());

    view = new QGraphicsView(scene);
    view->setRenderHint(QPainter::Antialiasing);
    view->setMouseTracking(true);
    view->installEventFilter(this);
    view->setDragMode(QGraphicsView::RubberBandDrag);
    view->setBackgroundBrush(gradient);
    view->horizontalScrollBar()->installEventFilter(this);
    view->verticalScrollBar()->installEventFilter(this);

    zoomSlider = new QSlider(Qt::Horizontal,this);
    zoomSlider->setRange(1,100);
    zoomSlider->setTickInterval(10);

    connect(zoomSlider, SIGNAL(sliderMoved(int)), this, SLOT(setZoomFromSlider(int)));

    //zoom

    zoom(QPointF(1,1),QPointF(0,0));

    connect(list, SIGNAL(clicked( const QModelIndex)), scene, SLOT(update()));
    topRuler = new Ruler(Qt::Horizontal,this);
    topRuler->setAutoMark();
    topRuler->bottomToTop();



    leftRuler = new Ruler(Qt::Vertical,this);
    leftRuler->setAutoMark();
    leftRuler->rightToLeft();



    QGridLayout *layout = new QGridLayout(this);
    layout->setSpacing(0);
    layout->addWidget(list,0,0,2,1);
    layout->addWidget(zoomSlider,2,0);
    layout->setColumnStretch(0,1);

    layout->addWidget(leftRuler,1,1,2,1);

    layout->addWidget(topRuler,0,2);
    layout->addWidget(view,1,2,-1,1);

    layout->setRowStretch(1,1);
    layout->setColumnStretch(2,4);
    //layout->setStretchFactor(view,2);
    setLayout(layout);

}
Exemplo n.º 16
0
CodeEditor::CodeEditor(QWidget *parent) :
    QTextEdit(parent)
{


    setAcceptRichText(false);
    setTabStopWidth(40);
    SHL = new SyntaxHL(this); //Adding syntax highlighter.

    //Auto-complete setup:

    compList << "add"
             << "addu"
             << "sub"
             << "subu"
             << "and"
             << "or"
             << "xor"
             << "srlv"
             << "sllv"
             << "srav"
             << "slt"
             << "sltu"
             << "addi"
             << "addiu"
             << "andi"
             << "ori"
             << "nori"
             << "xori"
             << "srl"
             << "sll"
             << "sra"
             << "slti"
             << "sltiu"
             << "beq"
             << "bne"
             << "lui"
             << "sb"
             << "lb"
             << "lbu"
             << "sh"
             << "lh"
             << "lhu"
             << "sw"
             << "lw"
             << "lwl"
             << "lwr"
             << "swl"
             << "swr"
             <<"ll"
            << "sc"
            << "jr"
            << "jalr"
            << "mfhi"
            << "mflo"
            << "mthi"
            << "mtlo"
            << "mult"
            << "multu"
            << "div"
            << "divu"
            << "j"
            << "jal"
            << "syscall"
            << "nop";

    //for (int i = 0; i < 32; i++) compList.append(QString("$" + QString::number(i)));
    compList << "$0"
             << "$zero"
             << "$at"
             << "$v0"
             << "$v1"
             <<"$a0"
            << "$a1"
            << "$a2"
            << "$a3"
            << "$t0"
            << "$t1"
            << "$t2"
            << "$t3"
            << "$t4"
            << "$t5"
            << "$t6"
            << "$t7"
            << "$s0"
            << "$s1"
            << "$s2"
            << "$s3"
            << "$s4"
            << "$s5"
            << "$s6"
            << "$s7"
            << "$t8"
            << "$t9"
            << "$gp"
            << "$fp"
            << "$ra"
            << "$sp";

    compList << "blt"  <<  "bgt"
             <<  "ble"
             <<  "bge"
             <<  "bltu"
             <<  "bgtu"
             <<  "bleu"
             <<  "bgeu"
             <<  "blti"
             <<  "bgti"
             <<  "blei"
             <<  "bgei"
             <<  "bltiu"
             <<  "bgtiu"
             <<  "bleiu"
             <<  "bgeiu"
             <<  "beqz"
             <<  "bnez"
             <<  "bltz"
             <<  "bgtz"
             <<  "blez"
             <<  "bgez"
             <<  "li"
             <<  "ror"
             <<  "rol"
             <<  "not"
             <<  "neg"
             <<  "move"
             <<  "abs"
             <<  "mul"
             <<  "div"
             <<  "rem"
             <<  "clear"
             <<  "subi"
             <<  "la"
             << ".align" << ".ascii" << ".asciiz" << ".byte" << ".double" <<".float" << ".half" << ".space" << ".word";

    lCounter = NULL;

    model = new QStringListModel(compList, this);

    codeCompleter = new QCompleter(model, this);
    codeCompleter->setCompletionMode(QCompleter::PopupCompletion);
    CompleterList *cl = new CompleterList(this);
    codeCompleter->setPopup(cl);
    codeCompleter->setCaseSensitivity(Qt::CaseInsensitive);
    codeCompleter->setWidget(this);

    QObject::connect(codeCompleter, SIGNAL(activated(QString)), this, SLOT(insertCompletion(QString)));
    QObject::connect(this, SIGNAL(textChanged()), this, SLOT(updateCounter()));
    QObject::connect(this, SIGNAL(textChanged()), this, SLOT(refreshScroll()));
    QObject::connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(refreshScroll()));
    QObject::connect(this, SIGNAL(textChanged()), this, SLOT(completerPop()));    
    QObject::connect(this, SIGNAL(selectionChanged()), this, SLOT(highlightLine()));
    QObject::connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightLine()));
    QObject::connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateCounterFormat()));
    QObject::connect(this, SIGNAL(textChanged()), this, SLOT(updateCounterFormat()));
    selectionStart = selectionEnd = 0;

}
Exemplo n.º 17
0
void WSpacePlot::clearSelection() {
  for (QArray<SpaceCell>::Iterator it=cellData.begin();
       it!=cellData.end();++it)
    it->attr&=normal|marked;
  emit selectionChanged();
}
Exemplo n.º 18
0
 void setupSlots(QWidget* dialog) {
   if (dialog) {
     connect(_vectorX, SIGNAL(selectionChanged(QString)), dialog, SIGNAL(modified()));
     connect(_vectorY, SIGNAL(selectionChanged(QString)), dialog, SIGNAL(modified()));
   }
 }
Exemplo n.º 19
0
Document::Document(const QString& filename, int& current_wordcount, int& current_time, const QString& theme, QWidget* parent)
	: QWidget(parent),
	m_index(0),
	m_always_center(false),
	m_rich_text(false),
	m_cached_block_count(-1),
	m_cached_current_block(-1),
	m_page_type(0),
	m_page_amount(0),
	m_accurate_wordcount(true),
	m_current_wordcount(current_wordcount),
	m_current_time(current_time)
{
	setMouseTracking(true);

	m_stats = &m_document_stats;

	m_hide_timer = new QTimer(this);
	m_hide_timer->setInterval(5000);
	m_hide_timer->setSingleShot(true);
	connect(m_hide_timer, SIGNAL(timeout()), this, SLOT(hideMouse()));

	// Set up text area
	m_text = new QTextEdit(this);
	m_text->installEventFilter(this);
	m_text->setMouseTracking(true);
	m_text->setFrameStyle(QFrame::NoFrame);
	m_text->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	m_text->viewport()->setMouseTracking(true);
	m_text->viewport()->installEventFilter(this);

	QTextDocument* document = new QTextDocument(m_text);
	document->setUndoRedoEnabled(false);

	// Read file
	bool unknown_rich_text = false;
	if (!filename.isEmpty()) {
		m_rich_text = isRichTextFile(filename.toLower());
		m_filename = QFileInfo(filename).canonicalFilePath();
		updateState();

		if (!m_rich_text) {
			QFile file(filename);
			if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
				QTextStream stream(&file);
				stream.setCodec(QTextCodec::codecForName("UTF-8"));
				stream.setAutoDetectUnicode(true);

				QTextCursor cursor(document);
				while (!stream.atEnd()) {
					cursor.insertText(stream.read(8192));
					QApplication::processEvents();
				}
				file.close();
			}
		} else {
			RTF::Reader reader;
			reader.read(filename, document);
			if (reader.hasError()) {
				QMessageBox::warning(this, tr("Sorry"), reader.errorString());
			}
		}
	}

	// Set text area contents
	document->setUndoRedoEnabled(true);
	document->setModified(false);
	m_text->setDocument(document);
	m_text->setTabStopWidth(50);
	document->setIndentWidth(50);

	m_dictionary = new Dictionary(this);
	m_highlighter = new Highlighter(m_text, m_dictionary);
	connect(m_dictionary, SIGNAL(changed()), this, SLOT(dictionaryChanged()));

	if (m_filename.isEmpty()) {
		findIndex();
		unknown_rich_text = true;
	} else {
		m_text->setReadOnly(!QFileInfo(m_filename).isWritable());
	}

	// Set up scroll bar
	m_text->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	m_scrollbar = m_text->verticalScrollBar();
	m_scrollbar->setPalette(QApplication::palette());
	m_scrollbar->setAutoFillBackground(true);
	m_scrollbar->setVisible(false);
	connect(m_scrollbar, SIGNAL(actionTriggered(int)), this, SLOT(scrollBarActionTriggered(int)));
	connect(m_scrollbar, SIGNAL(rangeChanged(int,int)), this, SLOT(scrollBarRangeChanged(int,int)));
	scrollBarRangeChanged(m_scrollbar->minimum(), m_scrollbar->maximum());

	// Lay out window
	m_layout = new QGridLayout(this);
	m_layout->setSpacing(0);
	m_layout->setMargin(0);
	m_layout->addWidget(m_text, 0, 1);
	m_layout->addWidget(m_scrollbar, 0, 2, Qt::AlignRight);

	// Load settings
	Preferences preferences;
	if (unknown_rich_text) {
		m_rich_text = preferences.richText();
	}
	m_text->setAcceptRichText(m_rich_text);
	loadPreferences(preferences);
	loadTheme(theme);

	calculateWordCount();
	connect(m_text->document(), SIGNAL(undoCommandAdded()), this, SLOT(undoCommandAdded()));
	connect(m_text->document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(updateWordCount(int,int,int)));
	connect(m_text, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged()));
	connect(m_text, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
}
Exemplo n.º 20
0
/**
 * Construct a line chart widget of a given parent, active measure, low and high range@brief WidgetLineChart::WidgetLineChart
 * @param parent    chosen parent
 * @param meas  active measure
 * @param range chosen range
 */
WidgetLineChart::WidgetLineChart(QWidget *parent, const Measure &meas, const std::pair<double, double> &range):QWidget(parent),ui(new Ui::WidgetLineChart),_meas(new Measure(meas))
{
    ui->setupUi(this);
    _range = range;


    this->setStyleSheet(
                "QPushButton#pushButtonSaveLineData {"
                "background-color: rgb(125,125,175);"
                "border-style: outset;"
                "border-width: 2px;"
                "border-color: rgb(50,50,75);"
                "font: bold 22px;"
                "border-radius: 5px;"
                "min-width: 7em;}"

                "QPushButton#pushButtonSaveLineData:hover:pressed {"
                "background-color: rgb(100,100,145);"
                "border-style:inset;}"

                "QPushButton#pushButtonSaveLineData:hover {"
                "background-color: rgb(130,130,180);}"

                "QPushButton#pushButtonRefresh {"
                "background-color: rgb(125,125,175);"
                "border-style: outset;"
                "border-width: 2px;"
                "border-color: rgb(50,50,75);"
                "font: bold 22px;"
                "border-radius: 5px;"
                "min-width: 7em;}"

                "QPushButton#pushButtonRefresh:hover:pressed {"
                "background-color: rgb(100,100,145);"
                "border-style:inset;}"

                "QPushButton#pushButtonRefresh:hover {"
                "background-color: rgb(130,130,180); }"
                );


    ui->listLineChartMunicipality->setSelectionMode(QAbstractItemView::MultiSelection);
    ui->listLineChartYears->setSelectionMode(QAbstractItemView::MultiSelection);
    //List Stuff
    QStringList mlist = _meas->stringMuniList();
    ui->listLineChartMunicipality->addItems(mlist);
    ui->listLineChartYears->addItems(_meas->yearRange());

    QString title = meas.name() + " Over the Years";
    //insert row for title
    ui->widgetLineChart_2->plotLayout()->insertRow(0);
    //Add default labels to line chart
    ui->widgetLineChart_2->plotLayout()->addElement(0, 0, new QCPPlotTitle(ui->widgetLineChart_2, title));
    ui->widgetLineChart_2->xAxis->setLabel("Years");
    ui->widgetLineChart_2->yAxis->setLabel(_meas->name());

    //*********************set interractions*************************
    srand(QDateTime::currentDateTime().toTime_t());
      ui->widgetLineChart_2->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes |
                                      QCP::iSelectLegend | QCP::iSelectPlottables);

      ui->widgetLineChart_2->axisRect()->setupFullAxesBox();
      ui->widgetLineChart_2->legend->setSelectableParts(QCPLegend::spItems); // legend box shall not be selectable, only legend items


      // connect slot that ties some axis selections together (especially opposite axes):
      connect(ui->widgetLineChart_2, SIGNAL(selectionChangedByUser()), this, SLOT(selectionChanged()));
      // connect slots that takes care that when an axis is selected, only that direction can be dragged and zoomed:
      connect(ui->widgetLineChart_2, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(mousePress()));
      connect(ui->widgetLineChart_2, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel()));

      // make bottom and left axes transfer their ranges to top and right axes:
      connect(ui->widgetLineChart_2->xAxis, SIGNAL(rangeChanged(QCPRange)), ui->widgetLineChart_2->xAxis2, SLOT(setRange(QCPRange)));
      connect(ui->widgetLineChart_2->yAxis, SIGNAL(rangeChanged(QCPRange)), ui->widgetLineChart_2->yAxis2, SLOT(setRange(QCPRange)));

      // connect some interaction slots:
      connect(ui->widgetLineChart_2, SIGNAL(titleDoubleClick(QMouseEvent*,QCPPlotTitle*)), this, SLOT(titleDoubleClick(QMouseEvent*,QCPPlotTitle*)));
      connect(ui->widgetLineChart_2, SIGNAL(axisDoubleClick(QCPAxis*,QCPAxis::SelectablePart,QMouseEvent*)), this, SLOT(axisLabelDoubleClick(QCPAxis*,QCPAxis::SelectablePart)));

      connect(ui->widgetLineChart_2, SIGNAL(legendDoubleClick(QCPLegend*,QCPAbstractLegendItem*,QMouseEvent*)), this, SLOT(legendDoubleClick(QCPLegend*,QCPAbstractLegendItem*)));

      // setup policy and connect slot for context menu popup:
      ui->widgetLineChart_2->setContextMenuPolicy(Qt::CustomContextMenu);
      connect(ui->widgetLineChart_2, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequest(QPoint)));

    drawChart();
}
Exemplo n.º 21
0
void SideBarCalendar::setUpViewMiniCalendar(){

    miniCal = new CustomCalendarWidget;
    QToolButton* next = new QToolButton;
    QToolButton* prev = new QToolButton;
    QPushButton* today = new QPushButton("Aujourd'hui");
    year = new QLabel(QString::number(miniCal->selectedDate().year()));
    month = new QLabel(QDate::longMonthName(miniCal->selectedDate().month()));

    QString styleToolButton = "QToolButton {background-color: rgba(0,0,0,0)}";
    QSize sizeToolButton(24,24);
    next->setIcon(QIcon(":/icons/img/icons/ic_chevron_right_48px.svg"));
    next->setStyleSheet(styleToolButton);
    next->setIconSize(sizeToolButton);
    next->setCursor(Qt::PointingHandCursor);

    prev->setIcon(QIcon(":/icons/img/icons/ic_chevron_left_48px.svg"));
    prev->setStyleSheet(styleToolButton);
    prev->setIconSize(sizeToolButton);
    prev->setCursor(Qt::PointingHandCursor);

    /* Infos jour sélectionné
     * Contient : No du jour et nom du jour de la semaine
     */
    currentDayCal = new DayWidget;
    currentDayCal->setDayName(QDate::longDayName(miniCal->selectedDate().dayOfWeek()));
    currentDayCal->setDayNumber(miniCal->selectedDate().day());

    /* Header
     * Contient: Bouton next, prev, mois et année
     */
    QWidget* header = new QWidget;
    header->setStyleSheet("QLabel{font-size: 16px;}");
    QHBoxLayout* headerLayout = new QHBoxLayout;
    headerLayout->addWidget(prev);
    headerLayout->addStretch(1);
    headerLayout->addWidget(month);
    headerLayout->addWidget(year);
    headerLayout->addStretch(1);
    headerLayout->addWidget(next);
    header->setLayout(headerLayout);

    /*
     * Layout principale
     * Contient: Header et Calendar
     */
    layoutMiniCalendar = new QVBoxLayout;

    layoutMiniCalendar->addWidget(currentDayCal);
    layoutMiniCalendar->addWidget(header);
    layoutMiniCalendar->addWidget(today, 0, Qt::AlignCenter);
    layoutMiniCalendar->addWidget(miniCal, 0, Qt::AlignHCenter);
    layoutMiniCalendar->addStretch(1);
    miniCal->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    miniCal->setFixedHeight(280);
    miniCal->setFixedWidth(280);

    connect(prev, SIGNAL(clicked()), miniCal, SLOT(showPreviousMonth()));
    connect(next, SIGNAL(clicked()), miniCal, SLOT(showNextMonth()));
    connect(miniCal, SIGNAL(currentPageChanged(int,int)), this, SLOT(pageChanged(int,int)));
    connect(miniCal, SIGNAL(selectionChanged()), this, SLOT(onDayClicked()));
    connect(today, SIGNAL(clicked()), this, SLOT(onTodayClicked()));

    viewMiniCalendar->setLayout(layoutMiniCalendar);
}
Exemplo n.º 22
0
MainWindow::MainWindow(QWidget* parent)
  : CGAL::Qt::DemosMainWindow(parent)
{
  ui = new Ui::MainWindow;
  ui->setupUi(this);
  // remove the Load Script menu entry, when the demo has not been compiled with QT_SCRIPT_LIB
#if !defined(QT_SCRIPT_LIB)
  ui->menuBar->removeAction(ui->actionLoad_Script);
#endif
  
  // Save some pointers from ui, for latter use.
  sceneView = ui->sceneView;
  viewer = ui->viewer;

  // do not save the state of the viewer (anoying)
  viewer->setStateFileName(QString::null);

  // setup scene
  scene = new Scene(this);
  viewer->setScene(scene);

  {
    QShortcut* shortcut = new QShortcut(QKeySequence(Qt::ALT+Qt::Key_Q), this);
    connect(shortcut, SIGNAL(activated()),
            this, SLOT(setFocusToQuickSearch()));
  }

  proxyModel = new QSortFilterProxyModel(this);
  proxyModel->setSourceModel(scene);

  connect(ui->searchEdit, SIGNAL(textChanged(QString)),
          proxyModel, SLOT(setFilterFixedString(QString)));
  sceneView->setModel(proxyModel);

  // setup the sceneview: delegation and columns sizing...
  sceneView->setItemDelegate(new SceneDelegate(this));

  sceneView->header()->setStretchLastSection(false);
  sceneView->header()->setSectionResizeMode(Scene::NameColumn, QHeaderView::Stretch);
  sceneView->header()->setSectionResizeMode(Scene::NameColumn, QHeaderView::Stretch);
  sceneView->header()->setSectionResizeMode(Scene::ColorColumn, QHeaderView::ResizeToContents);
  sceneView->header()->setSectionResizeMode(Scene::RenderingModeColumn, QHeaderView::Fixed);
  sceneView->header()->setSectionResizeMode(Scene::ABColumn, QHeaderView::Fixed);
  sceneView->header()->setSectionResizeMode(Scene::VisibleColumn, QHeaderView::Fixed);
  sceneView->resizeColumnToContents(Scene::ColorColumn);
  sceneView->resizeColumnToContents(Scene::RenderingModeColumn);
  sceneView->resizeColumnToContents(Scene::ABColumn);
  sceneView->resizeColumnToContents(Scene::VisibleColumn);

  // setup connections
  connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
          this, SLOT(updateInfo()));
  
  connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
          this, SLOT(updateDisplayInfo()));

  connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
          viewer, SLOT(updateGL()));

  connect(scene, SIGNAL(updated()),
          viewer, SLOT(updateGL()));

  connect(scene, SIGNAL(updated()),
          this, SLOT(selectionChanged()));

  connect(scene, SIGNAL(itemAboutToBeDestroyed(Scene_item*)),
          this, SLOT(removeManipulatedFrame(Scene_item*)));

  connect(scene, SIGNAL(updated_bbox()),
          this, SLOT(updateViewerBBox()));

  connect(scene, SIGNAL(selectionChanged(int)),
          this, SLOT(selectSceneItem(int)));

  connect(sceneView->selectionModel(), 
          SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
          this, SLOT(updateInfo()));

  connect(sceneView->selectionModel(), 
          SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
          this, SLOT(updateDisplayInfo()));

  connect(sceneView->selectionModel(), 
          SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
          this, SLOT(selectionChanged()));

  sceneView->setContextMenuPolicy(Qt::CustomContextMenu);
  connect(sceneView, SIGNAL(customContextMenuRequested(const QPoint & )),
          this, SLOT(showSceneContextMenu(const QPoint &)));

  connect(viewer, SIGNAL(selected(int)),
          this, SLOT(selectSceneItem(int)));
  connect(viewer, SIGNAL(selectedPoint(double, double, double)),
          this, SLOT(showSelectedPoint(double, double, double)));

  connect(viewer, SIGNAL(selectionRay(double, double, double, 
                                      double, double, double)),
          scene, SIGNAL(selectionRay(double, double, double,
                                     double, double, double)));

  connect(viewer, SIGNAL(requestContextMenu(QPoint)),
          this, SLOT(contextMenuRequested(QPoint)));

  // The contextMenuPolicy of infoLabel is now the default one, so that one
  // can easily copy-paste its text.
  // connect(ui->infoLabel, SIGNAL(customContextMenuRequested(const QPoint & )),
  //         this, SLOT(showSceneContextMenu(const QPoint &)));

  connect(ui->actionRecenterScene, SIGNAL(triggered()),
          viewer, SLOT(update()));

  connect(ui->actionAntiAliasing, SIGNAL(toggled(bool)),
          viewer, SLOT(setAntiAliasing(bool)));

  connect(ui->actionDraw_two_sides, SIGNAL(toggled(bool)),
          viewer, SLOT(setTwoSides(bool)));

  // add the "About CGAL..." and "About demo..." entries
  this->addAboutCGAL();
  this->addAboutDemo(":/cgal/Polyhedron_3/about.html");

  // Connect the button "addButton" with actionLoad
  ui->addButton->setDefaultAction(ui->actionLoad);
  // Same with "removeButton" and "duplicateButton"
  ui->removeButton->setDefaultAction(ui->actionErase);
  ui->duplicateButton->setDefaultAction(ui->actionDuplicate);

  // Connect actionQuit (Ctrl+Q) and qApp->quit()
  connect(ui->actionQuit, SIGNAL(triggered()),
          this, SLOT(quit()));

  // Connect "Select all items"
  connect(ui->actionSelect_all_items, SIGNAL(triggered()),
          this, SLOT(selectAll()));

  // Recent files menu
  this->addRecentFiles(ui->menuFile, ui->actionQuit);
  connect(this, SIGNAL(openRecentFile(QString)),
	  this, SLOT(open(QString)));

  // Reset the "Operation menu"
  clearMenu(ui->menuOperations);

#ifdef QT_SCRIPT_LIB
  std::cerr << "Enable scripts.\n";
  script_engine = new QScriptEngine(this);
  qScriptRegisterMetaType<Scene_item*>(script_engine,
                                       myScene_itemToScriptValue,
                                       myScene_itemFromScriptValue);
#  ifdef QT_SCRIPTTOOLS_LIB
  QScriptEngineDebugger* debugger = new QScriptEngineDebugger(this);
  debugger->setObjectName("qt script debugger");
  QAction* debuggerMenuAction = 
    menuBar()->addMenu(debugger->createStandardMenu());
  debuggerMenuAction->setText(tr("Qt Script &debug"));
  for(unsigned int i = 0; i < 9; ++i)
  {
    QDockWidget* dock = new QDockWidget(debug_widgets_names[i], this);
    dock->setObjectName(debug_widgets_names[i]);
    dock->setWidget(debugger->widget(debug_widgets[i]));
    this->addDockWidget(Qt::BottomDockWidgetArea, dock);
    dock->hide();
  }
  debugger->setAutoShowStandardWindow(false);
  debugger->attachTo(script_engine);
#  endif // QT_SCRIPTTOOLS_LIB
  QScriptValue fun = script_engine->newFunction(myPrintFunction);
  script_engine->globalObject().setProperty("print", fun);
  
  //  evaluate_script("print('hello', 'world', 'from QtScript!')");
  QScriptValue mainWindowObjectValue = script_engine->newQObject(this);
  script_engine->globalObject().setProperty("main_window", mainWindowObjectValue);

  QScriptValue sceneObjectValue = script_engine->newQObject(scene);
  mainWindowObjectValue.setProperty("scene", sceneObjectValue);
  script_engine->globalObject().setProperty("scene", sceneObjectValue);

  QScriptValue viewerObjectValue = script_engine->newQObject(viewer);
  mainWindowObjectValue.setProperty("viewer", viewerObjectValue);
  script_engine->globalObject().setProperty("viewer", viewerObjectValue);

  QScriptValue cameraObjectValue = script_engine->newQObject(viewer->camera());
  viewerObjectValue.setProperty("camera", cameraObjectValue);
  script_engine->globalObject().setProperty("camera", cameraObjectValue);

  evaluate_script("var plugins = new Array();");
#  ifdef QT_SCRIPTTOOLS_LIB
  QScriptValue debuggerObjectValue = script_engine->newQObject(debugger);
  script_engine->globalObject().setProperty("debugger", debuggerObjectValue);
#  endif
#endif

  readSettings(); // Among other things, the column widths are stored.

  // Load plugins, and re-enable actions that need it.
  loadPlugins();

  // Setup the submenu of the View menu that can toggle the dockwidgets
  Q_FOREACH(QDockWidget* widget, findChildren<QDockWidget*>()) {
    ui->menuDockWindows->addAction(widget->toggleViewAction());
  }
Exemplo n.º 23
0
PolygonView::PolygonView(PinEditDoc * doc, QWidget * parent, const char * name, Qt::WFlags f) 
: QWidget(parent, name, f) {
  assert(doc != NULL);
  p_Doc = doc;
  p_Shape = NULL;
  p_Polygon = NULL;
  m_bSelectionChanged = true;
  p_Doc->registerUpdateable(this, "polygon");
  p_Doc->registerRebuildable(this, "polygon");
  // the polygon list view
  p_PolygonListView = new Q3ListView(this);
  connect(p_PolygonListView, SIGNAL(selectionChanged()), this, SLOT(slotChanged()));
  p_PolygonListView->setSelectionMode(Q3ListView::Extended);
  p_PolygonListView->addColumn(QString("polygons"));
  p_PolygonListView->setMinimumSize(200, 240);
  // the vertex list view
  p_VertexListView = new Q3ListView(this);
  connect(p_VertexListView, SIGNAL(selectionChanged()), this, SLOT(slotVertexChanged()));
  p_VertexListView->setSelectionMode(Q3ListView::Single);
  p_VertexListView->addColumn(QString("vertices for polygon"));
  p_VertexListView->setMinimumSize(200, 80);
  // tabs and widgets
  QTabWidget * tabWidget = new QTabWidget(this);
  //tabWidget->setFixedSize(200, 80);
  tabWidget->setMinimumSize(200, 80);
  // main layout
  Q3BoxLayout * vlayout = new Q3VBoxLayout(this);
  vlayout->addWidget(p_PolygonListView);
  vlayout->addWidget(p_VertexListView);
  vlayout->addWidget(tabWidget);
  vlayout->setStretchFactor(p_PolygonListView, 3);
  vlayout->setStretchFactor(p_PolygonListView, 2);
  vlayout->setStretchFactor(tabWidget, 0);
  // the vertex order widget
  {
    QWidget * widget = new QWidget(this);
    tabWidget->addTab(widget, "order");
		
    p_ButtonUp = new QPushButton("up", widget);
    connect(p_ButtonUp, SIGNAL(clicked()), this, SLOT(slotVertexUp()));
    p_ButtonDown = new QPushButton("down", widget);
    connect(p_ButtonDown, SIGNAL(clicked()), this, SLOT(slotVertexDown()));
		
    Q3BoxLayout * layout = new Q3HBoxLayout(widget);
    layout->addWidget(p_ButtonUp);
    layout->addWidget(p_ButtonDown);
  }
  // the position widget
  {
    QWidget * widget = new QWidget(this);
    tabWidget->addTab(widget, "position");
		
    p_EditX = new QLineEdit(widget);
    p_EditY = new QLineEdit(widget);
    p_EditZ = new QLineEdit(widget);
    connect(p_EditX, SIGNAL(returnPressed()), this, SLOT(slotApplyVertex()));
    connect(p_EditY, SIGNAL(returnPressed()), this, SLOT(slotApplyVertex()));
    connect(p_EditZ, SIGNAL(returnPressed()), this, SLOT(slotApplyVertex()));
		
    p_ApplyVertexButton = new QPushButton("apply", widget);
    connect(p_ApplyVertexButton, SIGNAL(clicked()), this, SLOT(slotApplyVertex()));

    Q3BoxLayout * vlayoutc = new Q3VBoxLayout(widget);
    Q3BoxLayout * hlayout = new Q3HBoxLayout(vlayoutc);
    hlayout->addWidget(p_EditX);
    hlayout->addWidget(p_EditY);
    hlayout->addWidget(p_EditZ);
    vlayoutc->addWidget(p_ApplyVertexButton);
  }
  // the color widget
  {
    QWidget * widget = new QWidget(this);
    tabWidget->addTab(widget, "color");

    p_EditR = new QLineEdit(widget);
    p_EditG = new QLineEdit(widget);
    p_EditB = new QLineEdit(widget);
    p_EditA = new QLineEdit(widget);
		
    connect(p_EditR, SIGNAL(returnPressed()), this, SLOT(slotApplyColor()));
    connect(p_EditG, SIGNAL(returnPressed()), this, SLOT(slotApplyColor()));
    connect(p_EditB, SIGNAL(returnPressed()), this, SLOT(slotApplyColor()));
    connect(p_EditA, SIGNAL(returnPressed()), this, SLOT(slotApplyColor()));

    p_ApplyColorButton = new QPushButton("apply", widget);
    connect(p_ApplyColorButton, SIGNAL(clicked()), this, SLOT(slotApplyColor()));

    Q3BoxLayout * vlayoutc = new Q3VBoxLayout(widget);
    Q3BoxLayout * hlayoutb = new Q3HBoxLayout(vlayoutc);
    hlayoutb->addWidget(p_EditR);
    hlayoutb->addWidget(p_EditG);
    hlayoutb->addWidget(p_EditB);
    hlayoutb->addWidget(p_EditA);
    vlayoutc->addWidget(p_ApplyColorButton);
  }
  // properties widget
  {
    QWidget * widget = new QWidget(this);
    tabWidget->addTab(widget, "prop");

    p_TransBox = new QCheckBox("transparent", widget);

    p_ApplyPropButton = new QPushButton("apply", widget);
    connect(p_ApplyPropButton, SIGNAL(clicked()), this, SLOT(slotApplyProp()));

    Q3BoxLayout * vlayout = new Q3VBoxLayout(widget);
    vlayout->addWidget(p_TransBox);
    vlayout->addWidget(p_ApplyPropButton);
  }

  this->doRebuild();
  //this->doUpdate();
}
CallWidget::CallWidget(QWidget* parent) :
    NavWidget(parent),
    ui(new Ui::CallWidget),
    menu_(new QMenu()),
    imDelegate_(new ImDelegate())
{
    ui->setupUi(this);

    pageAnim_ = new QPropertyAnimation(ui->welcomePage, "pos", this);

    setActualCall(nullptr);
    videoRenderer_ = nullptr;

    connect(ui->settingsButton, &QPushButton::clicked, this, &CallWidget::settingsButtonClicked);

    connect(ui->videoWidget, SIGNAL(setChatVisibility(bool)),
            ui->instantMessagingWidget, SLOT(setVisible(bool)));

    QPixmap logo(":/images/logo-ring-standard-coul.png");
    ui->ringLogo->setPixmap(logo.scaledToHeight(100, Qt::SmoothTransformation));
    ui->ringLogo->setAlignment(Qt::AlignHCenter);

    setupShareMenu();

    GlobalInstances::setPixmapManipulator(std::unique_ptr<Interfaces::PixbufManipulator>(new Interfaces::PixbufManipulator()));

    try {
        callModel_ = &CallModel::instance();

        connect(callModel_, SIGNAL(incomingCall(Call*)),
                this, SLOT(callIncoming(Call*)));
        connect(callModel_, SIGNAL(callStateChanged(Call*, Call::State)),
                this, SLOT(callStateChanged(Call*, Call::State)));

        connect(&AccountModel::instance()
                , SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>))
                , this
                , SLOT(findRingAccount(QModelIndex, QModelIndex, QVector<int>)));

        RecentModel::instance().peopleProxy()->setFilterRole(static_cast<int>(Ring::Role::Name));
        RecentModel::instance().peopleProxy()->setFilterCaseSensitivity(Qt::CaseInsensitive);
        ui->smartList->setModel(RecentModel::instance().peopleProxy());

        smartListDelegate_ = new SmartListDelegate();
        ui->smartList->setSmartListItemDelegate(smartListDelegate_);

        PersonModel::instance().addCollection<PeerProfileCollection>(LoadOptions::FORCE_ENABLED);
        ProfileModel::instance().addCollection<LocalProfileCollection>(LoadOptions::FORCE_ENABLED);

        PersonModel::instance().
                addCollection<WindowsContactBackend>(LoadOptions::FORCE_ENABLED);

        CategorizedContactModel::instance().setSortAlphabetical(false);
        CategorizedContactModel::instance().setUnreachableHidden(true);
        ui->contactView->setModel(&CategorizedContactModel::instance());
        contactDelegate_ = new ContactDelegate();
        ui->contactView->setItemDelegate(contactDelegate_);

        CategorizedHistoryModel::instance().
                addCollection<LocalHistoryCollection>(LoadOptions::FORCE_ENABLED);

        ui->historyList->setModel(CategorizedHistoryModel::SortedProxy::instance().model());
        CategorizedHistoryModel::SortedProxy::instance().model()->sort(0, Qt::DescendingOrder);
        ui->historyList->setHeaderHidden(true);
        historyDelegate_ = new HistoryDelegate();
        ui->historyList->setItemDelegate(historyDelegate_);

        connect(CategorizedHistoryModel::SortedProxy::instance().model(), &QSortFilterProxyModel::layoutChanged, [=]() {
            auto idx = CategorizedHistoryModel::SortedProxy::instance().model()->index(0,0);
            if (idx.isValid())
                ui->historyList->setExpanded(idx, true);
        });

        connect(ui->smartList, &QTreeView::entered, this, &CallWidget::on_entered);

        smartListDelegate_ = new SmartListDelegate();
        ui->smartList->setSmartListItemDelegate(smartListDelegate_);

        ui->historyList->setContextMenuPolicy(Qt::CustomContextMenu);
        connect(ui->historyList, &QListView::customContextMenuRequested, [=](const QPoint& pos){
            if (ui->historyList->currentIndex().parent().isValid()) {
                QPoint globalPos = ui->historyList->mapToGlobal(pos);
                QMenu menu;

                ContactMethod* contactMethod = ui->historyList->currentIndex()
                        .data(static_cast<int>(Call::Role::ContactMethod)).value<ContactMethod*>();

                auto copyAction = new QAction(tr("Copy number"), this);
                menu.addAction(copyAction);
                connect(copyAction, &QAction::triggered, [=]() {
                    QApplication::clipboard()->setText(contactMethod->uri());
                });
                if (not contactMethod->contact() || contactMethod->contact()->isPlaceHolder()) {
                    auto addExisting = new QAction(tr("Add to contact"), this);
                    menu.addAction(addExisting);
                    connect(addExisting, &QAction::triggered, [=]() {
                        ContactPicker contactPicker(contactMethod);
                        contactPicker.move(globalPos.x(), globalPos.y() - (contactPicker.height()/2));
                        contactPicker.exec();
                    });
                }
                menu.exec(globalPos);
            }
        });

        findRingAccount();
        setupOutOfCallIM();
        setupSmartListMenu();

        connect(ui->smartList, &SmartList::btnVideoClicked, this, &CallWidget::btnComBarVideoClicked);

        connect(RecentModel::instance().selectionModel(),
                SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
                this,
                SLOT(smartListSelectionChanged(QItemSelection,QItemSelection)));

        connect(RecentModel::instance().selectionModel(), &QItemSelectionModel::selectionChanged, [=](const QItemSelection &selected, const QItemSelection &deselected) {
            Q_UNUSED(deselected)
            if (selected.size()) {
                auto idx = selected.indexes().first();
                auto realIdx = RecentModel::instance().peopleProxy()->mapFromSource(idx);
                ui->smartList->selectionModel()->setCurrentIndex(realIdx, QItemSelectionModel::ClearAndSelect);
            } else
                ui->smartList->clearSelection();
        });

    } catch (const std::exception& e) {
Exemplo n.º 25
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    //TODELETE

    ui->setupUi(this);
    this->setMinimumSize(800,650);

    /******************************************************************************************************/
    // Instanciation of differents windows
    /******************************************************************************************************/
    createListWindow_ = new CreateListWindow();
    createProjectWindow_ = new CreateProjectWindow();
    modifyListWindow_ = new ModifyListWindow();
    modifyTaskWindow_ = new ModifyTaskWindow();
    aboutWindow_ = new AboutWindow();
    createTaskWindow_ = new CreateTaskWindow();

    /* QListView definition for the history */
    myListView = new QListView();
    historyModel = new QStandardItemModel;
    myListView->setModel(historyModel);
    myListView->setAlternatingRowColors(true);

    /******************************************************************************************************/
    /* Creats layouts */
    /******************************************************************************************************/
    QLayout * projectLayout = new QVBoxLayout();
    QLayout * taskLayout = new QVBoxLayout();
    QLayout * listLayout = new QVBoxLayout();
    QLayout * actionsLayout = new QVBoxLayout();
    QLayout * historyLayout = new QVBoxLayout();

    /******************************************************************************************************/
    /* Creats groupBox */
    /******************************************************************************************************/
    QGroupBox * projectGroup = new QGroupBox("Projet");
    QGroupBox * taskGroup = new QGroupBox("Tâches");
    QGroupBox * listGroup = new QGroupBox("Listes");
    QGroupBox * actionsGroup = new QGroupBox("Actions");
    QGroupBox * historyGroup = new QGroupBox("Historique");

    /******************************************************************************************************/
    /* Creats buttons */
    /******************************************************************************************************/

    createProject = new QPushButton("Créer un nouveau projet");
    this->setButtonIcon(createProject,(std::string)":Images/project_icon");

    createTask = new QPushButton("Créer une tâche");
    this->setButtonIcon(createTask,(std::string)":Images/tache_icon");

    modifyTask = new QPushButton("Modifier une tâche");
    this->setButtonIcon(modifyTask,(std::string)":Images/engrenage_icon");

    createList = new QPushButton("Créer une liste");
    this->setButtonIcon(createList,(std::string)":Images/liste_icon");

    modifyList = new QPushButton("Modifier une liste");
    this->setButtonIcon(modifyList,(std::string)":Images/engrenage_icon");

    deleteItem = new QPushButton("Supprimer un élément");
    this->setButtonIcon(deleteItem,(std::string)":Images/minus_icon");

    up = new QPushButton("Monter");
    this->setButtonIcon(up,(std::string)":Images/up_icon");

    down = new QPushButton("Descendre");
    this->setButtonIcon(down,(std::string)":Images/down_icon");

    history = new QPushButton("Historique");
    this->setButtonIcon(history,(std::string)":Images/history_icon");

    /******************************************************************************************************/
    /* Adding buttons to layouts */
    /******************************************************************************************************/
    projectLayout->addWidget(createProject);

    listLayout->addWidget(createList);
    listLayout->addWidget(modifyList);

    taskLayout->addWidget(createTask);
    taskLayout->addWidget(modifyTask);

    actionsLayout->addWidget(deleteItem);
    actionsLayout->addWidget(up);
    actionsLayout->addWidget(down);

    historyLayout->addWidget(history);
    historyLayout->addWidget(myListView);

    /******************************************************************************************************/
    /* Adding layouts to GroupBox */
    /******************************************************************************************************/
    projectGroup->setLayout(projectLayout);

    taskGroup->setLayout(taskLayout);
    listGroup->setLayout(listLayout);
    actionsGroup->setLayout(actionsLayout);
    historyGroup->setLayout(historyLayout);

    /******************************************************************************************************/
    /* Adding QGroupBox to QToolBar */
    /******************************************************************************************************/
    ui->mainToolBar->addWidget(projectGroup);
    ui->mainToolBar->addWidget(taskGroup);
    ui->mainToolBar->addWidget(listGroup);
    ui->mainToolBar->addWidget(actionsGroup);

    /* Adding buttons to ToolBar */
    ui->toolBar->addWidget(historyGroup);

    /******************************************************************************************************/
    // Slots and signals definition
    /******************************************************************************************************/

    //Create a project
    QObject::connect(ui->actionNewProject, SIGNAL(triggered()), this, SLOT(slotCreateProjectWindow()));
    QObject::connect(createProject, SIGNAL(clicked()), this, SLOT(slotCreateProjectWindow()));
    QObject::connect(createProjectWindow_, SIGNAL(createProject(Liste *)), this, SLOT(addProject(Liste *)));

    //Loading Project
    QObject::connect(ui->actionOpenProject, SIGNAL(triggered()), this, SLOT(slotOpenProjectWindow()));

    //Loading Template
    QObject::connect(ui->actionOpenTemplate, SIGNAL(triggered()), this, SLOT(slotOpenTemplateWindow()));

    //Create a task
    QObject::connect(ui->actionCreateTask, SIGNAL(triggered()), this, SLOT(slotCreateTaskWindow()));
    QObject::connect(createTask, SIGNAL(clicked()), this, SLOT(slotCreateTaskWindow()));
    QObject::connect(createTaskWindow_, SIGNAL(transferTask(Tache *)), this, SLOT(addTask(Tache *)));

    //Delete an element
    QObject::connect(deleteItem, SIGNAL(clicked()), this, SLOT(deleteElement()));

    //Modify a task
    QObject::connect(ui->actionModifyTask, SIGNAL(triggered()), this, SLOT(slotModifyTaskWindow()));
    QObject::connect(modifyTask, SIGNAL(clicked()), this, SLOT(slotModifyTaskWindow()));
    QObject::connect(modifyTaskWindow_, SIGNAL(modifyTask(Tache*,Tache*)), this, SLOT(modifyTaskAt(Tache*,Tache*)));

    //Create a list of tasks
    QObject::connect(ui->actionCreateList, SIGNAL(triggered()), this, SLOT(slotCreateListWindow()));
    QObject::connect(createList, SIGNAL(clicked()), this, SLOT(slotCreateListWindow()));
    QObject::connect(createListWindow_, SIGNAL(createList(Liste *)), this, SLOT(addList(Liste *)));

    //Modify a list of tasks
    QObject::connect(ui->actionModifyList, SIGNAL(triggered()), this, SLOT(slotModifyListWindow()));
    QObject::connect(modifyList, SIGNAL(clicked()), this, SLOT(slotModifyListWindow()));
    QObject::connect(modifyListWindow_, SIGNAL(modifyList(Liste*,Liste*)), this, SLOT(modifyListAt(Liste*,Liste*)));

    //Save project
    QObject::connect(ui->actionSaveUnList, SIGNAL(triggered()), this, SLOT(saveProject()));

    //Save template
    QObject::connect(ui->actionSaveTemplate, SIGNAL(triggered()), this, SLOT(saveTemplate()));

    //About Window
    QObject::connect(ui->actionAboutPeaceTache, SIGNAL(triggered()), this, SLOT(slotAboutWindow()));

    //UP element
    QObject::connect(ui->actionUp, SIGNAL(triggered()), this, SLOT(upElement()));
    QObject::connect(up, SIGNAL(clicked()), this, SLOT(upElement()));

    //DOWN element
    QObject::connect(ui->actionDown, SIGNAL(triggered()), this, SLOT(downElement()));
    QObject::connect(down, SIGNAL(clicked()), this, SLOT(downElement()));

    //history button
    QObject::connect(history, SIGNAL(clicked()), this, SLOT(showOrHideHistory()));
    //close window
    QObject::connect((ui->actionQuit), SIGNAL(triggered()), this, SLOT(closeApp()));

    QObject::connect((ui->treeView), SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()));

    ui->treeView->setAnimated(true);
    ui->treeView->setHeaderHidden(true);

    /******************************************************************************************************/
    //Disable buttons and menus
    /******************************************************************************************************/
    createList->setEnabled(false);
    createTask->setEnabled(false);
    modifyTask->setEnabled(false);
    modifyList->setEnabled(false);
    deleteItem->setEnabled(false);
    up->setEnabled(false);
    down->setEnabled(false);

    this->loadCache();
}
Exemplo n.º 26
0
void FancyPlotterSettings::moveDownSensor()
{
  mModel->moveDownSensor(mView->selectionModel()->currentIndex());
  selectionChanged(mView->selectionModel()->currentIndex());
}
Exemplo n.º 27
0
PianorollEditor::PianorollEditor(QWidget* parent)
   : QMainWindow(parent)
      {
      setWindowTitle(QString("MuseScore"));

      waveView = 0;
      _score = 0;
      staff  = 0;

      QWidget* mainWidget = new QWidget;

      QToolBar* tb = addToolBar(tr("toolbar1"));
      tb->addAction(getAction("undo"));
      tb->addAction(getAction("redo"));
      tb->addSeparator();
      tb->addAction(getAction("sound-on"));
#ifdef HAS_MIDI
      tb->addAction(getAction("midi-on"));
#endif
      QAction* a = getAction("follow");
      a->setCheckable(true);
      a->setChecked(preferences.followSong);

      tb->addAction(a);

      tb->addSeparator();
      tb->addAction(getAction("rewind"));
      tb->addAction(getAction("play"));
      tb->addSeparator();
      showWave = new QAction(tr("Wave"), tb);
      showWave->setToolTip(tr("show wave display"));
      showWave->setCheckable(true);
      showWave->setChecked(false);
      connect(showWave, SIGNAL(toggled(bool)), SLOT(showWaveView(bool)));
      tb->addAction(showWave);

      //-------------
      tb = addToolBar(tr("toolbar2"));
      VoiceSelector* vs = new VoiceSelector;
      tb->addWidget(vs);

      tb->addSeparator();
      tb->addWidget(new QLabel(tr("Cursor:")));
      pos = new Awl::PosLabel;
      tb->addWidget(pos);
      Awl::PitchLabel* pl = new Awl::PitchLabel();
      tb->addWidget(pl);

      tb->addSeparator();
      tb->addWidget(new QLabel(tr("Velocity:")));
      veloType = new QComboBox;
      veloType->addItem(tr("offset"), MScore::OFFSET_VAL);
      veloType->addItem(tr("user"),   MScore::USER_VAL);
      tb->addWidget(veloType);

      velocity = new QSpinBox;
      velocity->setRange(-1, 127);
      velocity->setSpecialValueText("--");
      velocity->setReadOnly(true);
      tb->addWidget(velocity);

      tb->addWidget(new QLabel(tr("Pitch:")));
      pitch = new Awl::PitchEdit;
      pitch->setReadOnly(true);
      tb->addWidget(pitch);

      //-------------
      qreal xmag = .1;
      ruler = new Ruler;
      ruler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
      ruler->setFixedHeight(rulerHeight);
      ruler->setMag(xmag, 1.0);

      Piano* piano = new Piano;
      piano->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
      piano->setFixedWidth(pianoWidth);

      gv  = new PianoView;
      gv->scale(xmag, 1.0);
      gv->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

      hsb = new QScrollBar(Qt::Horizontal);
      connect(gv->horizontalScrollBar(), SIGNAL(rangeChanged(int,int)),
         SLOT(rangeChanged(int,int)));

      // layout
      QHBoxLayout* hbox = new QHBoxLayout;
      hbox->setSpacing(0);
      hbox->addWidget(piano);
      hbox->addWidget(gv);

      split = new QSplitter(Qt::Vertical);
      split->setLineWidth(0);
      split->setMidLineWidth(0);

      QWidget* split1 = new QWidget;
      split1->setLayout(hbox);
      split->addWidget(split1);

      QGridLayout* layout = new QGridLayout;
      layout->setContentsMargins(0, 0, 0, 0);
      layout->setSpacing(0);
      mainWidget->setLayout(layout);
      layout->setColumnMinimumWidth(0, pianoWidth + 5);
      layout->setSpacing(0);
      layout->addWidget(tb,    0, 1, 1, 1);
      layout->addWidget(ruler, 1, 1);
      layout->addWidget(split, 2, 0, 1, 2);
      layout->addWidget(hsb,   3, 1);

      setCentralWidget(mainWidget);

      connect(gv->verticalScrollBar(), SIGNAL(valueChanged(int)), piano, SLOT(setYpos(int)));

      connect(gv,          SIGNAL(magChanged(double,double)),  ruler, SLOT(setMag(double,double)));
      connect(gv,          SIGNAL(magChanged(double,double)),  piano, SLOT(setMag(double,double)));
      connect(gv,          SIGNAL(pitchChanged(int)),          pl,    SLOT(setPitch(int)));
      connect(gv,          SIGNAL(pitchChanged(int)),          piano, SLOT(setPitch(int)));
      connect(piano,       SIGNAL(pitchChanged(int)),          pl,    SLOT(setPitch(int)));
      connect(gv,          SIGNAL(posChanged(const Pos&)),     pos,   SLOT(setValue(const Pos&)));
      connect(gv,          SIGNAL(posChanged(const Pos&)),     ruler, SLOT(setPos(const Pos&)));
      connect(ruler,       SIGNAL(posChanged(const Pos&)),     pos,   SLOT(setValue(const Pos&)));

      connect(hsb,         SIGNAL(valueChanged(int)),  SLOT(setXpos(int)));
      connect(gv,          SIGNAL(xposChanged(int)),   SLOT(setXPos(int)));
      connect(gv->horizontalScrollBar(), SIGNAL(valueChanged(int)), SLOT(setXpos(int)));

      connect(ruler,       SIGNAL(locatorMoved(int)),  SLOT(moveLocator(int)));
      connect(veloType,    SIGNAL(activated(int)),     SLOT(veloTypeChanged(int)));
      connect(velocity,    SIGNAL(valueChanged(int)),  SLOT(velocityChanged(int)));
      connect(gv->scene(), SIGNAL(selectionChanged()), SLOT(selectionChanged()));
      connect(piano,       SIGNAL(keyPressed(int)),    SLOT(keyPressed(int)));
      connect(piano,       SIGNAL(keyReleased(int)),   SLOT(keyReleased(int)));
      resize(800, 400);

      QActionGroup* ag = new QActionGroup(this);
      a = new QAction(this);
      a->setData("delete");
      a->setShortcut(Qt::Key_Delete);
      ag->addAction(a);
      addActions(ag->actions());
      connect(ag, SIGNAL(triggered(QAction*)), SLOT(cmd(QAction*)));
      setXpos(0);
      }
Exemplo n.º 28
0
FancyPlotterSettings::FancyPlotterSettings( QWidget* parent, bool locked )
  : KPageDialog( parent ), mModel( new SensorModel( this ) )
{
  setFaceType( Tabbed );
  setCaption( i18n( "Plotter Settings" ) );
  setButtons( Ok | Apply | Cancel );
  setObjectName( "FancyPlotterSettings" );
  setModal( false );

  QFrame *page = 0;
  QGridLayout *pageLayout = 0;
  QGridLayout *boxLayout = 0;
  QGroupBox *groupBox = 0;
  QLabel *label = 0;

  // Style page
  page = new QFrame();
  addPage( page, i18n( "General" ) );
  pageLayout = new QGridLayout( page );
  pageLayout->setSpacing( spacingHint() );
  pageLayout->setMargin( 0 );

  label = new QLabel( i18n( "Title:" ), page );
  pageLayout->addWidget( label, 0, 0 );

  mTitle = new KLineEdit( page );
  mTitle->setWhatsThis( i18n( "Enter the title of the display here." ) );
  pageLayout->addWidget( mTitle, 0, 1 );
  label->setBuddy( mTitle );

  mStackBeams = new QCheckBox( i18n("Stack the beams on top of each other"), page);
  mStackBeams->setWhatsThis( i18n("The beams are stacked on top of each other, and the area is drawn filled in. So if one beam has a value of 2 and another beam has a value of 3, the first beam will be drawn at value 2 and the other beam drawn at 2+3=5.") );
  pageLayout->addWidget( mStackBeams, 1, 0,1,2);

  pageLayout->setRowStretch( 2, 1 );

  // Scales page
  page = new QFrame();
  addPage( page, i18n( "Scales" ) );
  pageLayout = new QGridLayout( page );
  pageLayout->setSpacing( spacingHint() );
  pageLayout->setMargin( 0 );

  groupBox = new QGroupBox( i18n( "Vertical scale" ), page );
  boxLayout = new QGridLayout;
  groupBox->setLayout( boxLayout );
  boxLayout->setSpacing( spacingHint() );
  boxLayout->setColumnStretch( 2, 1 );

  mManualRange = new QCheckBox( i18n( "Specify graph range:" ), groupBox );
  mManualRange->setWhatsThis( i18n( "Check this box if you want the display range to adapt dynamically to the currently displayed values; if you do not check this, you have to specify the range you want in the fields below." ) );
  mManualRange->setChecked(true);
  boxLayout->addWidget( mManualRange, 0, 0, 1, 5 );

  mMinValueLabel = new QLabel( i18n( "Minimum value:" ), groupBox );
  boxLayout->addWidget( mMinValueLabel, 1, 0 );

  mMinValue = new QDoubleSpinBox( groupBox );
  mMinValue->setMaximum( std::numeric_limits<long long>::max());
  mMinValue->setMinimum( std::numeric_limits<long long>::min());
  mMinValue->setWhatsThis( i18n( "Enter the minimum value for the display here." ) );
  mMinValue->setSingleStep(10);
  boxLayout->addWidget( mMinValue, 1, 1 );
  mMinValueLabel->setBuddy( mMinValue );

  mMaxValueLabel = new QLabel( i18n( "Maximum value:" ), groupBox );
  boxLayout->addWidget( mMaxValueLabel, 1, 3 );

  mMaxValue = new QDoubleSpinBox( groupBox);
  mMaxValue->setMaximum( std::numeric_limits<long long>::max());
  mMaxValue->setMinimum( std::numeric_limits<long long>::min());
  mMaxValue->setWhatsThis( i18n( "Enter the soft maximum value for the display here. The upper range will not be reduced below this value, but will still go above this number for values above this value." ) );
  mMaxValue->setSingleStep(10);
  boxLayout->addWidget( mMaxValue, 1, 4 );
  mMaxValueLabel->setBuddy( mMaxValue );

  pageLayout->addWidget( groupBox, 0, 0 );

  groupBox = new QGroupBox( i18n( "Horizontal scale" ), page );
  QFormLayout *formLayout = new QFormLayout(groupBox);

  mHorizontalScale = new KIntNumInput( 1, groupBox );
  mHorizontalScale->setMinimum( 1 );
  mHorizontalScale->setMaximum( 50 );

  formLayout->addRow( i18n("Pixels per time period:"), mHorizontalScale );


  pageLayout->addWidget( groupBox, 1, 0 );

  // Grid page
  page = new QFrame( );
  addPage( page, i18n( "Grid" ) );
  pageLayout = new QGridLayout( page );
  pageLayout->setSpacing( spacingHint() );
  pageLayout->setMargin( 0 );

  groupBox = new QGroupBox( i18n( "Lines" ), page );
  boxLayout = new QGridLayout;
  groupBox->setLayout( boxLayout );
  boxLayout->setSpacing( spacingHint() );
  boxLayout->setColumnStretch( 1, 1 );

  mShowVerticalLines = new QCheckBox( i18n( "Vertical lines" ), groupBox );
  mShowVerticalLines->setWhatsThis( i18n( "Check this to activate the vertical lines if display is large enough." ) );
  boxLayout->addWidget( mShowVerticalLines, 0, 0 );

  label = new QLabel( i18n( "Distance:" ), groupBox );
  boxLayout->addWidget( label, 0, 2 );

  mVerticalLinesDistance = new KIntNumInput( 0, groupBox );
  mVerticalLinesDistance->setMinimum( 10 );
  mVerticalLinesDistance->setMaximum( 120 );
  mVerticalLinesDistance->setWhatsThis( i18n( "Enter the distance between two vertical lines here." ) );
  boxLayout->addWidget( mVerticalLinesDistance , 0, 3 );
  label->setBuddy( mVerticalLinesDistance );

  mVerticalLinesScroll = new QCheckBox( i18n( "Vertical lines scroll" ), groupBox );
  boxLayout->addWidget( mVerticalLinesScroll, 1, 0, 1, -1 );

  mShowHorizontalLines = new QCheckBox( i18n( "Horizontal lines" ), groupBox );
  mShowHorizontalLines->setWhatsThis( i18n( "Check this to enable horizontal lines if display is large enough." ) );
  boxLayout->addWidget( mShowHorizontalLines, 2, 0, 1, -1 );

  pageLayout->addWidget( groupBox, 0, 0, 1, 2 );

  groupBox = new QGroupBox( i18n( "Text" ), page );
  boxLayout = new QGridLayout;
  groupBox->setLayout( boxLayout );
  boxLayout->setSpacing( spacingHint() );
  boxLayout->setColumnStretch( 1, 1 );

  mShowAxis = new QCheckBox( i18n( "Show axis labels" ), groupBox );
  mShowAxis->setWhatsThis( i18n( "Check this box if horizontal lines should be decorated with the values they mark." ) );
  boxLayout->addWidget( mShowAxis, 0, 0, 1, -1 );

  label = new QLabel( i18n( "Font size:" ), groupBox );
  boxLayout->addWidget( label, 1, 0 );

  mFontSize = new KIntNumInput( 8, groupBox );
  mFontSize->setMinimum( 1 );
  mFontSize->setMaximum( 1000 );
  boxLayout->addWidget( mFontSize, 1, 1 );
  label->setBuddy( mFontSize );

  pageLayout->addWidget( groupBox, 1, 0 );

  pageLayout->setRowStretch( 2, 1 );

  // Sensors page
  page = new QFrame( );
  addPage( page, i18n( "Sensors" ) );
  pageLayout = new QGridLayout( page );
  pageLayout->setSpacing( spacingHint() );
  pageLayout->setMargin( 0 );
  pageLayout->setRowStretch( 2, 1 );
  pageLayout->setRowStretch( 5, 1 );

  mView = new QTreeView( page );
  mView->header()->setStretchLastSection( false );
  mView->setRootIsDecorated( false );
  mView->setItemsExpandable( false );
  mView->setModel( mModel );
  mView->header()->setResizeMode(QHeaderView::ResizeToContents);
  bool hideFirstColumn = true;
  for(int i = 0; i < mModel->rowCount(); i++)
    if(mModel->data(mModel->index(i, 0)) != "localhost") {
      hideFirstColumn = false;
      break;
    }
  if(hideFirstColumn)
    mView->hideColumn(0);

  pageLayout->addWidget( mView, 0, 0, 6, 1 );
  connect(mView,SIGNAL(doubleClicked(QModelIndex)), this, SLOT(editSensor()));

  mEditButton = new QPushButton( i18n( "Set Color..." ), page );
  mEditButton->setWhatsThis( i18n( "Push this button to configure the color of the sensor in the diagram." ) );
  pageLayout->addWidget( mEditButton, 0, 1 );

  mRemoveButton = 0;
  mMoveUpButton = 0;
  mMoveDownButton = 0;
  if ( !locked ) {
    mRemoveButton = new QPushButton( i18n( "Delete" ), page );
    mRemoveButton->setWhatsThis( i18n( "Push this button to delete the sensor." ) );
    pageLayout->addWidget( mRemoveButton, 1, 1 );
    connect( mRemoveButton, SIGNAL(clicked()), SLOT(removeSensor()) );

    mMoveUpButton = new QPushButton( i18n( "Move Up" ), page );
    mMoveUpButton->setEnabled( false );
    pageLayout->addWidget( mMoveUpButton, 2, 1 );
    connect( mMoveUpButton, SIGNAL(clicked()), SLOT(moveUpSensor()) );

    mMoveDownButton = new QPushButton( i18n( "Move Down" ), page );
    mMoveDownButton->setEnabled( false );
    pageLayout->addWidget( mMoveDownButton, 3, 1 );
    connect( mMoveDownButton, SIGNAL(clicked()), SLOT(moveDownSensor()) );

    connect(mView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(selectionChanged(QModelIndex)));

  }

  connect( mManualRange, SIGNAL(toggled(bool)), mMinValue,
           SLOT(setEnabled(bool)) );
  connect( mManualRange, SIGNAL(toggled(bool)), mMaxValue,
           SLOT(setEnabled(bool)) );
  connect( mManualRange, SIGNAL(toggled(bool)), mMinValueLabel,
           SLOT(setEnabled(bool)) );
  connect( mManualRange, SIGNAL(toggled(bool)), mMaxValueLabel,
           SLOT(setEnabled(bool)) );

  connect( mShowVerticalLines, SIGNAL(toggled(bool)), mVerticalLinesDistance,
           SLOT(setEnabled(bool)) );
  connect( mShowVerticalLines, SIGNAL(toggled(bool)), mVerticalLinesScroll,
           SLOT(setEnabled(bool)) );

  connect( mEditButton, SIGNAL(clicked()), SLOT(editSensor()) );

  KAcceleratorManager::manage( this );
}
Exemplo n.º 29
0
InteHomeFurn::InteHomeFurn(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::InteHomeFurn)
{
    ui->setupUi(this);
    this->setWindowFlags(Qt::FramelessWindowHint);

    QPixmap pixmap;
    pixmap.load(":/images/intehomefurn/1.png");
    QPalette p(palette());
    p.setBrush(QPalette::Window,QBrush(pixmap));
    setPalette(p);

    pixmap1.load(":/images/inteagri/30.png");
    pixmap2.load(":/images/inteagri/31.png");

    pixmap.load(":/images/intehomefurn/01.png");
    ui->toolButton->setIcon(pixmap);
    ui->toolButton->setIconSize(pixmap.size());
    ui->toolButton->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/02.png");
    ui->toolButton_2->setIcon(pixmap);
    ui->toolButton_2->setIconSize(pixmap.size());
    ui->toolButton_2->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/03.png");
    ui->toolButton_3->setIcon(pixmap);
    ui->toolButton_3->setIconSize(pixmap.size());
    ui->toolButton_3->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/04.png");
    ui->toolButton_4->setIcon(pixmap);
    ui->toolButton_4->setIconSize(pixmap.size());
    ui->toolButton_4->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/05.png");
    ui->toolButton_5->setIcon(pixmap);
    ui->toolButton_5->setIconSize(pixmap.size());
    ui->toolButton_5->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/06.png");
    ui->toolButton_6->setIcon(pixmap);
    ui->toolButton_6->setIconSize(pixmap.size());
    ui->toolButton_6->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/07.png");
    ui->toolButton_7->setIcon(pixmap);
    ui->toolButton_7->setIconSize(pixmap.size());
    ui->toolButton_7->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/08.png");
    ui->toolButton_9->setIcon(pixmap);
    ui->toolButton_9->setIconSize(pixmap.size());
    ui->toolButton_9->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/0010.png");
    ui->toolButton_8->setIcon(pixmap);
    ui->toolButton_8->setIconSize(pixmap.size());
    ui->toolButton_8->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/011.png");
    ui->P1_openTB->setIcon(pixmap);
    ui->P1_openTB->setIconSize(pixmap.size());
    ui->P1_openTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/012.png");
    ui->P1_closeTB->setIcon(pixmap);
    ui->P1_closeTB->setIconSize(pixmap.size());
    ui->P1_closeTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/021.png");
    ui->P2_openTB->setIcon(pixmap);
    ui->P2_openTB->setIconSize(pixmap.size());
    ui->P2_openTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/022.png");
    ui->P2_closeTB->setIcon(pixmap);
    ui->P2_closeTB->setIconSize(pixmap.size());
    ui->P2_closeTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/023.png");
    ui->P2_addsoundTB->setIcon(pixmap);
    ui->P2_addsoundTB->setIconSize(pixmap.size());
    ui->P2_addsoundTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/024.png");
    ui->P2_redusoundTB->setIcon(pixmap);
    ui->P2_redusoundTB->setIconSize(pixmap.size());
    ui->P2_redusoundTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/025.png");
    ui->P2_AVtypeTB->setIcon(pixmap);
    ui->P2_AVtypeTB->setIconSize(pixmap.size());
    ui->P2_AVtypeTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/026.png");
    ui->P2_addchannelTB->setIcon(pixmap);
    ui->P2_addchannelTB->setIconSize(pixmap.size());
    ui->P2_addchannelTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/027.png");
    ui->P2_reduchannelTB->setIcon(pixmap);
    ui->P2_reduchannelTB->setIconSize(pixmap.size());
    ui->P2_reduchannelTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/031.png");
    ui->P3_openTB->setIcon(pixmap);
    ui->P3_openTB->setIconSize(pixmap.size());
    ui->P3_openTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/032.png");
    ui->P3_closeTB->setIcon(pixmap);
    ui->P3_closeTB->setIconSize(pixmap.size());
    ui->P3_closeTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/033.png");
    ui->P3_windspeedTB->setIcon(pixmap);
    ui->P3_windspeedTB->setIconSize(pixmap.size());
    ui->P3_windspeedTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/034.png");
    ui->P3_winddireTB->setIcon(pixmap);
    ui->P3_winddireTB->setIconSize(pixmap.size());
    ui->P3_winddireTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/041.png");
    ui->P4_openTB->setIcon(pixmap);
    ui->P4_openTB->setIconSize(pixmap.size());
    ui->P4_openTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/042.png");
    ui->P4_closeTB->setIcon(pixmap);
    ui->P4_closeTB->setIconSize(pixmap.size());
    ui->P4_closeTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/043.png");
    ui->P4_presetTB->setIcon(pixmap);
    ui->P4_presetTB->setIconSize(pixmap.size());
    ui->P4_presetTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/044.png");
    ui->P4_windspeedTB->setIcon(pixmap);
    ui->P4_windspeedTB->setIconSize(pixmap.size());
    ui->P4_windspeedTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/045.png");
    ui->P4_winddireTB->setIcon(pixmap);
    ui->P4_winddireTB->setIconSize(pixmap.size());
    ui->P4_winddireTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/051.png");
    ui->P5_openTB->setIcon(pixmap);
    ui->P5_openTB->setIconSize(pixmap.size());
    ui->P5_openTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/052.png");
    ui->P5_closeTB->setIcon(pixmap);
    ui->P5_closeTB->setIconSize(pixmap.size());
    ui->P5_closeTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/053.png");
    ui->P5_addsoundTB->setIcon(pixmap);
    ui->P5_addsoundTB->setIconSize(pixmap.size());
    ui->P5_addsoundTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/054.png");
    ui->P5_redusoundTB->setIcon(pixmap);
    ui->P5_redusoundTB->setIconSize(pixmap.size());
    ui->P5_redusoundTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/061.png");
    ui->P6_oporclTB->setIcon(pixmap);
    ui->P6_oporclTB->setIconSize(pixmap.size());
    ui->P6_oporclTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/062.png");
    ui->P6_addsoundTB->setIcon(pixmap);
    ui->P6_addsoundTB->setIconSize(pixmap.size());
    ui->P6_addsoundTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/063.png");
    ui->P6_redusoundTB->setIcon(pixmap);
    ui->P6_redusoundTB->setIconSize(pixmap.size());
    ui->P6_redusoundTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/064.png");
    ui->P6_intooroutTB->setIcon(pixmap);
    ui->P6_intooroutTB->setIconSize(pixmap.size());
    ui->P6_intooroutTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/065.png");
    ui->P6_playorpauseTB->setIcon(pixmap);
    ui->P6_playorpauseTB->setIconSize(pixmap.size());
    ui->P6_playorpauseTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/066.png");
    ui->P6_fastforwardTB->setIcon(pixmap);
    ui->P6_fastforwardTB->setIconSize(pixmap.size());
    ui->P6_fastforwardTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/067.png");
    ui->P6_rewindTB->setIcon(pixmap);
    ui->P6_rewindTB->setIconSize(pixmap.size());
    ui->P6_rewindTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/0004.png");
    ui->equipopenTB->setIcon(pixmap);
    ui->equipopenTB->setIconSize(pixmap.size());
    ui->equipopenTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/0005.png");
    ui->equipcloseTB->setIcon(pixmap);
    ui->equipcloseTB->setIconSize(pixmap.size());
    ui->equipcloseTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/0006.png");
    ui->equipstopTB->setIcon(pixmap);
    ui->equipstopTB->setIconSize(pixmap.size());
    ui->equipstopTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/007.png");
    ui->addlightTB->setIcon(pixmap);
    ui->addlightTB->setIconSize(pixmap.size());
    ui->addlightTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/008.png");
    ui->redulightTB->setIcon(pixmap);
    ui->redulightTB->setIconSize(pixmap.size());
    ui->redulightTB->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/1001.png");
    ui->powerOpenTB1->setIcon(pixmap);
    ui->powerOpenTB1->setIconSize(pixmap.size());
    ui->powerOpenTB1->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    ui->powerOpenTB2->setIcon(pixmap);
    ui->powerOpenTB2->setIconSize(pixmap.size());
    ui->powerOpenTB2->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/button/1002.png");
    ui->powerCloseTB1->setIcon(pixmap);
    ui->powerCloseTB1->setIconSize(pixmap.size());
    ui->powerCloseTB1->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    ui->powerCloseTB2->setIcon(pixmap);
    ui->powerCloseTB2->setIconSize(pixmap.size());
    ui->powerCloseTB2->setStyleSheet("QToolButton{border-radius:5px;border-width:0px;}");

    pixmap.load(":/images/intehomefurn/2.png");
    ui->label_7->setPixmap(pixmap);
    pixmap.load(":/images/intehomefurn/3.png");
    ui->label_8->setPixmap(pixmap);
    pixmap.load(":/images/intehomefurn/4.png");
    ui->label_9->setPixmap(pixmap);
    pixmap.load(":/images/intehomefurn/5.png");
    ui->label_10->setPixmap(pixmap);
    pixmap.load(":/images/intehomefurn/6.png");
    ui->label_11->setPixmap(pixmap);
    pixmap.load(":/images/intehomefurn/7.png");
    ui->label_12->setPixmap(pixmap);

    fengshanStatus=false;
    yuyinStatus=false;

    ui->label->setVisible(false);
    ui->label_2->setVisible(false);
    ui->label_3->setVisible(false);
    ui->label_4->setVisible(false);
    ui->label_5->setVisible(false);
    ui->label_6->setVisible(false);

    pixmap.load(":/images/inteagri/30.png");
    ui->pix1Label->setScaledContents(true);
    ui->pix1Label->setPixmap(pixmap);
    ui->pix2Label->setScaledContents(true);
    ui->pix2Label->setPixmap(pixmap);
    ui->pix3Label->setScaledContents(true);
    ui->pix3Label->setPixmap(pixmap);
    ui->pix4Label->setScaledContents(true);
    ui->pix4Label->setPixmap(pixmap);
    ui->pix5Label->setScaledContents(true);
    ui->pix5Label->setPixmap(pixmap);
    ui->pix6Label->setScaledContents(true);
    ui->pix6Label->setPixmap(pixmap);
    ui->pix7Label->setScaledContents(true);
    ui->pix7Label->setPixmap(pixmap);
    ui->pix8Label->setScaledContents(true);
    ui->pix8Label->setPixmap(pixmap);
    ui->pix9Label->setScaledContents(true);
    ui->pix9Label->setPixmap(pixmap);
    ui->pix10Label->setScaledContents(true);
    ui->pix10Label->setPixmap(pixmap);
    ui->pix11Label->setScaledContents(true);
    ui->pix11Label->setPixmap(pixmap);
    ui->pix12Label->setScaledContents(true);
    ui->pix12Label->setPixmap(pixmap);
    ui->pix13Label->setScaledContents(true);
    ui->pix13Label->setPixmap(pixmap);
    ui->pix14Label->setScaledContents(true);
    ui->pix14Label->setPixmap(pixmap);
    ui->pix15Label->setScaledContents(true);
    ui->pix15Label->setPixmap(pixmap);
    ui->pix16Label->setScaledContents(true);
    ui->pix16Label->setPixmap(pixmap);
    ui->pix17Label->setScaledContents(true);
    ui->pix17Label->setPixmap(pixmap);
    ui->pix18Label->setScaledContents(true);
    ui->pix18Label->setPixmap(pixmap);

    pixmap.load(":/images/intehomefurn/off.png");
    ui->fengshanLabel->setScaledContents(true);
    ui->fengshanLabel->setPixmap(pixmap);

    ui->yuyinLabel->setScaledContents(true);
    ui->yuyinLabel->setPixmap(pixmap);

    ui->sunLineEdit->setReadOnly(true);
    ui->sunLineEdit->setAlignment(Qt::AlignRight);
    ui->sunLineEdit->setMaxLength(15);

    ui->tempLineEdit->setReadOnly(true);
    ui->tempLineEdit->setAlignment(Qt::AlignRight);
    ui->tempLineEdit->setMaxLength(15);

    ui->humLineEdit->setReadOnly(true);
    ui->humLineEdit->setAlignment(Qt::AlignRight);
    ui->humLineEdit->setMaxLength(15);

    ui->sunLineEdit->setText("0");
    ui->tempLineEdit->setText("0");
    ui->humLineEdit->setText("0");

    for(int i=0;i<3;i++)
        changeNum[i]=false;

    for(int i=0;i<4;i++)
        countNum[i]=0;

    initval=0x40;
    countSMG=0;

    FsunPreVal=20;
    FtempPreVal=20;
    FhumPreVal=20;

    LEDStatus=false;
    SMGStatus=false;
    power1Status=false;
    power2Status=false;

    ui->pagelabel1->setVisible(false);
    ui->pagelabel2->setVisible(false);
    ui->pagelabel3->setVisible(false);
    ui->pagelabel4->setVisible(false);
    ui->pagelabel5->setVisible(false);
    ui->pagelabel6->setVisible(false);

    ui->sunValLabel1->setText(QString::number(FsunPreVal));
    ui->tempValLabel1->setText(QString::number(FtempPreVal));
    ui->humValLabel1->setText(QString::number(FhumPreVal));
    ui->sunValLabel6->setText(QString::number(FsunPreVal));
    ui->tempValLabel6->setText(QString::number(FtempPreVal));
    ui->humValLabel6->setText(QString::number(FhumPreVal));

    connect(ui->sunLineEdit,SIGNAL(selectionChanged()),this,SLOT(lineClick1()));
    connect(ui->tempLineEdit,SIGNAL(selectionChanged()),this,SLOT(lineClick2()));
    connect(ui->humLineEdit,SIGNAL(selectionChanged()),this,SLOT(lineClick3()));

    m_timer=new QTimer(this);
    connect(m_timer,SIGNAL(timeout()),this,SLOT(readInfo()));
//    m_timer->start(2000);
    
    vKey=new VKey(this);
    ui->stackedWidget->setCurrentIndex(0);

    fan_pix[0].load(":/images/fan/f1.png");
    fan_pix[1].load(":/images/fan/f2.png");
    fan_pix[2].load(":/images/fan/f3.png");
    fan_pix[3].load(":/images/fan/f4.png");
    fan_pix[4].load(":/images/fan/f5.png");
    fan_pix[5].load(":/images/fan/f6.png");
    fan_pix[6].load(":/images/fan/f7.png");
    fan_pix[7].load(":/images/fan/f8.png");
    ui->fengshanLabel->setPixmap(fan_pix[0]);
    fan_timer =  new QTimer(this);
    connect(fan_timer,SIGNAL(timeout()),this,SLOT(runFan()));
//    fan_timer->start(250);
    fan_count=-1;
}
Exemplo n.º 30
0
ribi::cmap::QtConceptMap::QtConceptMap(QWidget* parent)
  : QtKeyboardFriendlyGraphicsView(parent),
    m_arrow{new QtNewArrow},
    m_conceptmap{},
    m_examples_item(new QtExamplesItem),
    m_highlighter{new QtItemHighlighter},
    m_mode{Mode::uninitialized},
    m_tools{new QtTool}
{
  #ifndef NDEBUG
  this->SetVerbosity(false);
  #endif
  this->setScene(new QGraphicsScene(this));
  assert(!m_highlighter->GetItem());

  //Add QtNewArrow
  assert(!m_arrow->scene());
  scene()->addItem(m_arrow); //Add the QtNewArrow so it has a parent
  assert(m_arrow->scene());

  m_arrow->hide();
  assert(!m_arrow->isVisible());

  //Add QtExamplesItem
  assert(!m_examples_item->scene());
  scene()->addItem(m_examples_item); //Add the examples so it has a parent
  assert(m_examples_item->scene());

  //Add QtTool
  assert(!m_tools->scene());
  this->scene()->addItem(m_tools);
  assert(m_tools->scene());

  //Responds when selectionChanged is triggered


  assert(Collect<QtNode>(scene()).empty());

  //Without this line, mouseMoveEvent won't be called
  this->setMouseTracking(true);

  {
    assert(this->scene());
    QLinearGradient linearGradient(-500,-500,500,500);
    linearGradient.setColorAt(0.0,QColor(214,214,214));
    linearGradient.setColorAt(1.0,QColor(255,255,255));
    this->scene()->setBackgroundBrush(linearGradient);
    //this->scene()->setBackgroundBrush(QBrush(QColor(255,255,255)));
  }

  //Connect the scene
  #if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
  QObject::connect(scene(),SIGNAL(focusItemChanged(QGraphicsItem*,QGraphicsItem*,Qt::FocusReason)),this,SLOT(onFocusItemChanged(QGraphicsItem*,QGraphicsItem*,Qt::FocusReason)));
  #else

  #endif
  QObject::connect(scene(),SIGNAL(selectionChanged()),this,SLOT(onSelectionChanged()));

  m_examples_item->SetCenterPos(123,456); //Irrelevant where

  CheckInvariants();

  {
    QTimer * const timer{new QTimer(this)};
    QObject::connect(timer, SIGNAL(timeout()), this, SLOT(onCheckCollision()));
    timer->start(10);
  }
}