Ejemplo n.º 1
0
bool InputLineEdit::eventFilter(QObject * o, QEvent * e)
{
    switch (e->type()) {
	case QEvent::KeyPress:
	{
	    QKeyEvent *ev = (QKeyEvent *) e;

	    switch (ev->key()) {
		case Key_Up:
		    emit upPressed();
		    return true;
		case Key_Down:
		    emit downPressed();
		    return true;
		case Key_Return:
		case Key_Enter:
		    emit returnPressed();
		    return true;
		    break;
		case Key_Tab:
		    emit tabPressed();
		    return true;
		    break;
		default:
		    return QLineEdit::eventFilter(o, e);
	    }
	    break;
	}
	default:
	    return QLineEdit::eventFilter(o, e);
    }
    return QLineEdit::eventFilter(o, e);
}
Ejemplo n.º 2
0
void MyDoubleSpinBox::focusInEvent(QFocusEvent *event)
{
	QDoubleSpinBox::focusInEvent(event);

	QString type = GetType(objectName());
	if (type != "text")
	{
		if (!slider)
		{
			QWidget *topWidget = window();
			slider = new cFrameSliderPopup(topWidget);
			slider->setFocusPolicy(Qt::NoFocus);

			if (type == QString("spinboxd") || type == QString("spinboxd3")
					|| type == QString("spinboxd4"))
			{
				int dialScale = pow(10.0, double(decimals()));
				slider->SetDialMode(dialScale, value());
				hasDial = true;
			}

			slider->hide();
		}

		QWidget *topWidget = window();
		QPoint windowPoint = mapTo(topWidget, QPoint());
		int width = this->width();
		int hOffset = height();
		slider->adjustSize();
		QSize minimumSize = slider->minimumSizeHint();
		width = max(width, int(minimumSize.width() * 0.6));
		slider->setFixedWidth(width);

		if (windowPoint.y() + slider->height() + hOffset > topWidget->height())
			hOffset = -slider->height();

		slider->move(windowPoint.x(), windowPoint.y() + hOffset);
		slider->show();

		connect(slider, SIGNAL(resetPressed()), this, SLOT(slotResetToDefault()));
		connect(slider, SIGNAL(intPressed()), this, SLOT(slotRoundValue()));

		if (hasDial)
		{
			connect(this, SIGNAL(valueChanged(double)), slider, SLOT(slotUpdateValue(double)));
			connect(slider, SIGNAL(valueChanged(double)), this, SLOT(setValue(double)));
			connect(slider, SIGNAL(upPressed()), this, SLOT(slotZeroValue()));
			connect(slider, SIGNAL(downPressed()), this, SLOT(slot180Value()));
			connect(slider, SIGNAL(rightPressed()), this, SLOT(slot90Value()));
			connect(slider, SIGNAL(leftPressed()), this, SLOT(slotMinus90Value()));
		}
		else
		{
			connect(slider, SIGNAL(timerTrigger()), this, SLOT(slotSliderTimerUpdateValue()));
			connect(slider, SIGNAL(zeroPressed()), this, SLOT(slotZeroValue()));
			connect(slider, SIGNAL(halfPressed()), this, SLOT(slotHalfValue()));
			connect(slider, SIGNAL(doublePressed()), this, SLOT(slotDoubleValue()));
			connect(slider, SIGNAL(minusPressed()), this, SLOT(slotInvertSign()));
		}
	}
Ejemplo n.º 3
0
	EMenuScreen IMenuScreen::run(MainWindow& window, EMenuScreen)
	{		
		IControllerToMenu* controller = PolyBomberApp::getIControllerToMenu();

		EMenuScreen nextScreen = NONEMENU;

		try
		{
			while (nextScreen == NONEMENU)
			{			
				window.clear();
				window.display(this->widgets);

				loopAction(&nextScreen);

				window.clear();
				window.display(this->widgets);

				EMenuKeys key = MENU_NONE;
				while ((key = controller->getKeyPressed()) == MENU_NONE && window.isOpen());

				switch(key)
				{
					case MENU_DOWN:
						downPressed();
						break;
					case MENU_UP:
						upPressed();
						break;
					case MENU_LEFT:
						leftPressed();
						break;
					case MENU_RIGHT:
						rightPressed();
						break;
					case MENU_VALID:
						validPressed(&nextScreen);
						break;
					case MENU_BACK:
						backPressed(&nextScreen);
						break;
					default:
						break;
				}

				if (!window.isOpen())
					nextScreen = EXIT;
			}
		}
		catch (PolyBomberException& e)
		{
			std::cerr << e.what() << std::endl;
			PolyBomberApp::getINetworkToMenu()->cancel();
			nextScreen = GAMEMENU;
		}
		
		return nextScreen;
	}
Ejemplo n.º 4
0
void AppFilter::whichKey(QEvent* event)
{
  QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
  if(keyEvent->key() == Qt::Key_Left)
  {
    emit leftPressed();
  }
  else if(keyEvent->key() == Qt::Key_Up)
  {
    emit upPressed();
  }
  else if(keyEvent->key() == Qt::Key_Down)
  {
    emit downPressed();
  }
  else if(keyEvent->key() == Qt::Key_Right)
  {
    emit rightPressed();
  }
}
Ejemplo n.º 5
0
void GuiCommandEdit::keyPressEvent(QKeyEvent * e)
{
	switch (e->key()) {
	case Qt::Key_Escape:
		// emit signal
		escapePressed();
		break;

	case Qt::Key_Up:
		// emit signal
		upPressed();
		break;

	case Qt::Key_Down:
		// emit signal
		downPressed();
		break;

	default:
		QLineEdit::keyPressEvent(e);
		break;
	}
}
Ejemplo n.º 6
0
void RegionEditDialog::on_addButton_clicked()
{
    RectFrame *aFrame=new RectFrame(mAttributes, this);

    if (ui->itemsLayout->count()==0)
    {
        aFrame->setUpEnabled(false);
    }
    else
    {
        ((RectFrame *)ui->itemsLayout->itemAt(ui->itemsLayout->count()-1)->widget())->setDownEnabled(true);
    }

    aFrame->setDownEnabled(false);

    connect(aFrame, SIGNAL(upPressed()),     this, SLOT(itemUp()));
    connect(aFrame, SIGNAL(downPressed()),   this, SLOT(itemDown()));
    connect(aFrame, SIGNAL(deletePressed()), this, SLOT(itemDelete()));

    ui->itemsLayout->addWidget(aFrame);
    ui->mainScrollArea->verticalScrollBar()->setValue(ui->mainScrollArea->verticalScrollBar()->maximum());

    updateCountButtons();
}
Ejemplo n.º 7
0
	MainPage::MainPage(QWidget* parent)
		: QWidget(parent)
		, search_widget_(new SearchWidget(8, false, this))
		, contact_dialog_(new ContactDialog(this))
        , video_window_(new VideoWindow())
		, video_panel_(new CallPanelMain(this))
		, pages_(new WidgetsNavigator(this))
		, search_contacts_(nullptr)
        , profile_settings_(new ProfileSettingsWidget(this))
        , general_settings_(new GeneralSettingsWidget(this))
        , noContactsYetSuggestions_(nullptr)
        , contact_list_widget_(new ContactList(this, Logic::MembersWidgetRegim::CONTACT_LIST, NULL))
        , add_contact_menu_(0)
    {
        connect(&Utils::InterConnector::instance(), SIGNAL(showNoContactsYetSuggestions()), this, SLOT(showNoContactsYetSuggestions()));
        connect(&Utils::InterConnector::instance(), SIGNAL(hideNoContactsYetSuggestions()), this, SLOT(hideNoContactsYetSuggestions()));

        if (this->objectName().isEmpty())
            this->setObjectName(QStringLiteral("main_page"));
        this->resize(400, 300);
        this->setProperty("Invisible", QVariant(true));
        horizontal_layout_ = new QHBoxLayout(this);
        horizontal_layout_->setSpacing(0);
        horizontal_layout_->setObjectName(QStringLiteral("horizontalLayout"));
        horizontal_layout_->setContentsMargins(0, 0, 0, 0);
        QMetaObject::connectSlotsByName(this);

        QHBoxLayout* originalLayout = qobject_cast<QHBoxLayout*>(layout());
        QVBoxLayout* contactsLayout = new QVBoxLayout();
        contactsLayout->setContentsMargins(0, 0, 0, 0);
        contactsLayout->setSpacing(0);
        assert(video_panel_);
        if (video_panel_) {
            contactsLayout->addWidget(video_panel_);
            video_panel_->hide();
        }

        contactsLayout->addWidget(search_widget_);
        contactsLayout->addWidget(contact_list_widget_);
        QSpacerItem* contactsLayoutSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum);
        contactsLayout->addSpacerItem(contactsLayoutSpacer);

        pages_layout_ = new QVBoxLayout();
        pages_layout_->setContentsMargins(0, 0, 0, 0);
        pages_layout_->setSpacing(0);
        pages_layout_->addWidget(pages_);
        {
            auto pc = pages_->count();
            pages_->addWidget(contact_dialog_);
            pages_->addWidget(profile_settings_);
            pages_->addWidget(general_settings_);
            if (!pc)
                pages_->push(contact_dialog_);
        }
        originalLayout->addLayout(contactsLayout);
        originalLayout->addLayout(pages_layout_);
        QSpacerItem* originalLayoutSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum);
        originalLayout->addSpacerItem(originalLayoutSpacer);
        originalLayout->setAlignment(Qt::AlignLeft);
        setFocus();

        connect(contact_list_widget_, SIGNAL(itemSelected(QString)), contact_dialog_, SLOT(onContactSelected(QString)), Qt::QueuedConnection);
        connect(contact_dialog_, SIGNAL(sendMessage(QString)), contact_list_widget_, SLOT(onSendMessage(QString)), Qt::QueuedConnection);

        connect(contact_list_widget_, SIGNAL(itemSelected(QString)), this, SLOT(onContactSelected(QString)), Qt::QueuedConnection);
        connect(contact_list_widget_, SIGNAL(addContactClicked()), this, SLOT(onAddContactClicked()), Qt::QueuedConnection);

        connect(&Utils::InterConnector::instance(), SIGNAL(profileSettingsShow(QString)), this, SLOT(onProfileSettingsShow(QString)), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(generalSettingsShow(int)), this, SLOT(onGeneralSettingsShow(int)), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(profileSettingsBack()), pages_, SLOT(pop()), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(generalSettingsBack()), pages_, SLOT(pop()), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(makeSearchWidgetVisible(bool)), search_widget_, SLOT(setVisible(bool)), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(popPagesToRoot()), pages_, SLOT(poproot()), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(profileSettingsDoMessage(QString)), contact_list_widget_, SLOT(select(QString)), Qt::QueuedConnection);

        connect(search_widget_, SIGNAL(searchBegin()), this, SLOT(searchBegin()), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(searchEnd()), this, SLOT(searchEnd()), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(search(QString)), Logic::GetSearchModel(), SLOT(searchPatternChanged(QString)), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(enterPressed()), contact_list_widget_, SLOT(searchResult()), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(upPressed()), contact_list_widget_, SLOT(searchUpPressed()), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(downPressed()), contact_list_widget_, SLOT(searchDownPressed()), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(nonActiveButtonPressed()), this, SLOT(addButtonClicked()), Qt::QueuedConnection);
        connect(contact_list_widget_, SIGNAL(searchEnd()), search_widget_, SLOT(searchCompleted()), Qt::QueuedConnection);

        connect(Logic::GetContactListModel(), SIGNAL(selectedContactChanged(QString)), Logic::GetMessagesModel(), SLOT(contactChanged(QString)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipShowVideoWindow(bool)), this, SLOT(onVoipShowVideoWindow(bool)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallIncoming(const std::string&, const std::string&)), this, SLOT(onVoipCallIncoming(const std::string&, const std::string&)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallIncomingAccepted(const voip_manager::ContactEx&)), this, SLOT(onVoipCallIncomingAccepted(const voip_manager::ContactEx&)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallDestroyed(const voip_manager::ContactEx&)), this, SLOT(onVoipCallDestroyed(const voip_manager::ContactEx&)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallCreated(const voip_manager::ContactEx&)), this, SLOT(onVoipCallCreated(const voip_manager::ContactEx&)), Qt::DirectConnection);

        search_widget_->setVisible(!contact_list_widget_->shouldHideSearch());
	}
Ejemplo n.º 8
0
Playlist::Widget::Widget( QWidget* parent )
        : KVBox( parent )
{
    setContentsMargins( 1, 1, 1, 1 );

    m_searchWidget = new ProgressiveSearchWidget( this );

    //this is really only useful for debugging at the moment, so dont show it to users and testers
    /*m_sortBox = new QComboBox( this );
    m_sortBox->insertItem( 0, "Album", Album);
    m_sortBox->insertItem( 1, "AlbumArtist", Album);
    m_sortBox->insertItem( 2, "Artist", Artist );
    m_sortBox->insertItem( 3, "Bitrate", Bitrate );
    m_sortBox->insertItem( 4, "Bpm", Bpm );
    m_sortBox->insertItem( 5, "Comment", Comment );
    m_sortBox->insertItem( 6, "Composer", Composer );
    m_sortBox->insertItem( 7, "Directory", Directory );
    m_sortBox->insertItem( 8, "DiscNumber", DiscNumber );
    m_sortBox->insertItem( 9, "Filename", Filename );
    m_sortBox->insertItem( 10, "Filesize", Filesize );
    m_sortBox->insertItem( 11, "Genre", Genre );
    m_sortBox->insertItem( 12, "LastPlayed", LastPlayed );
    m_sortBox->insertItem( 13, "Length", Length );
    m_sortBox->insertItem( 14, "Mood", Mood );
    m_sortBox->insertItem( 15, "PlayCount", PlayCount );
    m_sortBox->insertItem( 16, "Rating", Rating );
    m_sortBox->insertItem( 17, "SampleRate", SampleRate );
    m_sortBox->insertItem( 18, "Score", Score );
    m_sortBox->insertItem( 29, "Source", Source );
    m_sortBox->insertItem( 30, "Title", Title );
    m_sortBox->insertItem( 31, "TrackNumber", TrackNumber );
    m_sortBox->insertItem( 32, "Type", Type );
    m_sortBox->insertItem( 33, "Year", Year );

    connect( m_sortBox, SIGNAL( activated( int ) ), this, SLOT( sort( int ) ) );*/
    
    QWidget * layoutHolder = new QWidget( this );

    QVBoxLayout* mainPlaylistlayout = new QVBoxLayout( layoutHolder );
    mainPlaylistlayout->setContentsMargins( 0, 0, 0, 0 );

    m_playlistView = new PrettyListView( this );
    m_playlistView->show();

    connect( m_searchWidget, SIGNAL( filterChanged( const QString &, int, bool ) ), m_playlistView, SLOT( find( const QString &, int, bool ) ) );
    connect( m_searchWidget, SIGNAL( next( const QString &, int ) ), m_playlistView, SLOT( findNext( const QString &, int ) ) );
    connect( m_searchWidget, SIGNAL( previous( const QString &, int ) ), m_playlistView, SLOT( findPrevious( const QString &, int ) ) );
    connect( m_searchWidget, SIGNAL( filterCleared() ), m_playlistView, SLOT( clearSearchTerm() ) );
    connect( m_searchWidget, SIGNAL( showOnlyMatches( bool ) ), m_playlistView, SLOT( showOnlyMatches( bool ) ) );
    connect( m_searchWidget, SIGNAL( activateFilterResult() ), m_playlistView, SLOT( playFirstSelected() ) );
    connect( m_searchWidget, SIGNAL( downPressed() ), m_playlistView, SLOT( setFocus() ) );

    connect( m_playlistView, SIGNAL( found() ), m_searchWidget, SLOT( match() ) );
    connect( m_playlistView, SIGNAL( notFound() ), m_searchWidget, SLOT( noMatch() ) );

    connect( LayoutManager::instance(), SIGNAL( activeLayoutChanged() ), m_playlistView, SLOT( reset() ) );

    mainPlaylistlayout->setSpacing( 0 );
    mainPlaylistlayout->addWidget( m_playlistView );

    KHBox *barBox = new KHBox( this );
    barBox->setMargin( 0 );

    KToolBar *plBar = new Amarok::ToolBar( barBox );
    plBar->setObjectName( "PlaylistToolBar" );

    Model::instance();

    // the Controller ctor creates the undo/redo actions that we use below, so we want
    // to make sure that it's been constructed and the the actions registered
    Controller::instance();

    {
        //START Playlist toolbar
        plBar->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred );
        plBar->setIconDimensions( 22 );
        plBar->setMovable( false );
        plBar->addAction( new KToolBarSpacerAction( this ) );

        plBar->addAction( Amarok::actionCollection()->action( "playlist_clear" ) );
        
        //FIXME this action should go in ActionController, but we don't have any visibility to the view
        KAction *action = new KAction( KIcon( "music-amarok" ), i18n("Show active track"), this );
        connect( action, SIGNAL( triggered( bool ) ), m_playlistView, SLOT( scrollToActiveTrack() ) );
        plBar->addAction( action );

        plBar->addSeparator();
        plBar->addAction( Amarok::actionCollection()->action( "playlist_undo" ) );
        plBar->addAction( Amarok::actionCollection()->action( "playlist_redo" ) );
        plBar->addSeparator();
        plBar->addAction( Amarok::actionCollection()->action( "playlist_save" ) );
        plBar->addAction( Amarok::actionCollection()->action( "playlist_export" ) );
        plBar->addSeparator();

        Playlist::LayoutConfigAction *layoutConfigAction = new Playlist::LayoutConfigAction( this );
        plBar->addAction( layoutConfigAction );
        QToolButton *tbutton = qobject_cast<QToolButton*>(plBar->widgetForAction( layoutConfigAction ) );
        if( tbutton )
            tbutton->setPopupMode( QToolButton::InstantPopup );

        plBar->addAction( new KToolBarSpacerAction( this ) );

    } //END Playlist Toolbar

    setFrameShape( QFrame::StyledPanel );
    setFrameShadow( QFrame::Sunken );
}
Ejemplo n.º 9
0
	void SearchWidget::editDownPressed()
	{
		emit downPressed();
	}
Ejemplo n.º 10
0
    MainPage::MainPage(QWidget* parent)
        : QWidget(parent)
        , search_widget_(new SearchWidget(false, this))
        , contact_dialog_(new ContactDialog(this))
#ifndef STRIP_VOIP
        , video_window_(nullptr)
#else
        , video_window_(nullptr)
#endif //STRIP_VOIP
        , pages_(new WidgetsNavigator(this))
        , search_contacts_(nullptr)
        , profile_settings_(new ProfileSettingsWidget(this))
        , general_settings_(new GeneralSettingsWidget(this))
        , live_chats_page_(new LiveChatHome(this))
        , themes_settings_(new ThemesSettingsWidget(this))
        , noContactsYetSuggestions_(nullptr)
        , contact_list_widget_(new ContactList(this, Logic::MembersWidgetRegim::CONTACT_LIST, nullptr))
        , add_contact_menu_(nullptr)
        , settings_timer_(new QTimer(this))
        , introduceYourselfSuggestions_(nullptr)
        , needShowIntroduceYourself_(false)
        , liveChats_(new LiveChats(this))
        , login_new_user_(false)
        , recv_my_info_(false)
    {
        connect(&Utils::InterConnector::instance(), &Utils::InterConnector::showPlaceholder, this, &MainPage::showPlaceholder);

        if (this->objectName().isEmpty())
            this->setObjectName(QStringLiteral("main_page"));
        setStyleSheet(Utils::LoadStyle(":/main_window/main_window.qss", Utils::get_scale_coefficient(), true));
        this->resize(400, 300);
        this->setProperty("Invisible", QVariant(true));
        horizontal_layout_ = new QHBoxLayout(this);
        horizontal_layout_->setSpacing(0);
        horizontal_layout_->setObjectName(QStringLiteral("horizontalLayout"));
        horizontal_layout_->setContentsMargins(0, 0, 0, 0);
        QMetaObject::connectSlotsByName(this);

        QHBoxLayout* originalLayout = qobject_cast<QHBoxLayout*>(layout());
        QVBoxLayout* contactsLayout = new QVBoxLayout();
        contactsLayout->setContentsMargins(0, 0, 0, 0);
        contactsLayout->setSpacing(0);

        contactsLayout->addWidget(search_widget_);
        contactsLayout->addWidget(contact_list_widget_);
        QSpacerItem* contactsLayoutSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum);
        contactsLayout->addSpacerItem(contactsLayoutSpacer);

        pages_layout_ = new QVBoxLayout();
        pages_layout_->setContentsMargins(0, 0, 0, 0);
        pages_layout_->setSpacing(0);
        pages_layout_->addWidget(pages_);
        {
            auto pc = pages_->count();
            pages_->addWidget(contact_dialog_);
            pages_->addWidget(profile_settings_);
            pages_->addWidget(general_settings_);
            pages_->addWidget(live_chats_page_);
            pages_->addWidget(themes_settings_);
            if (!pc)
                pages_->push(contact_dialog_);
        }
        originalLayout->addLayout(contactsLayout);
        originalLayout->addLayout(pages_layout_);
        QSpacerItem* originalLayoutSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum);
        originalLayout->addSpacerItem(originalLayoutSpacer);
        originalLayout->setAlignment(Qt::AlignLeft);
        setFocus();

        connect(contact_list_widget_, SIGNAL(itemSelected(QString)), contact_dialog_, SLOT(onContactSelected(QString)), Qt::QueuedConnection);
        connect(contact_dialog_, SIGNAL(sendMessage(QString)), contact_list_widget_, SLOT(onSendMessage(QString)), Qt::QueuedConnection);

        connect(contact_list_widget_, SIGNAL(itemSelected(QString)), this, SLOT(onContactSelected(QString)), Qt::QueuedConnection);
        connect(contact_list_widget_, SIGNAL(addContactClicked()), this, SLOT(onAddContactClicked()), Qt::QueuedConnection);

        connect(&Utils::InterConnector::instance(), SIGNAL(profileSettingsShow(QString)), this, SLOT(onProfileSettingsShow(QString)), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(themesSettingsShow(bool,QString)), this, SLOT(onThemesSettingsShow(bool,QString)), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(generalSettingsShow(int)), this, SLOT(onGeneralSettingsShow(int)), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(liveChatsShow()), this, SLOT(onLiveChatsShow()), Qt::QueuedConnection);

        connect(&Utils::InterConnector::instance(), SIGNAL(profileSettingsBack()), pages_, SLOT(pop()), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(generalSettingsBack()), pages_, SLOT(pop()), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(themesSettingsBack()), pages_, SLOT(pop()), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(attachPhoneBack()), pages_, SLOT(pop()), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(attachUinBack()), pages_, SLOT(pop()), Qt::QueuedConnection);

        connect(&Utils::InterConnector::instance(), SIGNAL(makeSearchWidgetVisible(bool)), search_widget_, SLOT(setVisible(bool)), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(popPagesToRoot()), this, SLOT(popPagesToRoot()), Qt::QueuedConnection);
        connect(&Utils::InterConnector::instance(), SIGNAL(profileSettingsDoMessage(QString)), contact_list_widget_, SLOT(select(QString)), Qt::QueuedConnection);

        connect(search_widget_, SIGNAL(searchBegin()), this, SLOT(searchBegin()), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(searchEnd()), this, SLOT(searchEnd()), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(search(QString)), Logic::GetSearchModel(), SLOT(searchPatternChanged(QString)), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(enterPressed()), contact_list_widget_, SLOT(searchResult()), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(upPressed()), contact_list_widget_, SLOT(searchUpPressed()), Qt::QueuedConnection);
        connect(search_widget_, SIGNAL(downPressed()), contact_list_widget_, SLOT(searchDownPressed()), Qt::QueuedConnection);
        connect(contact_list_widget_, SIGNAL(searchEnd()), search_widget_, SLOT(searchCompleted()), Qt::QueuedConnection);

        connect(Logic::GetContactListModel(), SIGNAL(selectedContactChanged(QString)), Logic::GetMessagesModel(), SLOT(contactChanged(QString)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipShowVideoWindow(bool)), this, SLOT(onVoipShowVideoWindow(bool)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallIncoming(const std::string&, const std::string&)), this, SLOT(onVoipCallIncoming(const std::string&, const std::string&)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallIncomingAccepted(const voip_manager::ContactEx&)), this, SLOT(onVoipCallIncomingAccepted(const voip_manager::ContactEx&)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallDestroyed(const voip_manager::ContactEx&)), this, SLOT(onVoipCallDestroyed(const voip_manager::ContactEx&)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallCreated(const voip_manager::ContactEx&)), this, SLOT(onVoipCallCreated(const voip_manager::ContactEx&)), Qt::DirectConnection);

        search_widget_->setVisible(!contact_list_widget_->shouldHideSearch());

        post_stats_with_settings();
        QObject::connect(settings_timer_, SIGNAL(timeout()), this, SLOT(post_stats_with_settings()));

        settings_timer_->start(Ui::period_for_stats_settings_ms);
        connect(Ui::GetDispatcher(), &core_dispatcher::myInfo, this, &MainPage::myInfo, Qt::UniqueConnection);
        connect(Ui::GetDispatcher(), &core_dispatcher::login_new_user, this, &MainPage::loginNewUser, Qt::DirectConnection);
        
        add_contact_menu_ = new FlatMenu(search_widget_->searchEditIcon());
        Utils::ApplyStyle(add_contact_menu_,
                          "QMenu { background-color: #f2f2f2; border:1px solid #cccccc; } "
                          "QMenu::item { padding-left:40dip; background-color:transparent; color:black; padding-top:6dip; padding-bottom:6dip; padding-right:12dip; } "
                          "QMenu::item:selected { background-color:#e2e2e2; } "
                          "QMenu::icon { padding-left:22dip; }"
                          );
        add_contact_menu_->addAction(QIcon(Utils::parse_image_name(":/resources/dialog_newchat_100.png")), QT_TRANSLATE_NOOP("contact_list", "New chat"), contact_list_widget_, SLOT(allClicked()));
        add_contact_menu_->addAction(QIcon(Utils::parse_image_name(":/resources/dialog_newgroup_100.png")), QT_TRANSLATE_NOOP("contact_list", "Create Groupchat"), this, SLOT(createGroupChat()));
        add_contact_menu_->setExpandDirection(Qt::AlignLeft);
        add_contact_menu_->stickToIcon();
        Utils::ApplyStyle(search_widget_->searchEditIcon(), "QPushButton::menu-indicator { image:none; } QPushButton:pressed { background-color:transparent; }");
        search_widget_->searchEditIcon()->setMenu(add_contact_menu_);
    }
Ejemplo n.º 11
0
FramelessMainWindow::FramelessMainWindow( QWidget *parent ) :
   QMainWindow( parent ),
   m_scene( new QGraphicsScene( this ) ),
   m_browser( new GraphicsBrowser( m_scene, *this ) ),
   m_mouseFilter( *this, *qApp ),
   m_video( new EventfulVidgetVideo( this ) ),
   m_intro( new QGraphicsScene ),
   m_control( new VideoControl( this ) ),
   m_closeControl( new QFrame( this ) ),
   m_hostApp( new HostApp( m_browser->webView(), this ) )
{
    m_video->hide();
    m_control->hide();
    m_browser->webView()->page()->settings()->setAttribute( QWebSettings::JavascriptCanOpenWindows, true );

    m_control->setVolume( m_hostApp->getVolume() );

    m_closeControl->hide();
    m_closeControl->setStyleSheet( "QFrame{background-color:black; } "
                                   "QPushButton { background-image: url(':/close-styled'); width:31;} "
                                   "QWidget{border:none; padding:0; spacing:0; height:30;}" );
    QHBoxLayout *hl = new QHBoxLayout( m_closeControl );
    hl->setContentsMargins( QMargins() );
    hl->addSpacerItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) );

    m_closeButton = new QPushButton();
    m_closeButton->setCursor( Qt::PointingHandCursor );
//  btn->setFlat( true );
    hl->addWidget( m_closeButton );
    connect( m_control, SIGNAL( uiShow() ), m_closeButton, SLOT( show() ) );
    connect( m_control, SIGNAL( uiHide() ), m_closeButton, SLOT( hide() ) );


    setWindowTitle( "Popcorn Time" );
    m_intro->addPixmap( QPixmap( ":/intro" ).scaled( DEFAULT_WIDTH, DEFAULT_HEIGHT, Qt::IgnoreAspectRatio ) );
    m_browser->setScene( m_intro );
    new QShortcut( QKeySequence( "Ctrl+M" ), this, SLOT( minimize() ) );

    QObject::connect( m_hostApp->thread(), SIGNAL( torrentUrlAvailable( QString ) ),
                      this, SLOT( playMedia( QString ) ) );
    QObject::connect( m_browser->webView(), SIGNAL( loadFinished( bool ) ),
                      this, SLOT( removeIntro() ) );
    QObject::connect( m_hostApp, SIGNAL( commandedClose() ),
                      this, SLOT( close() ) );
    QObject::connect( m_hostApp, SIGNAL( commandedMinimize() ),
                      this, SLOT( minimize() ) );
    QObject::connect( m_hostApp, SIGNAL( toggledMaximize() ),
                      this, SLOT( toggleMaximize() ) );
    QObject::connect( m_hostApp, SIGNAL( haveSubtitles( SubtitleItem ) ),
                      m_control, SLOT( addSubtitle( SubtitleItem ) ) );
    QObject::connect( m_hostApp, SIGNAL( downloadInfoChanged( DownloadInfo ) ),
                      m_control, SLOT( updateDownloadStatus( DownloadInfo ) ) );
    QObject::connect( m_control, SIGNAL( volumeChanged( int ) ),
                      m_hostApp, SLOT( setVolume( int ) ) );

    QObject::connect( m_control, SIGNAL( newImage( QString ) ),
                      m_video, SLOT( setImage( QString ) ) );

    QObject::connect( m_control->fullscreenButton(), SIGNAL( clicked() ),
                      this, SLOT( toggleMaximize() ) );
    QObject::connect( &m_mouseFilter, SIGNAL( enterPressed() ),
                      this, SLOT( toggleMaximize() ) );
    QObject::connect( &m_mouseFilter, SIGNAL( upPressed() ),
                      m_control, SLOT( volumeUp() ) );
    QObject::connect( &m_mouseFilter, SIGNAL( downPressed() ),
                      m_control, SLOT( volumeDown() ) );
    QObject::connect( &m_mouseFilter, SIGNAL( pausePressed() ),
                      m_control, SLOT( pauseToggleReq() ) );

    connect( m_video, SIGNAL( mouseEnter() ), m_control, SLOT( showForDefaultPeriod() ) );

    this->setWindowFlags( Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint );
#ifdef Q_OS_MAC
    fixNativeWindow( this );
#endif
    this->setMinimumSize( 800, 330 );
    this->setMouseTracking( true );
    this->setCentralWidget( m_browser );
    qApp->installEventFilter( this );

    reconnectMediaPlayer();

    QObject::connect( VLC::VLCObject(), SIGNAL( mediaPlayerReplaced() ),
                      this, SLOT( reconnectMediaPlayer() ) );
}
Ejemplo n.º 12
0
	EMenuScreen WaitingMenu::run(MainWindow& window, EMenuScreen)
	{
		IControllerToMenu* controller = PolyBomberApp::getIControllerToMenu();

		EMenuScreen nextScreen = NONEMENU;

		try
		{
			initWidgets();

			sf::Clock clock;
				
			while (nextScreen == NONEMENU)
			{			
				window.clear();
				window.display(this->widgets);

				EMenuKeys key = MENU_NONE;
				while ((key = controller->getKeyPressed()) == MENU_NONE && window.isOpen())
				{
					// On raffraichit les noms
					if (clock.getElapsedTime().asMilliseconds() > 250)
					{
						clock.restart();
						update();
						window.clear();
						window.display(this->widgets);

						// On teste si la partie commence
						if (this->network->isStarted())
						{
							nextScreen = start.activate();
							break;
						}
					}
				}

				switch(key)
				{
					case MENU_DOWN:
						downPressed();
						break;
					case MENU_UP:
						upPressed();
						break;
					case MENU_LEFT:
						leftPressed();
						break;
					case MENU_RIGHT:
						rightPressed();
						break;
					case MENU_VALID:
						validPressed(&nextScreen);
						break;
					case MENU_BACK:
						backPressed(&nextScreen);
						break;
					default:
						break;
				}

				if (!window.isOpen())
					nextScreen = EXIT;
			}		
		}
		catch(PolyBomberException& e)
		{
			std::cerr << e.what() << std::endl;
			this->network->cancel();
			nextScreen = GAMEMENU;
		}
		
		return nextScreen;
	}