示例#1
0
StickerSetBox::StickerSetBox(const MTPInputStickerSet &set) : ScrollableBox(st::stickersScroll), _inner(set),
_close(this, st::btnStickersClose),
_addStickers(this, lng_stickers_add_pack(lt_count, 0), st::btnStickersAdd),
_shareStickers(this, lang(lng_stickers_share_pack), st::btnStickersAdd),
_closeStickers(this, lang(lng_close), st::btnStickersAdd) {
	resize(st::stickersWidth, height());
	setMaxHeight(st::stickersMaxHeight);
	connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated()));

	init(&_inner, 0, st::boxFont->height + st::newGroupNamePadding.top() + st::newGroupNamePadding.bottom());

	connect(&_close, SIGNAL(clicked()), this, SLOT(onClose()));
	connect(&_addStickers, SIGNAL(clicked()), this, SLOT(onAddStickers()));
	connect(&_shareStickers, SIGNAL(clicked()), this, SLOT(onShareStickers()));
	connect(&_closeStickers, SIGNAL(clicked()), this, SLOT(onClose()));

	connect(&_inner, SIGNAL(updateButtons()), this, SLOT(onUpdateButtons()));
	connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));

	connect(&_inner, SIGNAL(installed(uint64)), this, SIGNAL(installed(uint64)));

	onStickersUpdated();

	onScroll();

	prepare();
}
示例#2
0
 //-----------------------------------------------------------------------
 //                    s e t S c r o l l i n g B o u n d s
 //-----------------------------------------------------------------------
 void TGScrollBox::setScrollingBounds(TGReal hMax, TGReal vMax)
 {
     TGReal   oldHScroll = hScroll, oldVScroll = vScroll;
     if (hMax < 1.0f)
         hMax = 1.0f;
     if (vMax < 1.0f)
         vMax = 1.0f;
     hScrollMax = hMax;
     vScrollMax = vMax;
     clientWidth = hMax - (x2 - x1 - 16);
     clientHeight = vMax - (y2 - y1 - 16);
     if (clientWidth > 0.0f && hScroll > clientWidth)
         hScroll = clientWidth;
     else
         if (clientWidth <= 0.0f)
             hScroll = 0;
     if (clientHeight > 0.0f && vScroll > clientHeight)
         vScroll = clientHeight;
     else
         if (clientHeight <= 0.0f)
             vScroll = 0;
     if (oldHScroll != hScroll || oldVScroll != vScroll)
     {
         onScroll(hScroll - oldHScroll, vScroll - oldVScroll);
         fireEvent(TGEvent::Scrolled,TGEventArgs(this));
     }
 }
void InnerDropdown::resizeEvent(QResizeEvent *e) {
	_scroll->setGeometry(rect().marginsRemoved(_st.padding).marginsRemoved(_st.scrollMargin));
	if (auto widget = static_cast<TWidget*>(_scroll->widget())) {
		widget->resizeToWidth(_scroll->width());
		onScroll();
	}
}
InnerDropdown::InnerDropdown(
	QWidget *parent,
	const style::InnerDropdown &st)
: RpWidget(parent)
, _st(st)
, _scroll(this, _st.scroll) {
	_hideTimer.setSingleShot(true);
	connect(&_hideTimer, SIGNAL(timeout()), this, SLOT(onHideAnimated()));

	connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));

	hide();

	shownValue(
	) | rpl::filter([](bool shown) {
		return shown;
	}) | rpl::take(1) | rpl::map([=] {
		// We can't invoke this before the window is created.
		// So instead we start handling them on the first show().
		return macWindowDeactivateEvents();
	}) | rpl::flatten_latest(
	) | rpl::filter([=] {
		return !isHidden();
	}) | rpl::start_with_next([=] {
		leaveEvent(nullptr);
	}, lifetime());
}
示例#5
0
ContactsBox::ContactsBox() : _scroll(this, st::newGroupScroll), _inner(),
	_addContact(this, lang(lng_add_contact_button), st::contactsAdd),
	_filter(this, st::contactsFilter, lang(lng_participant_filter)),
	_close(this, lang(lng_contacts_done), st::contactsClose),
	_hiding(false), a_opacity(0, 1) {

	_width = st::participantWidth;
	_height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom();
	if (_height > st::participantMaxHeight) _height = st::participantMaxHeight;

	resize(_width, _height);

	_scroll.setWidget(&_inner);
	_scroll.setFocusPolicy(Qt::NoFocus);

	connect(&_addContact, SIGNAL(clicked()), App::wnd(), SLOT(onShowAddContact()));
	connect(&_close, SIGNAL(clicked()), this, SLOT(onClose()));
	connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSel()));
	connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
	connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
	connect(&_filter, SIGNAL(cancelled()), this, SLOT(onClose()));
	connect(&_inner, SIGNAL(mustScrollTo(int,int)), &_scroll, SLOT(scrollToY(int,int)));

	showAll();
	_cache = myGrab(this, rect());
	hideAll();
}
AddParticipantBox::AddParticipantBox(ChatData *chat) :
	_scroll(this, st::newGroupScroll), _inner(chat),
	_filter(this, st::contactsFilter, lang(lng_participant_filter)),
	_invite(this, lang(lng_participant_invite), st::btnSelectDone),
	_cancel(this, lang(lng_cancel), st::btnSelectCancel),
	_hiding(false), a_opacity(0, 1), af_opacity(anim::linear) {

	_width = st::participantWidth;
	_height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom();
	if (_height > st::participantMaxHeight) _height = st::participantMaxHeight;

	resize(_width, _height);

	_scroll.setWidget(&_inner);
	_scroll.setFocusPolicy(Qt::NoFocus);

	connect(&_invite, SIGNAL(clicked()), this, SLOT(onInvite()));
	connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(closed()));
	connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSel()));
	connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
	connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
	connect(&_filter, SIGNAL(cancelled()), this, SIGNAL(onClose()));
	connect(&_inner, SIGNAL(mustScrollTo(int,int)), &_scroll, SLOT(scrollToY(int,int)));
	connect(&_inner, SIGNAL(selectAllQuery()), &_filter, SLOT(selectAll()));

	showAll();
	_cache = myGrab(this, rect());
	hideAll();
}
ProfileWidget::ProfileWidget(QWidget *parent, const PeerData *peer) : QWidget(parent),
	_inner(this, &_scroll, peer), _scroll(this, st::setScroll), _showing(false) {
	_scroll.setWidget(&_inner);
	_scroll.move(0, 0);
	_inner.move(0, 0);
	_scroll.show();
	connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSelected()));
	connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
}
示例#8
0
void BoxContent::finishScrollCreate() {
	Expects(_scroll != nullptr);

	if (!_scroll->isHidden()) {
		_scroll->show();
	}
	updateScrollAreaGeometry();
	connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
	connect(_scroll, SIGNAL(innerResized()), this, SLOT(onInnerResize()));
}
示例#9
0
InnerDropdown::InnerDropdown(QWidget *parent, const style::InnerDropdown &st) : TWidget(parent)
, _st(st)
, _scroll(this, _st.scroll) {
	_hideTimer.setSingleShot(true);
	connect(&_hideTimer, SIGNAL(timeout()), this, SLOT(onHideAnimated()));

	connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));

	if (cPlatform() == dbipMac || cPlatform() == dbipMacOld) {
		connect(App::wnd()->windowHandle(), SIGNAL(activeChanged()), this, SLOT(onWindowActiveChanged()));
	}

	hide();
}
示例#10
0
Widget::Widget(QWidget *parent, PeerData *peer) : Window::SectionWidget(parent)
, _scroll(this, st::setScroll)
, _inner(this, peer)
, _fixedBar(this, peer)
, _fixedBarShadow(this, st::shadowColor) {
	_fixedBar->move(0, 0);
	_fixedBar->resizeToWidth(width());
	_fixedBar->show();

	_fixedBarShadow->setMode(ToggleableShadow::Mode::HiddenFast);
	_fixedBarShadow->raise();
	updateAdaptiveLayout();

	_scroll->setOwnedWidget(_inner);
	_scroll->move(0, _fixedBar->height());
	_scroll->show();

	connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
	connect(_inner, SIGNAL(cancelled()), _fixedBar, SLOT(onBack()));
}
示例#11
0
    //-----------------------------------------------------------------------
    //                          o n M o u s e M o v e d
    //-----------------------------------------------------------------------
    void TGScrollBox::onMouseMoved(int x, int y)
    {
        int	x1, y1, x2, y2;
        TGReal	oldHScroll, oldVScroll;
        if (!scrolling)
            return;
        getBounds(x1, y1, x2, y2);

        oldHScroll = hScroll;
        oldVScroll = vScroll;

        if (scrolling == 1)
        {
            vScroll = (TGReal)(y - y1 - 6)*clientHeight/(TGReal)(y2 - y1 -24);
            if (vScroll > clientHeight)
                vScroll = clientHeight;
            else
                if (vScroll < 0.0f)
                    vScroll = 0.0f;
        }
        else
        {
            hScroll = (TGReal)(x - x1 - 6)*clientWidth/(TGReal)(x2 - x1 - 24);
            if (hScroll > clientWidth)
                hScroll = clientWidth;
            else
                if (hScroll < 0.0f)
                    hScroll = 0.0f;
        }

        if (oldHScroll != hScroll || oldVScroll != vScroll)
        {
            onScroll(hScroll - oldHScroll, vScroll - oldVScroll);
            fireEvent(TGEvent::Scrolled,TGEventArgs(this));
        }
        redraw();
    }
示例#12
0
    void Element::handleQueuedEvent(std::shared_ptr<Events::Event> event) {
      switch(event->getEventType()) {
        case Events::EventType::MOUSE_CURSOR: {
          auto casted_event = std::static_pointer_cast<Input::MouseCursorEvent>(event);
          if(cursor_within == false && isActive() && isPointWithin(casted_event->getPosition())) {
            cursor_within = true;
            onCursorEnter();
          }
          else if(cursor_within == true && isActive() && !isPointWithin(casted_event->getPosition())) {
            cursor_within = false;
            onCursorLeave();
          }
          break;
        }

        case Events::EventType::MOUSE_SCROLL: {
          auto casted_event = std::static_pointer_cast<Input::MouseScrollEvent>(event);
          auto change = last_mouse_scroll_position - casted_event->getPosition();
          last_mouse_scroll_position = casted_event->getPosition();
          onScroll(change);
          break;
        }

        case Events::EventType::MOUSE_BUTTON_DOWN: {
          auto casted_event = std::static_pointer_cast<Input::MouseButtonDownEvent>(event);
          if(cursor_within && isActive() && casted_event->getButton() == GLFW_MOUSE_BUTTON_LEFT) {
            onLeftClick();
          }
          else if(cursor_within && isActive() && casted_event->getButton() == GLFW_MOUSE_BUTTON_RIGHT)
            onRightClick();
          break;
        }

        case Events::EventType::MOUSE_BUTTON_UP: {
          auto casted_event = std::static_pointer_cast<Input::MouseButtonUpEvent>(event);
          if(cursor_within && isActive() && casted_event->getButton() == GLFW_MOUSE_BUTTON_LEFT)
            onLeftClickRelease();
          else if(cursor_within && isActive() && casted_event->getButton() == GLFW_MOUSE_BUTTON_RIGHT)
            onRightClickRelease();
          break;
        }

        case Events::EventType::KEY_DOWN: {
          auto casted_event = std::static_pointer_cast<Input::KeyDownEvent>(event);
          onKeyDown(casted_event->getKey());
          break;
        }

        case Events::EventType::KEY_UP: {
          auto casted_event = std::static_pointer_cast<Input::KeyUpEvent>(event);
          onKeyUp(casted_event->getKey());
          break;
        }

        case Events::EventType::KEY_REPEAT: {
          auto casted_event = std::static_pointer_cast<Input::KeyRepeatEvent>(event);
          onKeyRepeat(casted_event->getKey());
          break;
        }

        default: {
          Renderable::handleQueuedEvent(event);
          break;
        }

      }
    }
示例#13
0
void UEditorWindow::setupUi()
{

    ui->setupUi(this);
    _hScroll = new RichHScrollBar();
       // QScrollArea *sa = new QScrollArea( ui->tab );

        showLines = new  ShowLines();
        showSentenceWidget = new ShowSentenceWidget(this);
        _wydget_timeline = new UWydget_Timeline(this);
        _wydget_timeline->setWidgetSentence(this->showSentenceWidget);
        _wydget_lyrics = new UWydget_Lyrics();


   // hSlider=new QSlider(Qt::Horizontal,this);
    //ui->hSlider->setRange((log(30)*100.0),(log(10000)*100.0));// 30 beats to 10000 beats
    //ui->hSlider->setValue((log(100)*100.0));
    _hScroll->setPageStep(100);

    //vSlider=new QSlider(Qt::Vertical,this);
    ui->vSlider->setRange(120,500);
    ui->vSlider->setValue(290);


    _widgetSongData = new WidgetSongData(this);
    _widgetSongData->setWidgetSentence(this->showSentenceWidget);
    UAudioManager::Instance.setWidgetSongData(_widgetSongData);

    _hScroll->setRange(0,999);
    ui->vScroll->setRange(0,710);
    ui->vScroll->setValue(710);


        ui->tabEditeurLayMain->setColumnMinimumWidth(0,70);// the minimal width to display the showline wydget
        ui->tabEditeurLayMain->setRowMinimumHeight(1,30);// the minimal height to display the timeline wydget
        ui->tabEditeurLayMain->addWidget(_wydget_timeline,1,1);
        ui->tabEditeurLayMain->addWidget(showLines,2,0);
        ui->tabEditeurLayMain->addWidget(showSentenceWidget,2,1);
        ui->tabEditeurLayMain->addWidget(_hScroll,3,1);
        ui->tabEditeurLayMain->addWidget(_widgetSongData,0,1);
        ui->mainHorizontalLayout->addWidget(_wydget_lyrics);
        //ui->tabEditeurLayMain->setRowMinimumHeight(2,40);
        //ui->tabEditeurLayMain->setColumnMinimumWidth(4,100);

     //ui->tabEditeurLayMain->addWidget(_hScroll,1,1);
    // ui->tabEditeurLayMain->addWidget(ui->vScroll,0,2);

     //ui->tabEditeurLayMain->addWidget(ui->vSlider,0,3);
     //ui->tabEditeurLayMain->addWidget(ui->hSlider,2,1);


        playAction = new QAction(QIcon(":/images/player_play.png"), tr("Play"), this);
        playAction->setShortcut(tr("Crl+P"));
        pauseAction = new QAction(QIcon(":/images/player_pause.png"), tr("Pause"), this);
        pauseAction->setShortcut(tr("Ctrl+A"));
        pauseAction->setVisible(false);
        recordAction = new QAction(QIcon(":/images/recordnormal.png"), tr("Record"), this);
        recordAction->setShortcut(tr("Ctrl+R"));

        ui->lcd_music->display("00:00");


        ui->Slider_MusiqueVolume->setRange(0,100);
        ui->Slider_MusiqueVolume->setValue(100);
        connect( ui->Slider_MusiqueVolume, SIGNAL(valueChanged(int)), &UAudioManager::Instance, SLOT(changeVolume(int)));
        ui->Slider_NoteVolume->setRange(0,100);
        ui->Slider_NoteVolume->setValue(100);
        connect( ui->Slider_NoteVolume, SIGNAL(valueChanged(int)), &UNoteManager::Instance, SLOT(setVolume(int)));
        ui->Slider_NoteVolume->setRange(0,48);
        ui->Slider_NoteVolume->setValue(24);
        connect( ui->Slider_Speed, SIGNAL(valueChanged(int)), this, SLOT(setSpeed(int)));



        QToolBar *bar = new QToolBar;

        bar->addAction(playAction);
        bar->addAction(pauseAction);
        bar->addAction(recordAction);

        ui->HLayAudioDevice->insertWidget(1,bar);



        connect(showSentenceWidget, SIGNAL(click(quint64)), this, SLOT(changeSeek(quint64)));
        connect(_wydget_timeline, SIGNAL(click(quint64)), this, SLOT(tick(quint64)));
        connect(showSentenceWidget, SIGNAL(modified()), _wydget_lyrics, SLOT(onScroll()));
        connect(showSentenceWidget, SIGNAL(emptyClik()), _wydget_lyrics, SLOT(onScroll()));
        connect(showSentenceWidget, SIGNAL(selection(int,int)), _wydget_lyrics, SLOT(onSelectionChange(int,int)));
        connect(showSentenceWidget, SIGNAL(doubleClik(int)), _wydget_lyrics, SLOT(ondoubleClick(int)));

        connect(showSentenceWidget, &ShowSentenceWidget::autoScroll,[this](int v) { this->_hScroll->setValue(v);} );
        connect(showSentenceWidget, SIGNAL(octaveChanged(int)), showLines, SLOT(setOctaveOffset(int)));


        connect(ui->spinBoxMinute, SIGNAL(valueChanged(int)), this, SLOT(onSongLengthChanged(int)));
        connect(ui->spinBoxSecond, SIGNAL(valueChanged(int)), this, SLOT(onSongLengthChanged(int)));

}