コード例 #1
0
BOOL LLSplitButton::handleMouseUp(S32 x, S32 y, MASK mask)
{
	gFocusMgr.setMouseCapture(NULL);

	if (mShownItem->parentPointInView(x, y))
	{
		onItemSelected(mShownItem);
		return TRUE;
	}

	for (std::list<LLButton*>::const_iterator it = mHidenItems.begin(); it != mHidenItems.end(); ++it)
	{
		LLButton* item = *it;

		S32 panel_x = 0;
		S32 panel_y = 0;
		localPointToOtherView(x, y, &panel_x, &panel_y, mItemsPanel);

		if (item->parentPointInView(panel_x, panel_y))
		{
			onItemSelected(item);
			return TRUE;
		}
	}
	return TRUE;
}
コード例 #2
0
ChangeSalary::ChangeSalary(Widget* p, unsigned int salary)
  : Window( p, Rect(), "" ), __INIT_IMPL(ChangeSalaryWindow)
{
  setupUI( ":/gui/changesalary.gui");
  setCenter( parent()->center() );

  _dfunc()->newSalary = salary;

  ListBox* lbxTitles;
  GET_WIDGET_FROM_UI( lbxTitles )
  if( lbxTitles )
  {
    world::GovernorRanks ranks = world::EmpireHelper::ranks();
    for( auto rank : ranks )
    {
      std::string salaryStr = _( "##" + rank.rankName + "_salary##" );
      ListBoxItem& item = lbxTitles->addItem( salaryStr + "   " + utils::i2str( rank.salary ) );
      item.setTag( rank.salary );
      if( rank.salary == salary )
      {
        lbxTitles->setSelected( lbxTitles->itemsCount() - 1 );
      }
    }
  }

  INIT_WIDGET_FROM_UI( PushButton*, btnCancel  )
  INIT_WIDGET_FROM_UI( PushButton*, btnOk )

  CONNECT( btnCancel, onClicked(), this, ChangeSalary::deleteLater );
  CONNECT( btnOk, onClicked(), _dfunc().data(), Impl::setNewSalary );
  CONNECT( btnOk, onClicked(), this, ChangeSalary::deleteLater  );
  CONNECT( lbxTitles, onItemSelected(), _dfunc().data(), Impl::resolveSalaryChange );
}
コード例 #3
0
void
ItemSelectorWidget::setType( Type type )
{
    if (type == User)
        layout()->addItem( new QWidgetItem( ui.searchBox = new UserSearch( this ) ) );
    else
        layout()->addItem( new QWidgetItem( ui.searchBox = new TagSearch( this ) ) );

    ui.searchBox->setFrame( false );
    ui.searchBox->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );

    setFocusPolicy( Qt::StrongFocus );
    setFocusProxy( ui.searchBox );

    connect( ui.searchBox, SIGNAL(editingFinished()), SLOT(onItemSelected()) );
    connect( ui.searchBox->completer()->popup(), SIGNAL(clicked(QModelIndex)), SLOT(onItemSelected()));
    connect( ui.searchBox, SIGNAL(textChanged(QString)), SLOT(onTextChanged(QString)));

    connect( ui.searchBox, SIGNAL(commaPressed()), SLOT(onItemSelected()) );
    connect( ui.searchBox, SIGNAL(deletePressed()), SLOT(onDeletePressed()) );
}
コード例 #4
0
LoadFileDialog::LoadFileDialog( Widget* parent, const Rect& rect,
                              const vfs::Directory& dir, const std::string& ext,
                              int id )
  : Window( parent, rect, "", id ), _d( new Impl )
{
  Widget::setupUI( ":/gui/loadfile.gui" );
  setCenter( parent->center() );

  // create the title
  GET_DWIDGET_FROM_UI( _d, lbTitle )

  _d->directory = dir;
  _d->fileExtension = ext;

  GET_DWIDGET_FROM_UI( _d, btnExit )
  GET_DWIDGET_FROM_UI( _d, btnHelp )
  GET_DWIDGET_FROM_UI( _d, btnLoad )
  GET_DWIDGET_FROM_UI( _d, btnDelete )
  GET_DWIDGET_FROM_UI( _d, lbxFiles )

  CONNECT( _d->btnExit, onClicked(), this, LoadFileDialog::deleteLater );
  CONNECT( _d->btnLoad, onClicked(), _d.data(), Impl::emitSelectFile );
  CONNECT( _d->btnDelete, onClicked(), _d.data(), Impl::deleteFile );

  if( _d->lbxFiles )
  {
    _d->lbxFiles->setItemDefaultColor( ListBoxItem::simple, 0xffffffff );
    _d->lbxFiles->setItemDefaultColor( ListBoxItem::hovered, 0xff000000 );
  }

  CONNECT( _d->lbxFiles, onItemSelected(), _d.data(), Impl::resolveItemSelected )
  CONNECT( _d->lbxFiles, onItemSelectedAgain(), _d.data(), Impl::resolveItemDblClick );
  _d->fillFiles();

  setMayDelete( false );
}
コード例 #5
0
ファイル: lookalikemain_p.cpp プロジェクト: Igalia/lookalike
LookAlikeMainPrivate::LookAlikeMainPrivate(LookAlikeMain *q) :
    QObject(q),
    m_currentAction(0),
    q_ptr(q)
{
    // Less correct the problem with the DB first of all, if no other
    // application has dealt with it first.
    m_faceRecognitionResetter = new FaceRecognitionResetter();
    if (!m_faceRecognitionResetter->isDBCorrected()) {
        m_faceRecognitionResetter->dealWithDB(1);
    }

    m_galleryModel = new GalleryModel(this);
    m_galleryModel->setFaceRecognitionEnabled(true);
    QSparqlConnection *connection = m_galleryModel->sparqlConnection();
    m_trackerProvider = new TrackerContentProvider(connection, this);
    m_galleryModel->addContentProvider(m_trackerProvider);
    m_faceDatabaseProvider = new FaceDatabaseProvider(connection, this);
    m_faceTrackerProvider = new FaceTrackerProvider(connection, this);
    m_confirmedContactsListPage = new GalleryPeopleListPage(m_faceTrackerProvider->model());
    m_proposedContactsListPage = new GalleryPeopleListPage(m_faceDatabaseProvider);
    m_gridPage = new GalleryGridPage(*m_galleryModel);
    m_fullScreenPage = new GalleryFullScreenPage(*m_galleryModel);

    m_confirmedContactsListPage->setStyleName("GalleryPage");
    m_proposedContactsListPage->setStyleName("GalleryPage");
    m_gridPage->setStyleName("GalleryPage");
    m_fullScreenPage->setStyleName("GalleryPage");

    MAction* allTabAction = new MAction("icon-m-toolbar-all-content-white", "", q);
    allTabAction->setLocation(MAction::ToolBarLocation);
    allTabAction->setCheckable(true);

    MAction* confirmedContactsTabAction = new MAction("icon-m-toolbar-known-people-white", "", q);
    confirmedContactsTabAction->setLocation(MAction::ToolBarLocation);
    confirmedContactsTabAction->setCheckable(true);

    MAction* proposedContactsAction = new MAction("icon-m-toolbar-unknown-people-white", "", q);
    proposedContactsAction->setLocation(MAction::ToolBarLocation);
    proposedContactsAction->setCheckable(true);

    MAction* landscapeTabAction = new MAction("icon-m-toolbar-no-people-white", "", q);
    landscapeTabAction->setLocation(MAction::ToolBarLocation);
    landscapeTabAction->setCheckable(true);

    QList<QAction*> actions;
    actions.append(allTabAction);
    actions.append(confirmedContactsTabAction);
    actions.append(proposedContactsAction);
    actions.append(landscapeTabAction);

    MToolBar* toolbar = new MToolBar();
    toolbar->setStyleName("MToolbarTabStyleInverted");
    toolbar->setOpacity(0.9);
    toolbar->setViewType(MToolBar::tabType);
    toolbar->addActions(actions);

    m_toolbarAction = new MWidgetAction(q);
    m_toolbarAction->setLocation(MAction::ToolBarLocation);
    m_toolbarAction->setWidget(toolbar);

    m_confirmFaceAction = new MAction("Confirm faces", q);
    m_confirmFaceAction->setLocation(MAction::ApplicationMenuLocation);
    m_deleteFaceAction = new MAction("Delete faces", q);
    m_deleteFaceAction->setLocation(MAction::ApplicationMenuLocation);
    m_aboutAction = new MAction("About", q);
    m_aboutAction->setLocation(MAction::ApplicationMenuLocation);

    const QPixmap *pixmap = MTheme::pixmap("icon-m-toolbar-view-menu-dimmed-white");
    MImageWidget *menuImage = new MImageWidget();
    menuImage->setImage(pixmap->toImage());
    menuImage->setZoomFactor(1.f);
    menuImage->setMinimumWidth(88.f);
    MTheme::releasePixmap(pixmap);
    MWidgetAction* fakeAction= new MWidgetAction(q);
    fakeAction->setLocation(MAction::ToolBarLocation);
    fakeAction->setWidget(menuImage);

    m_confirmedContactsListPage->addAction(m_toolbarAction);
    m_confirmedContactsListPage->addAction(fakeAction);

    m_proposedContactsListPage->addAction(m_toolbarAction);
    m_proposedContactsListPage->addAction(fakeAction);

    connect(m_confirmedContactsListPage, SIGNAL(personSelected(QString,QString)),
            this, SLOT(onConfirmedContactSelected(QString,QString)));
    connect(m_proposedContactsListPage, SIGNAL(personSelected(QString,QString)),
            this, SLOT(onProposedContactPersonSelected(QString,QString)));
    connect(m_gridPage, SIGNAL(multiSelectionDone(QList<QUrl>)),
            this, SLOT(onMultiSelectionDone(QList<QUrl>)));
    connect(m_gridPage, SIGNAL(itemSelected(QUrl)),
            this, SLOT(onItemSelected(QUrl)));
    connect(m_fullScreenPage, SIGNAL(itemDeleted(QUrl)),
            m_faceDatabaseProvider, SLOT(update()));
    connect(m_trackerProvider, SIGNAL(dataChanged()),
            this, SLOT(onDataChanged()));
    connect(m_confirmFaceAction, SIGNAL(triggered()),
            this, SLOT(onConfirmFaceActionTriggered()));
    connect(m_deleteFaceAction, SIGNAL(triggered()),
            this, SLOT(onDeleteFaceActionTriggered()));
    connect(m_aboutAction, SIGNAL(triggered()),
            this, SLOT(onAboutActionTriggered()));
    connect(allTabAction, SIGNAL(toggled(bool)),
            this, SLOT(onAllTabActionToggled(bool)));
    connect(confirmedContactsTabAction, SIGNAL(toggled(bool)),
            this, SLOT(onConfirmedContactTabActionToggled(bool)));
    connect(proposedContactsAction, SIGNAL(toggled(bool)),
            this, SLOT(onProposedContactTabActionToggled(bool)));
    connect(landscapeTabAction, SIGNAL(toggled(bool)),
            this, SLOT(onLandscapeTabActionToggled(bool)));
    connect(m_gridPage, SIGNAL(appeared()),
            this, SLOT(onGridPageAppeared()));
    connect(m_fullScreenPage, SIGNAL(appeared()),
            this, SLOT(onFullscreenPageAppeared()));
    connect(m_fullScreenPage, SIGNAL(loadingActiveItemFailed(QString)),
            m_fullScreenPage, SLOT(disappear()));
    connect(m_galleryModel, SIGNAL(galleryItemsRemoved(int,int)),
            this, SLOT(onGalleryItemsRemoved()));

    allTabAction->toggle();
}
コード例 #6
0
MusicFilesWidget::MusicFilesWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MusicFilesWidget)
{
    m_instance = this;
    Manager::instance()->setMusicFilesWidget(this);
    ui->setupUi(this);

    m_proxyModel = new MusicProxyModel(this);
    m_proxyModel->setSourceModel(Manager::instance()->musicModel());
    ui->music->setModel(m_proxyModel);
    ui->music->sortByColumn(0, Qt::AscendingOrder);
    ui->music->setAttribute(Qt::WA_MacShowFocusRect, false);

    ui->statusLabel->setText(tr("%n artist(s)", "", 0) + ", " + tr("%n album(s)", "", 0));

#ifdef Q_OS_WIN
    ui->music->setAnimated(false);
#endif

    connect(ui->music->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(onItemSelected(QModelIndex)), Qt::QueuedConnection);
    connect(m_proxyModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(updateStatusLabel()));
    connect(m_proxyModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(updateStatusLabel()));
}
コード例 #7
0
ファイル: AnimationEventsEditor.cpp プロジェクト: dabroz/Tamy
AnimationEventsEditor::AnimationEventsEditor( BlendTreeAnimation& animationNode )
   : BTBFEditor( animationNode )
   , m_animationNode( animationNode )
   , m_animationToggled( false )
   , m_mainEditor( NULL )
{
   QVBoxLayout* layout = new QVBoxLayout( this );
   layout->setSpacing( 0 );
   layout->setMargin( 0 );
   setLayout( layout );

   // event properties view
   {
      m_eventProperties = new QPropertiesView();
      layout->addWidget( m_eventProperties );
   }

   // slider control frame
   QFrame* sliderControlFrame = new QFrame( this );
   {
      layout->addWidget( sliderControlFrame );

      QHBoxLayout* sliderControlFrameLayout = new QHBoxLayout( sliderControlFrame );
      sliderControlFrameLayout->setSpacing( 0 );
      sliderControlFrameLayout->setMargin( 0 );
      sliderControlFrame->setLayout( sliderControlFrameLayout );

      // simulation/animation toggle button
      m_animationToggleButton = new QPushButton( sliderControlFrame );
      {
         sliderControlFrameLayout->addWidget( m_animationToggleButton );
         m_animationToggleButton->setIcon( QIcon( ":/TamyEditor/Resources/Icons/Editor/linkInactive.png" ) );
         m_animationToggleButton->setMinimumSize( 54, 54 );
         m_animationToggleButton->setMaximumSize( 54, 54 );
         connect( m_animationToggleButton, SIGNAL( clicked( bool ) ), this, SLOT( onAnimationToggled( bool ) ) );
      }

      // slider frame
      QFrame* sliderFrame = new QFrame( sliderControlFrame );
      {
         sliderControlFrameLayout->addWidget( sliderFrame );

         QVBoxLayout* sliderFrameLayout = new QVBoxLayout( sliderFrame );
         sliderFrameLayout->setSpacing( 0 );
         sliderFrameLayout->setMargin( 0 );
         sliderFrame->setLayout( sliderFrameLayout );

         // events display
         {
            m_view = new AnimationEventsTimeline( sliderFrame );
            connect( m_view, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( onShowContextMenu( const QPoint& ) ) );
            sliderFrameLayout->addWidget( m_view );

            m_eventsScene = new QGraphicsScene();
            m_view->setScene( m_eventsScene );

            connect( m_eventsScene, SIGNAL( selectionChanged() ), this, SLOT( onItemSelected() ) );
         }

         // slider 
         m_slider = new QSlider( Qt::Horizontal, sliderFrame );
         {
            sliderFrameLayout->addWidget( m_slider, 0 );
         }
      }
   }

   // listen to changes in the node
   m_animationNode.attachListener( *this );

   m_animationNode.attachEventsListener( this );
   m_animationNode.pullEvents( this );

   // create a custom animation player set up to play the animation stored in the node
   m_customAnimationPlayer = new SkeletonAnimationPlayer();
   {
      SnapshotAnimation* anim = m_animationNode.getAnimation();
      m_customAnimationPlayer->setAnimationSource( anim );
   }

   // this class needs to be updated every frame to track the progress
   // of the animation player and display it on the time slider
   TimeController& timeController = TSingleton< TimeController >::getInstance();
   timeController.add( *this );
}