Пример #1
0
void MplayerWindow::mouseReleaseEvent( QMouseEvent * e) {

	if (e->button() == Qt::LeftButton) {
		e->accept();
		emit leftClicked();
	}
	else
	if (e->button() == Qt::MidButton) {
		e->accept();
		emit middleClicked();
	}
	else
	if (e->button() == Qt::XButton1) {
		e->accept();
		emit xbutton1Clicked();
	}
	else
	if (e->button() == Qt::XButton2) {
		e->accept();
		emit xbutton2Clicked();
	}
	else
    if (e->button() == Qt::RightButton) {
		e->accept();

		emit rightClicked();
    } 
	else {
		e->ignore();
	}
}
Пример #2
0
void PersonalInfoPage::initializeWidget()
{   
    //导航栏
    QString strTitle = tr("个人信息");
    QString strLeftBtn = tr("更多");
    QPixmap leftArrowsPixmap(ImagePath::NAVIGATION_LEFT_ARROWS);
    navigationBar = new NavigationBar(this);
    navigationBar->setTitleText(strTitle);
    navigationBar->setLeftText(strLeftBtn);
    navigationBar->setLeftPixMap(leftArrowsPixmap);
    connect(navigationBar, SIGNAL(leftClicked()), this, SLOT(on_btnPrePage_clicked()));

    QHBoxLayout* pHLTop = new QHBoxLayout();
    pHLTop->addWidget(navigationBar);
    pHLTop->setSpacing(0);
    pHLTop->setMargin(0);
    this->setTopbarLayout(pHLTop);

    //头像
    btnHeadPortrait = new GroupButton(this);
    QPixmap headPixmap(ImagePath::USER_PORTRAIT);
    btnHeadPortrait->setDescribe(headPixmap);
    btnHeadPortrait->setStyleSheet(SheetStyle::GROUPBUTTON_NOBORDER);
    this->setGroupButton(btnHeadPortrait, QString("头像"), this->screenHeight()*0.123);
    connect(btnHeadPortrait, SIGNAL(clicked()), this, SLOT(on_btnAlterHeadPortrait_clicked()));

    //账号
    QPixmap pixmap;
    btnMacNum = new GroupButton(this);
    this->setGroupButton(btnMacNum, tr("账号"));
    btnMacNum->setReserve(pixmap);
    btnMacNum->setStyleSheet(SheetStyle::GROUPBUTTON_UPANDDOWNBORDER);

    //昵称
    btnUserName = new GroupButton(this);
    this->setGroupButton(btnUserName, tr("昵称"));
    btnUserName->setStyleSheet(SheetStyle::GROUPBUTTON_BOTTOMBORDER);
    connect(btnUserName, SIGNAL(clicked()), this, SLOT(on_btnAlterNicknamePage_clicked()));

    //个性签名
    btnSignatrue = new GroupButton(this);
    this->setGroupButton(btnSignatrue, tr("个性签名"));
    btnSignatrue->setStyleSheet(SheetStyle::GROUPBUTTON_UPANDDOWNBORDER);
    connect(btnSignatrue, SIGNAL(clicked()), this, SLOT(on_btnAlterSignaturePage_clicked()));

    QVBoxLayout* vbLayout = new QVBoxLayout;
    vbLayout->addWidget(btnHeadPortrait);
    vbLayout->addWidget(btnMacNum);
    vbLayout->addWidget(btnUserName);
    vbLayout->addSpacing(this->screenHeight()*0.037);
    vbLayout->addWidget(btnSignatrue);
    vbLayout->setSpacing(0);
    vbLayout->setMargin(0);
    vbLayout->addStretch(0);
    this->setBodyPartLayout(vbLayout);

    //屏幕触摸滚动设置
    this->installScrollViewportArea();
    this->loadLocalData();
}
Пример #3
0
void ChoiceSearchComboBox::installView(QAbstractItemView* v)
{
    // make protected again
    ListViewComboBox::installView(v);

    //view()->setHeaderHidden(true);
    view()->setAlternatingRowColors(true);

    // create the label
    m_label = new DSqueezedClickLabel;
    m_label->setElideMode(Qt::ElideRight);

    // set a line edit that carries the label
    ProxyClickLineEdit* const lineEdit = new ProxyClickLineEdit;
    lineEdit->setCursor(m_label->cursor());
    lineEdit->setWidget(m_label);
    setLineEdit(lineEdit);

    // connect clicks on upper area (both line edit and widget within) to showPopup
    connect(lineEdit, SIGNAL(leftClicked()),
            this, SLOT(labelClicked()));

    connect(m_label, SIGNAL(activated()),
            this, SLOT(labelClicked()));
}
Пример #4
0
int Button::handleMouse()
{
	POINT pos;
	int button;

	button = mouse_status(&pos);
	if (!contains(pos.x, pos.y))
		return 0;
	while (contains(pos.x, pos.y))
	{
		if (button == 1)
		{
			mouse_wait_for_release(1, &pos);
			select();
			mouse_off();
			draw();
			mouse_on();
			leftClicked();
			return 1;
		}
		else
			if (button == 2)
			{
				mouse_wait_for_release(2, &pos);
				rightClicked();
				return 2;
			}
		button = mouse_status(&pos);
	}
	return 0;
}
Пример #5
0
void UClusterSearchResultPage::initializeWidget()
{
    QString strTitle = tr("查找结果");
    QString strLeftBtn = tr("返回");
    QPixmap leftArrowsPixmap(ImagePath::NAVIGATION_LEFT_ARROWS);
    navigationBar = new NavigationBar(this);
    navigationBar->setTitleText(strTitle);
    navigationBar->setLeftText(strLeftBtn);
    navigationBar->setLeftPixMap(leftArrowsPixmap);
    connect(navigationBar, SIGNAL(leftClicked()), this, SLOT(on_btnPrePage_clicked()));

    QHBoxLayout* pHLTop = new QHBoxLayout();
    pHLTop->addWidget(navigationBar);
    pHLTop->setSpacing(0);
    pHLTop->setMargin(0);
    this->setTopbarLayout(pHLTop);

    clusterListLayOut = new QVBoxLayout;
    clusterListLayOut->setSpacing(0);
    clusterListLayOut->setMargin(0);
    this->setBodyPartLayout(clusterListLayOut);

    //屏幕触摸滚动设置
    this->installScrollViewportArea();
}
Пример #6
0
void ForgetPwdVerifyPage::initializeWidget()
{
    //提示信息页面操作
    hintMsgPage = new HintMsgPage(this);
    hintMsgPage->hide();
    connect(hintMsgPage, SIGNAL(submitClicked(bool)), this, SLOT(on_hintMsgPage(bool)));

    //导航栏
    QString strTitle = tr("验 证");
    QString strLeftBtn = tr("取消");
    QPixmap leftArrowsPixmap(ImagePath::NAVIGATION_LEFT_ARROWS);
    navigationBar = new NavigationBar(this);
    navigationBar->setTitleText(strTitle);
    navigationBar->setLeftText(strLeftBtn);
    navigationBar->setLeftPixMap(leftArrowsPixmap);
    connect(navigationBar, SIGNAL(leftClicked()), this, SLOT(on_btnPrePage_clicked()));

    QHBoxLayout* pHLTop = new QHBoxLayout();
    pHLTop->addWidget(navigationBar);
    pHLTop->setSpacing(0);
    pHLTop->setMargin(0);
    this->setTopbarLayout(pHLTop);

    //验证部分
    QLabel* lblMsgHint = new QLabel(this);
    lblMsgHint->setText(tr("已发送验证码到您的邮箱"));
    lblMsgHint->setFixedHeight(this->screenHeight()*0.05);
    lblMsgHint->setAlignment(Qt::AlignLeft);
    lblMsgHint->setContentsMargins(this->screenWidth()*0.02, 0, this->screenWidth()*0.02, 0);
    lblMsgHint->setStyleSheet("color:rgb(122,123,128); font:16px;");

    editValidate = new QLineEdit(this);
    editValidate->setFixedHeight(this->screenHeight()*0.08);
    editValidate->setPlaceholderText(tr("输入6位验证码"));
    editValidate->setStyleSheet(SheetStyle::FORGETPWD_VALIDATION_LINEEDIT);
    editValidate->setTextMargins(this->screenWidth()*0.02, 0, this->screenWidth()*0.02, 0);

    QVBoxLayout* vbInfoLayout = new QVBoxLayout;
    vbInfoLayout->addWidget(lblMsgHint);
    vbInfoLayout->addWidget(editValidate);
    vbInfoLayout->setAlignment(Qt::AlignCenter);
    vbInfoLayout->setSpacing(0);
    vbInfoLayout->setMargin(0);

    btnNextStep = new QPushButton(tr("下一步"), this);
    btnNextStep->setFixedHeight(this->screenHeight()*0.074);
    btnNextStep->setStyleSheet(SheetStyle::QPUSHBUTTON);
    connect(btnNextStep, SIGNAL(clicked()), this, SLOT(on_btnNextStep_clicked()));

    QVBoxLayout* vbLayout = new QVBoxLayout;
    vbLayout->addLayout(vbInfoLayout);
    vbLayout->addSpacing(this->screenHeight()*0.03);
    vbLayout->addWidget(btnNextStep);
    vbLayout->setAlignment(Qt::AlignTop);
    vbLayout->addStretch(0);
    vbLayout->addSpacing(0);
    vbLayout->setContentsMargins(this->screenWidth()*0.054,this->screenHeight()*0.026,this->screenWidth()*0.054,0);
    this->setBodyPartLayout(vbLayout);
}
Пример #7
0
void ProxyClickLineEdit::mouseReleaseEvent(QMouseEvent* event)
{
    ProxyLineEdit::mouseReleaseEvent(event);

    if (event->button() == Qt::LeftButton)
    {
        emit leftClicked();
        event->accept();
    }
}
Пример #8
0
void SquareScene::mousePressEvent ( QGraphicsSceneMouseEvent * mouseEvent ) {
    if(mouseEvent->button() == Qt::LeftButton) {
        emit clicked(this);
    }
    else if(mouseEvent->button() == Qt::RightButton) {
        emit leftClicked(this, mouseEvent->screenPos());
        emit clicked(this);
    }

}
Пример #9
0
void GridButton::mousePressEvent(QMouseEvent *event)
{
    if (event->button() == Qt::RightButton)
    {
        emit rightClicked();
    }
    else
    {
        emit leftClicked();
    }
}
void DClusterUserHasDevicesListPage::initializeWidget()
{
    //导航栏
    QString strLeftBtn = tr("上一步");
    QString strTitle = tr("成员所属设备");
    navigationMenuBar = new NavigationMenuBar(this);
    navigationMenuBar->setLeftText(strLeftBtn);
    navigationMenuBar->setTitleText(strTitle);
    connect(navigationMenuBar, SIGNAL(leftClicked()), this, SLOT(on_btnPrepage_clicked()));

    MenuBar* menuBar = navigationMenuBar->getMenuBar();
    addDeviceAction = menuBar->addAction(tr("添加设备"));
    deleteDeviceAction = menuBar->addAction(tr("删除设备"));
    connect(addDeviceAction, SIGNAL(triggered()),this,SLOT(on_addDeviceAction_clicked()));
    connect(deleteDeviceAction, SIGNAL(triggered()), this, SLOT(on_deleteDeviceAction_clicked()));

    QHBoxLayout* pHLTop = new QHBoxLayout();
    pHLTop->addWidget(navigationMenuBar);
    pHLTop->setSpacing(0);
    pHLTop->setMargin(0);
    this->setTopbarLayout(pHLTop);

    //成员信息
    QPixmap pixmapLeft(ImagePath::USER_PORTRAIT);
    QPixmap pixmapRight(ImagePath::RIGHT_HOLLOW_ARROWS);
    btnUserDetail = new GroupButton(this);
    btnUserDetail->setPixMap(pixmapLeft);
    btnUserDetail->setReserve(pixmapRight);
    btnUserDetail->setAttribute(Qt::WA_LayoutUsesWidgetRect);
    btnUserDetail->setFixedHeight(this->screenHeight()*0.12);
    btnUserDetail->setStyleSheet(SheetStyle::GROUPBUTTON_BOTTOMBORDER);
    connect(btnUserDetail, SIGNAL(clicked()), this, SLOT(on_btnUserDetail_clicked()));

    //成员所属设备列表
    devListWidget = new GListWidget(this);
    this->setGListWidget(devListWidget);
    connect(devListWidget, SIGNAL(flexClicked(int)), this, SLOT(on_btnListWidgetFlex_clicked(int)));

    //主体布局
    QVBoxLayout* vbLayout = new QVBoxLayout;
    vbLayout->addWidget(btnUserDetail);
    vbLayout->addSpacing(this->screenHeight()*0.037);
    vbLayout->addWidget(devListWidget);
    vbLayout->setSpacing(0);
    vbLayout->setMargin(0);
    vbLayout->addStretch(0);
    this->setBodyPartLayout(vbLayout);
    curFixedContentHeight += this->screenHeight()*0.037;

    //屏幕触摸滚动设置
    this->installScrollViewportArea();
    this->loadLocalData();
    timerID = this->startTimer(ConstNum::MAX_TIME_INTERVAL);
}
Пример #11
0
void ImageViewer::mouseReleaseEvent(QMouseEvent *event) {
    unsetCursor();
    QWidget::mouseReleaseEvent(event);
    if(!mIsDisplaying) {
        mouseInteraction = MOUSE_NONE;
        if(event->button() == Qt::RightButton) {
            emit rightClicked();
        } else if(event->button() == Qt::LeftButton) {
            emit leftClicked();
        }
        return;
    }
    if(mouseInteraction == MOUSE_NONE) {
        if(event->button() == Qt::RightButton) {
            emit rightClicked();
        } else if(event->button() == Qt::LeftButton) {
            emit leftClicked();
        }
    }
    mouseInteraction = MOUSE_NONE;
}
Пример #12
0
void SoundLibraryTree::mousePressEvent(QMouseEvent *event)
{
//	INFOLOG( "[mousePressEvent]" );
	QTreeWidget::mousePressEvent( event );

	if ( event->button() == Qt::RightButton ) {
		emit rightClicked( QPoint( event->globalX(), event->globalY() ) );

	}
	else if (event->button() == Qt::LeftButton ) {
		emit leftClicked( QPoint( event->globalX(), event->globalY() ) );
	}
}
Пример #13
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    hwnd = (HWND)ui->paintArea->winId();
    hdc = GetDC(hwnd);
    painter = new Paint;

    connect(ui->red, 	SIGNAL(rightClicked()), this, SLOT(onRedRightClicked()));
    connect(ui->red, 	SIGNAL(leftClicked()), 	this, SLOT(onRedLeftClicked()));
    connect(ui->orange, SIGNAL(rightClicked()), this, SLOT(onOrangeRightClicked()));
    connect(ui->orange, SIGNAL(leftClicked()), 	this, SLOT(onOrangeLeftClicked()));
    connect(ui->yellow, SIGNAL(rightClicked()), this, SLOT(onYellowRightClicked()));
    connect(ui->yellow, SIGNAL(leftClicked()), 	this, SLOT(onYellowLeftClicked()));
    connect(ui->purple, SIGNAL(rightClicked()), this, SLOT(onPurpleRightClicked()));
    connect(ui->purple, SIGNAL(leftClicked()), 	this, SLOT(onPurpleLeftClicked()));
    connect(ui->blue, 	SIGNAL(rightClicked()), this, SLOT(onBlueRightClicked()));
    connect(ui->blue, 	SIGNAL(leftClicked()), 	this, SLOT(onBlueLeftClicked()));
    connect(ui->green, 	SIGNAL(rightClicked()), this, SLOT(onGreenRightClicked()));
    connect(ui->green, 	SIGNAL(leftClicked()), 	this, SLOT(onGreenLeftClicked()));

    connect(ui->purpleLight, 	SIGNAL(rightClicked()), this, SLOT(onPurpleLightRightClicked()));
    connect(ui->purpleLight, 	SIGNAL(leftClicked()), 	this, SLOT(onPurpleLightLeftClicked()));
    connect(ui->blueLight, 		SIGNAL(rightClicked()), this, SLOT(onBlueLightRightClicked()));
    connect(ui->blueLight, 		SIGNAL(leftClicked()), 	this, SLOT(onBlueLightLeftClicked()));
    connect(ui->greenLight, 	SIGNAL(rightClicked()), this, SLOT(onGreenLightRightClicked()));
    connect(ui->greenLight, 	SIGNAL(leftClicked()), 	this, SLOT(onGreenLightLeftClicked()));

    connect(ui->zoom, SIGNAL(leftClicked()), this, SLOT(on_zoomOut_clicked()));
    connect(ui->zoom, SIGNAL(rightClicked()), this, SLOT(on_zoomIn_clicked()));

    connect(ui->paintArea,  SIGNAL(leftPressed(int, int)), this, SLOT(mouseLeftPressed(int, int)));
    connect(ui->paintArea,  SIGNAL(rightPressed(int, int)), this, SLOT(mouseRightPressed(int, int)));
    connect(ui->paintArea,  SIGNAL(leftReleased(int, int)), this, SLOT(mouseLeftReleased(int, int)));
    connect(ui->paintArea,  SIGNAL(rightReleased(int, int)), this, SLOT(mouseRightReleased(int, int)));
    connect(ui->paintArea,  SIGNAL(moved(int, int)), this, SLOT(mouseMoved(int, int)));
    connect(ui->paintArea,  SIGNAL(doubleClicked()), this, SLOT(mouseDoubleClicked()));
}
Пример #14
0
void RecipeWidget::addTag(QString tagname)
{
    ExtendedButton *tag = new ExtendedButton(tagname);
    tag->setObjectName("tag");
    tagLayout->addWidget(tag);

    leftClickMapper.setMapping(tag, tagname);
    rightClickMapper.setMapping(tag, tagname);

    QObject::connect(tag, SIGNAL(leftClicked()), &leftClickMapper, SLOT(map()));
    QObject::connect(tag, SIGNAL(rightClicked()), &rightClickMapper, SLOT(map()));

    tags.append(tag);
}
Пример #15
0
void DClusterTransferDevicePage::on_btnCancel_clicked()
{
    QHashIterator<quint64, GroupButton*> iter(devicesBtnList);
    QPixmap pixmapBtnCancel(ImagePath::SELECT_CANCEL);
    pixmapBtnCancel.setDevicePixelRatio(2.0);

    while(iter.hasNext()){
        iter.next();
        GroupButton* groupButton = iter.value();
        if(groupButton->getSelectFlag()){
            groupButton->setReserve(pixmapBtnCancel);
            groupButton->setSelectFlag(false);
            deviceTransferCount--;
        }
    }

    QString strLeftBtn = "返回";
    QPixmap leftArrowsPixmap(ImagePath::NAVIGATION_LEFT_ARROWS);
    navigationBar->setLeftText(strLeftBtn);
    navigationBar->setLeftPixMap(leftArrowsPixmap);
    disconnect(navigationBar, SIGNAL(leftClicked()), this, SLOT(on_btnCancel_clicked()));
    connect(navigationBar, SIGNAL(leftClicked()), this, SLOT(on_btnPrePage_clicked()));
}
Пример #16
0
void DClusterTransferDevicePage::initializeWidget()
{
    //提示信息页面操作
    hintMsgPage = new HintMsgPage(this);
    hintMsgPage->hide();
    connect(hintMsgPage, SIGNAL(submitClicked(bool)), this, SLOT(on_hintMsgPage(bool)));

    //导航栏
    QString strTitle = "移交设备";
    QString strLeftBtn = "返回";
    QString strRightBtn = "移交";
    QPixmap leftArrowsPixmap(ImagePath::NAVIGATION_LEFT_ARROWS);
    navigationBar = new NavigationBar(this);
    navigationBar->setTitleText(strTitle);
    navigationBar->setLeftText(strLeftBtn);
    navigationBar->setRightText(strRightBtn);
    navigationBar->setLeftPixMap(leftArrowsPixmap);
    connect(navigationBar, SIGNAL(leftClicked()), this, SLOT(on_btnPrePage_clicked()));
    connect(navigationBar, SIGNAL(rightClicked()), this, SLOT(on_transferDevice_clicked()));

    //提示信息
    lblHint = new QLabel(this);
    lblHint->setAlignment(Qt::AlignCenter);
    lblHint->hide();

    QHBoxLayout* pHLTop = new QHBoxLayout();
    pHLTop->addWidget(navigationBar);
    pHLTop->setSpacing(0);
    pHLTop->setMargin(0);
    this->setTopbarLayout(pHLTop);

    //群成员布局
    deviceListLayout = new QVBoxLayout();
    deviceListLayout->setMargin(0);
    deviceListLayout->setSpacing(0);
    deviceListLayout->setContentsMargins(0, 0, 0, 0);

    QVBoxLayout* vblTotalLayout = new QVBoxLayout();
    vblTotalLayout->addWidget(lblHint);
    vblTotalLayout->addLayout(deviceListLayout);
    vblTotalLayout->addStretch(0);
    vblTotalLayout->setMargin(0);
    vblTotalLayout->setSpacing(0);
    vblTotalLayout->setAlignment(Qt::AlignTop);
    this->setBodyPartLayout(vblTotalLayout);

    //屏幕触摸滚动设置
    this->installScrollViewportArea();
    timerID = this->startTimer(ConstNum::MAX_TIME_INTERVAL);
}
Пример #17
0
void DClusterTransferDevicePage::on_btnDeviceButton_clicked()
{
    GroupButton* groupButton = dynamic_cast<GroupButton*>(sender());
    QPixmap pixmapBtnDelete(ImagePath::SELECT_SUBMIT);
    pixmapBtnDelete.setDevicePixelRatio(2.0);

    QPixmap pixmapBtnCancel(ImagePath::SELECT_CANCEL);
    pixmapBtnCancel.setDevicePixelRatio(2.0);

    if(groupButton->getSelectFlag() == false){
        groupButton->setReserve(pixmapBtnDelete);
        groupButton->setSelectFlag(true);
        deviceTransferCount++;
    }
    else{
        groupButton->setReserve(pixmapBtnCancel);
        groupButton->setSelectFlag(false);
        deviceTransferCount--;
    }

    if(deviceTransferCount > 0){
        QString strLeftBtn = "取消";
        QPixmap leftArrowsPixmap("");
        navigationBar->setLeftText(strLeftBtn);
        navigationBar->setLeftPixMap(leftArrowsPixmap);
        disconnect(navigationBar, SIGNAL(leftClicked()), this, SLOT(on_btnPrePage_clicked()));
        connect(navigationBar, SIGNAL(leftClicked()), this, SLOT(on_btnCancel_clicked()));
    }
    else{
        QString strLeftBtn = "返回";
        QPixmap leftArrowsPixmap(ImagePath::NAVIGATION_LEFT_ARROWS);
        navigationBar->setLeftText(strLeftBtn);
        navigationBar->setLeftPixMap(leftArrowsPixmap);
        disconnect(navigationBar, SIGNAL(leftClicked()), this, SLOT(on_btnCancel_clicked()));
        connect(navigationBar, SIGNAL(leftClicked()), this, SLOT(on_btnPrePage_clicked()));
    }
}
Пример #18
0
void StudentMainWidget::populateTableData()
{
    QString tempString;
    Lesson tempLesson;
    QTableWidgetItem *item;
    lessons = LessonsDBController::getDB();

    while (mainTable->rowCount() < lessons->getLessons().size())
    {
        mainTable->insertRow(mainTable->rowCount());
    }
    while (mainTable->rowCount() > lessons->getLessons().size())
    {
        mainTable->removeRow(mainTable->rowCount()-1);
    }

    for (int i=0; i<lessons->getLessons().size(); i++)
    {
        tempLesson = lessons->getLessons().at(i);
        tempString = tempLesson.getTopic();
        item = new QTableWidgetItem(tr(tempString.toStdString().c_str()));
        item->setFlags(item->flags() ^ Qt::ItemIsEditable);
        mainTable->setItem(i,0,item);


        tempString = tempLesson.getLesson();
        GridButton *button = new GridButton(this);
        button->setText(tr(tempString.toStdString().c_str()));
        button->setIndex(i);
        button->setEnabled(true);
        connect(button,SIGNAL(leftClicked()),this,SLOT(transition()));
        connect(button,SIGNAL(entered()),this,SLOT(changeToHand()));
        connect(button,SIGNAL(left()),this,SLOT(changeToCursor()));
        mainTable->setCellWidget(i,1,button);

        int maxMarks = tempLesson.getMaxMarks();

        tempString = "0";
        tempString += "/";
        tempString += QString::number(maxMarks);

        item = new QTableWidgetItem(tr(tempString.toStdString().c_str()));
        item->setFlags(item->flags() ^ Qt::ItemIsEditable);
        mainTable->setItem(i,2,item);
    }


}
Пример #19
0
void KTabBar::init()
{
  ptab = new KTabBarProtected;
  ptab->tpos = 0;
  ptab->leftscroll = ptab->rightscroll = false;
  ptab->tabw = new QWidget(this);
  ptab->qtab = new QTabBar(ptab->tabw);

  ptab->left = new KTabButton(LeftArrow, this);
  connect( ptab->left, SIGNAL(clicked()), SLOT( leftClicked()) );

  ptab->right = new KTabButton(RightArrow, this);
  connect( ptab->right, SIGNAL(clicked()), SLOT( rightClicked()) );

  connect( ptab->qtab, SIGNAL(selected(int)), SLOT( emitSelected(int)) );

  //debug("init - done");
}
Пример #20
0
bool MainWidget::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: upClicked(); break;
    case 1: downClicked(); break;
    case 2: leftClicked(); break;
    case 3: rightClicked(); break;
    case 4: menuClicked(); break;
    case 5: radioClicked(); break;
    case 6: mp3Clicked(); break;
    case 7: gpsClicked(); break;
    case 8: obdiiClicked(); break;
    case 9: photoClicked(); break;
    case 10: linuxClicked(); break;
    default:
	return QWidget::qt_invoke( _id, _o );
    }
    return TRUE;
}
Пример #21
0
/*
 * constructor
 */
Tile::Tile( int row, int column, QGridLayout *grid ) {
        this->x = row;
        this->y = column;
        this->button = new MineButton();
        this->button->setMaximumWidth( Mines::buttonSize );
        this->button->setMaximumHeight( Mines::buttonSize );
        this->button->setMinimumWidth( Mines::buttonSize );
        this->button->setMinimumHeight( Mines::buttonSize );
        this->button->setCheckable( true );
        this->button->setStyleSheet( "MineButton:checked{ border: none; }" );
        this->button->connect( this->button, SIGNAL(leftClicked()), this, SLOT(buttonPressed()));
        this->button->connect( this->button, SIGNAL(rightClicked()), this, SLOT(rightButtonPressed()));
        this->grid = grid;
        this->grid->addWidget( this->button, column, row, 1, 1 );
        this->visited = false;
        this->flagged = false;

        QFont font = this->button->font();
        font.setPointSize( 18 );
        this->button->setFont( font );
}
Пример #22
0
void Column::mousePressEvent(QMouseEvent * event)
{
    switch (event->button())
    {
    case Qt::LeftButton:
    {
        emit leftClicked(m_number, event->modifiers());
        event->accept();
        break;
    }
    case Qt::RightButton:
    {
        emit rightClicked(m_number);
        event->accept();
        break;
    }
    default:
    {
        event->ignore();
        break;
    }
    }
}
Пример #23
0
void UserSettingPage::initializeWidget()
{
    //导航栏
    QString strTitle = tr("设置");
    QString strLeftBtn = tr("返回");
    QPixmap leftArrowsPixmap(ImagePath::NAVIGATION_LEFT_ARROWS);
    navigationBar = new NavigationBar(this);
    navigationBar->setTitleText(strTitle);
    navigationBar->setLeftText(strLeftBtn);
    navigationBar->setLeftPixMap(leftArrowsPixmap);
    connect(navigationBar, SIGNAL(leftClicked()), this, SLOT(on_btnPrePage_clicked()));

    QHBoxLayout* pHLTop = new QHBoxLayout();
    pHLTop->addWidget(navigationBar);
    pHLTop->setSpacing(0);
    pHLTop->setMargin(0);
    this->setTopbarLayout(pHLTop);

    //账号与安全
    btnAccountSafe = new GroupButton(this);
    this->setGroupButton(btnAccountSafe, tr("账号与安全"));
    btnAccountSafe->setContentsMargins(this->screenWidth()*0.03,0,this->screenWidth()*0.02,0);
    btnAccountSafe->setStyleSheet(SheetStyle::GROUPBUTTON_UPANDDOWNBORDER);
    connect(btnAccountSafe, SIGNAL(clicked()), SLOT(on_btnAccountSafe_clicked()));

    //反馈
    btnFeedback = new GroupButton(this);
    this->setGroupButton(btnFeedback, tr("反馈"));
    btnFeedback->setStyleSheet(SheetStyle::GROUPBUTTON_BOTTOMBORDER);
    connect(btnFeedback, SIGNAL(clicked()), SLOT(on_btnFeedback_clicked()));

    //关于
    btnAbout = new GroupButton(this);
    this->setGroupButton(btnAbout, tr("关于"));
    btnAbout->setStyleSheet(SheetStyle::GROUPBUTTON_NOBORDER);
    connect(btnAbout, SIGNAL(clicked()), SLOT(on_btnAbout_clicked()));

    generalListWidget = new ListWidget(this);
    generalListWidget->addWidget(btnFeedback);
    generalListWidget->addWidget(btnAbout);
    this->setListWidget(generalListWidget);

    //退出登录
    btnExitLogin = new QPushButton(this);
    btnExitLogin->setText(tr("退出登录"));
    btnExitLogin->setAttribute(Qt::WA_LayoutUsesWidgetRect);
    btnExitLogin->setFixedHeight(this->screenHeight()*0.074);
    btnExitLogin->setStyleSheet("color:white; background-color:rgb(236,80,80); border-radius: 0px; font:16px");
    connect(btnExitLogin, SIGNAL(clicked()), this, SLOT(on_btnExitLogin_clicked()));

    QVBoxLayout* vblTotalLayout = new QVBoxLayout;
    vblTotalLayout->addSpacing(this->screenHeight()*0.026);
    vblTotalLayout->addWidget(btnAccountSafe);
    vblTotalLayout->addSpacing(this->screenHeight()*0.037);
    vblTotalLayout->addWidget(generalListWidget);
    vblTotalLayout->addSpacing(this->screenHeight()*0.037);
    vblTotalLayout->addWidget(btnExitLogin);
    vblTotalLayout->setMargin(0);
    vblTotalLayout->setSpacing(0);
    vblTotalLayout->addStretch(0);
    this->setBodyPartLayout(vblTotalLayout);

    //屏幕触摸滚动设置
    this->installScrollViewportArea();
}
Пример #24
0
XJudgerMain::XJudgerMain(QMainWindow *parent): QMainWindow(parent){
	//Basic Building
	CurrentDir = getCwd();
	if (objectName().isEmpty()) setObjectName("XJudgerMain");
	setGeometry((QApplication::desktop() -> width() - 800) / 2, (QApplication::desktop() -> height() - 600) / 2, 800, 600);
	QIcon WindowIcon;
	setWindowIcon(QIcon(":/Icons/XJudgerMain.png"));
    MainActionExit = new QAction(this);
    MainActionExit -> setObjectName("MainActionExit");
	MainActionAbout = new QAction(this);
	MainActionAbout -> setObjectName("MainActionAbout");
    CentralWidget = new QWidget(this);
    CentralWidget -> setObjectName("CentralWidget");
    TestForm = new XJudgerTest(this);
	ViewForm = new XJudgerView(this);
	setCentralWidget(CentralWidget);
    MenuBar = new QMenuBar(this);
    MenuBar -> setObjectName("MenuBar");
    MainMenuFile = new QMenu(MenuBar);
    MainMenuFile -> setObjectName("MainMenuFile");
	MainMenuHelp = new QMenu(MenuBar);
	MainMenuHelp -> setObjectName("MainMenuHelp");
    setMenuBar(MenuBar);
    StatusBar = new QStatusBar(this);
    StatusBar -> setObjectName("StatusBar");
    setStatusBar(StatusBar);
    MenuBar -> addAction(MainMenuFile -> menuAction());
    MainMenuFile -> addAction(MainActionExit);
    MenuBar -> addAction(MainMenuHelp -> menuAction());
	MainMenuHelp -> addAction(MainActionAbout);
	MainTab = new QTabWidget(this);
	MainTab -> setObjectName("MainTab");
	DataConfig = new DataInfo(CurrentDir);
	LayoutMain = new QGridLayout(CentralWidget);
	LayoutMain -> setObjectName("LayoutMain");
	LayoutMain -> addWidget(MainTab, 0, 0, 0, 0);
	
	//Building TabData
	TabData = new QWidget;
	TabData -> setObjectName(QString::fromUtf8("TabData"));
	MainTab -> addTab(TabData, QString::fromUtf8("Data"));
	GroupViewProb = new QGroupBox(TabData);
	GroupViewProb -> setObjectName(QString::fromUtf8("GroupViewProb"));
	GroupViewCase = new QGroupBox(TabData);
	GroupViewCase -> setObjectName(QString::fromUtf8("GroupViewCase"));
	GroupViewData = new QGroupBox(TabData);
	GroupViewData -> setObjectName(QString::fromUtf8("GroupViewData"));
	MainViewData = new TreeView(GroupViewData);
	MainViewData -> setObjectName(QString::fromUtf8("MainViewData"));
	MainViewData -> setMaximumWidth(200);

	TextProbName = new QPlainTextEdit(GroupViewProb);
	TextProbName -> setObjectName("TextProbName");
	TextProbName -> setMaximumHeight(30);
	TextProbName -> setTabChangesFocus(1);
	LabelProb = new QLabel(GroupViewProb);
	LabelProb -> setObjectName("LabelProb");
	LabelProb -> setText("Problem Name: ");
	TextInput = new QPlainTextEdit(GroupViewProb);
	TextInput -> setObjectName("TextInput");
	TextInput -> setMaximumHeight(30);
	TextInput -> setTabChangesFocus(1);
	LabelInput = new QLabel(GroupViewProb);
	LabelInput -> setObjectName("LabelInput");
	LabelInput -> setText("Input File Name: ");
	TextOutput = new QPlainTextEdit(GroupViewProb);
	TextOutput -> setObjectName("TextOutput");
	TextOutput -> setMaximumHeight(30);
	TextOutput -> setTabChangesFocus(1);
	LabelOutput = new QLabel(GroupViewProb);
	LabelOutput -> setObjectName("LabelOutput");
	LabelOutput -> setText("Output File Name: ");
	TextSource = new QPlainTextEdit(GroupViewProb);
	TextSource -> setObjectName("TextSource");
	TextSource -> setMaximumHeight(30);
	TextSource -> setTabChangesFocus(1);
	LabelSource = new QLabel(GroupViewProb);
	LabelSource -> setObjectName("LabelSource");
	LabelSource -> setText("Source File Name: ");
	
	LabelCaseInput = new QLabel(GroupViewCase);
	LabelCaseInput -> setObjectName("LabelCaseInput");
	LabelCaseInput -> setText("Input File Name: ");
	TextCaseInput = new QPlainTextEdit(GroupViewCase);
	TextCaseInput -> setObjectName("TextCaseInput");
	TextCaseInput -> setMaximumHeight(30);
	TextCaseInput -> setTabChangesFocus(1);
	LabelCaseOutput = new QLabel(GroupViewCase);
	LabelCaseOutput -> setObjectName("LabelCaseOutput");
	LabelCaseOutput -> setText("Output File Name: ");
	TextCaseOutput = new QPlainTextEdit(GroupViewProb);
	TextCaseOutput -> setObjectName("TextCaseOutput");
	TextCaseOutput -> setMaximumHeight(30);
	TextCaseOutput -> setTabChangesFocus(1);
	LabelCaseScore = new QLabel(GroupViewCase);
	LabelCaseScore -> setObjectName("LabelCaseScore");
	LabelCaseScore -> setText("Score: ");
	TextCaseScore = new QPlainTextEdit(GroupViewCase);
	TextCaseScore -> setObjectName("TextCaseScore");
	TextCaseScore -> setMaximumHeight(30);
	TextCaseScore -> setTabChangesFocus(1);
	LabelCaseTL = new QLabel(GroupViewCase);
	LabelCaseTL -> setObjectName("LabelCaseTL");
	LabelCaseTL -> setText("Time Limit (second): ");
	TextCaseTL = new QPlainTextEdit(GroupViewCase);
	TextCaseTL -> setObjectName("TextCaseTL");
	TextCaseTL -> setMaximumHeight(30);
	TextCaseTL -> setTabChangesFocus(1);
	LabelCaseML = new QLabel(GroupViewCase);
	LabelCaseML -> setObjectName("LabelCaseML");
	LabelCaseML -> setText("Memory Limit (kb): ");
	TextCaseML = new QPlainTextEdit(GroupViewCase);
	TextCaseML -> setObjectName("TextCaseML");
	TextCaseML -> setMaximumHeight(30);
	TextCaseML -> setTabChangesFocus(1);

	LayoutTabData = new QGridLayout(TabData);
	LayoutTabData -> setObjectName("LayoutTabData");
	LayoutTabData -> addWidget(GroupViewData, 0, 0, 10, 1, Qt::AlignLeft);
	LayoutTabData -> addWidget(GroupViewProb, 0, 1, 10, 1, Qt::AlignTop);
	LayoutTabData -> addWidget(GroupViewCase, 0, 1, 10, 1, Qt::AlignTop);
	GroupViewProb -> setVisible(0);
	GroupViewCase -> setVisible(0);
	LayoutGroupProb = new QGridLayout(GroupViewProb);
	LayoutGroupProb -> setObjectName("LayoutGroupProb");
	LayoutGroupProb -> addWidget(TextProbName, 0, 1, 1, 1);
	LayoutGroupProb -> addWidget(LabelProb, 0, 0, 1, 1);
	LayoutGroupProb -> addWidget(TextInput, 1, 1, 1, 1);
	LayoutGroupProb -> addWidget(LabelInput, 1, 0, 1, 1);
	LayoutGroupProb -> addWidget(TextOutput, 2, 1, 1, 1);
	LayoutGroupProb -> addWidget(LabelOutput, 2, 0, 1, 1);
	LayoutGroupProb -> addWidget(TextSource, 3, 1, 1, 1);
	LayoutGroupProb -> addWidget(LabelSource, 3, 0, 1, 1);
	LayoutGroupProb -> setSizeConstraint(QLayout::SetMinAndMaxSize);
	LayoutGroupData = new QGridLayout(GroupViewData);
	LayoutGroupData -> setObjectName("LayoutGroupData");
	LayoutGroupData -> setSizeConstraint(QLayout::SetMinAndMaxSize);
	LayoutGroupData -> addWidget(MainViewData, 0, 0, 1, 1);
	LayoutGroupCase = new QGridLayout(GroupViewCase);
	LayoutGroupCase -> setObjectName("LayoutGroupCase");
	LayoutGroupCase -> addWidget(TextCaseInput, 0, 1, 1, 1);
	LayoutGroupCase -> addWidget(LabelCaseInput, 0, 0, 1, 1);
	LayoutGroupCase -> addWidget(TextCaseOutput, 1, 1, 1, 1);
	LayoutGroupCase -> addWidget(LabelCaseOutput, 1, 0, 1, 1);
	LayoutGroupCase -> addWidget(TextCaseScore, 2, 1, 1, 1);
	LayoutGroupCase -> addWidget(LabelCaseScore, 2, 0, 1, 1);
	LayoutGroupCase -> addWidget(TextCaseTL, 3, 1, 1, 1);
	LayoutGroupCase -> addWidget(LabelCaseTL, 3, 0, 1, 1);
	LayoutGroupCase -> addWidget(TextCaseML, 4, 1, 1, 1);
	LayoutGroupCase -> addWidget(LabelCaseML, 4, 0, 1, 1);
	
	//Building TabTest
	TabTest = new QWidget;
	TabTest -> setObjectName(QString::fromUtf8("TabTest"));
	MainTab -> addTab(TabTest, QString::fromUtf8("Test"));
	MainViewScore = new TreeView(TabTest);
	MainViewScore -> setObjectName(QString::fromUtf8("MainViewScore"));
	MainViewScore -> setSelectionMode(QAbstractItemView::ExtendedSelection);
	MainViewScore -> setRootIsDecorated(0);
	MainViewScore -> setSortingEnabled(1);
	MainButtonTest = new QPushButton(TabTest);
	MainButtonTest -> setObjectName(QString::fromUtf8("MainButtonTest"));
	MainButtonTestAll = new QPushButton(TabTest);
	MainButtonTestAll -> setObjectName(QString::fromUtf8("MainButtonTestAll"));
    MainButtonRefresh = new QPushButton(TabTest);
	MainButtonRefresh -> setObjectName(QString::fromUtf8("MainButtonRefresh"));
	LayoutTabTest = new QGridLayout(TabTest);
	LayoutTabTest -> setObjectName("LayoutTabTest");
	LayoutTabTest -> addWidget(MainViewScore, 0, 0, 1, 4);
	LayoutTabTest -> addWidget(MainButtonTest, 1, 0, 1, 1);
	LayoutTabTest -> addWidget(MainButtonTestAll, 1, 1, 1, 1);
	LayoutTabTest -> addWidget(MainButtonRefresh, 1, 2, 1, 1);
	
	//Building MenuData
	MenuData = new QMenu(this);
	MenuData -> setObjectName("MenuData");
	MainViewData -> setMenu(MenuData);
	QAction *ActProbInsert = MenuData -> addAction("Insert Problem");
	QAction *ActProbRemove = MenuData -> addAction("Remove Problem");
	MenuData -> addSeparator();
	QAction *ActCaseInsert = MenuData -> addAction("Insert Test Case");
	QAction *ActCaseRemove = MenuData -> addAction("Remove Test Case");
	MenuData -> addSeparator();
	QAction *ActConfigCase = MenuData -> addAction("Automatically Configing Test Cases");

	//Set Title
    setWindowTitle(ProjectName " - " MainVersion " - " VersionNumber);
    MainActionExit -> setText("Exit");
	MainActionAbout -> setText("About");
    MainMenuFile -> setTitle("File");
	MainMenuHelp -> setTitle("Help");
    MainButtonTest -> setText("Test");
    MainButtonTestAll -> setText("Test All");
    MainButtonRefresh -> setText("Refresh");
	
	//Connecting Objects
	connect(MainActionExit, SIGNAL(triggered()), this, SLOT(shut()));
	connect(MainActionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
	connect(ActProbInsert, SIGNAL(triggered()), this, SLOT(insertProblem()));
	connect(ActProbRemove, SIGNAL(triggered()), this, SLOT(removeProblem()));
	connect(ActCaseInsert, SIGNAL(triggered()), this, SLOT(insertTestCase()));
	connect(ActCaseRemove, SIGNAL(triggered()), this, SLOT(removeTestCase()));
	connect(ActConfigCase, SIGNAL(triggered()), this, SLOT(configTestCase()));
	connect(MainButtonTest, SIGNAL(clicked()), this, SLOT(testSelUser()));
	connect(MainButtonTestAll, SIGNAL(clicked()), this, SLOT(testAllUser()));
	connect(MainButtonRefresh, SIGNAL(clicked()), this, SLOT(scoreRefresh()));
	connect(MainViewData, SIGNAL(leftClicked()), this, SLOT(showProbCase()));
	connect(MainViewData, SIGNAL(rightClicked()), this, SLOT(showProbCase()));
	connect(MainViewData, SIGNAL(keyPressed(int)), this, SLOT(showProbCase()));
	connect(MainViewScore, SIGNAL(doubleClicked()), this, SLOT(viewUserInfo()));
	//Connect to Case Change
	connect(TextCaseInput, SIGNAL(textChanged()), this, SLOT(updateTestCase()));
	connect(TextCaseScore, SIGNAL(textChanged()), this, SLOT(updateTestCase()));
	connect(TextCaseOutput, SIGNAL(textChanged()), this, SLOT(updateTestCase()));
	connect(TextCaseTL, SIGNAL(textChanged()), this, SLOT(updateTestCase()));
	connect(TextCaseML, SIGNAL(textChanged()), this, SLOT(updateTestCase()));
	//Connect to Problem Change
	connect(TextInput, SIGNAL(textChanged()), this, SLOT(updateProblem()));
	connect(TextSource, SIGNAL(textChanged()), this, SLOT(updateProblem()));
	connect(TextOutput, SIGNAL(textChanged()), this, SLOT(updateProblem()));
	connect(TextProbName, SIGNAL(textChanged()), this, SLOT(updateProblem()));
	
	//List -- Show Objects
	updateDir();
	showData();
}
Пример #25
0
 void PagingWidget::leftButton_clicked()
 {
     int limit = _batchSizeEdit->text().toInt();
     int skip = _skipEdit->text().toInt();
     emit leftClicked(skip, limit);
 }
Пример #26
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent), ui(new Ui::MainWindow),
    logNewMessages(0), logHasErrors(false), showNewLogNumber(true)
{
    ui->setupUi(this);

    setWindowIcon(QIcon(c_icon_app));
    setWindowTitle(c_qtau_name);
    setAcceptDrops(true);
    setContextMenuPolicy(Qt::NoContextMenu);

    //-----------------------------------------

    QLabel *meterLabel = new QLabel(QString("%1/%2") .arg(ns.notesInBar).arg(ns.noteLength), this);
    QLabel *tempoLabel = new QLabel(QString("%1 %2").arg(ns.tempo).arg(tr("bpm")),           this);

    QHBoxLayout *bpmHBL = new QHBoxLayout();
    bpmHBL->setContentsMargins(0,0,0,0);
    bpmHBL->addSpacing(5);
    bpmHBL->addWidget(meterLabel);
    bpmHBL->addWidget(tempoLabel);
    bpmHBL->addSpacing(5);

    QFrame *tempoPanel = new QFrame(this);
    tempoPanel->setMinimumSize(c_piano_min_width, c_meter_min_height);
    tempoPanel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    tempoPanel->setContentsMargins(1,0,1,1);
    tempoPanel->setFrameStyle(QFrame::Panel | QFrame::Raised);

    tempoPanel->setLayout(bpmHBL);

    meter = new qtauMeterBar(this);
    meter->setMinimumHeight(c_meter_min_height);
    meter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    meter->setContentsMargins(0,0,0,0);

    piano = new qtauPiano(ui->centralWidget);
    piano->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    piano->setMinimumSize(c_piano_min_width, c_piano_min_height);
    piano->setContentsMargins(0,0,0,0);

    zoom = new QSlider(Qt::Horizontal, ui->centralWidget);
    zoom->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    zoom->setRange(0, c_zoom_num - 1);
    zoom->setSingleStep(1);
    zoom->setPageStep(1);
    zoom->setValue(cdef_zoom_index);
    zoom->setMinimumWidth(c_piano_min_width);
    zoom->setGeometry(0,0,c_piano_min_width,10);
    zoom->setContentsMargins(0,0,0,0);

    noteEditor = new qtauNoteEditor(ui->centralWidget);
    noteEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    noteEditor->setContentsMargins(0,0,0,0);

    hscr = new QScrollBar(Qt::Horizontal, ui->centralWidget);
    vscr = new QScrollBar(Qt::Vertical,   ui->centralWidget);

    hscr->setContentsMargins(0,0,0,0);
    vscr->setContentsMargins(0,0,0,0);
    hscr->setRange(0, ns.note.width() * ns.notesInBar * cdef_bars);
    vscr->setRange(0, ns.note.height() * 12 * ns.numOctaves);
    hscr->setSingleStep(ns.note.width());
    vscr->setSingleStep(ns.note.height());
    hscr->setContextMenuPolicy(Qt::NoContextMenu);
    vscr->setContextMenuPolicy(Qt::NoContextMenu);

    //---- vocal and music waveform panels, hidden until synthesized (vocal wave) and/or loaded (music wave)

    QScrollBar *dummySB = new QScrollBar(this);
    dummySB->setOrientation(Qt::Vertical);
    dummySB->setRange(0,0);
    dummySB->setEnabled(false);

    QFrame *vocalControls = new QFrame(this);
    vocalControls->setContentsMargins(0,0,0,0);
    vocalControls->setMinimumSize(c_piano_min_width, c_waveform_min_height);
    vocalControls->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    vocalControls->setFrameStyle(QFrame::Panel | QFrame::Raised);

    vocalWave = new qtauWaveform(this);
    vocalWave->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    vocalWave->setMinimumHeight(c_waveform_min_height);
    vocalWave->setContentsMargins(0,0,0,0);

    QHBoxLayout *vocalWaveL = new QHBoxLayout();
    vocalWaveL->setContentsMargins(0,0,0,0);
    vocalWaveL->setSpacing(0);
    vocalWaveL->addWidget(vocalControls);
    vocalWaveL->addWidget(vocalWave);
    vocalWaveL->addWidget(dummySB);

    vocalWavePanel = new QWidget(this);
    vocalWavePanel->setContentsMargins(0,0,0,0);
    vocalWavePanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);

    vocalWavePanel->setLayout(vocalWaveL);
    vocalWavePanel->setVisible(false);

    //---------

    QScrollBar *dummySB2 = new QScrollBar(this);
    dummySB2->setOrientation(Qt::Vertical);
    dummySB2->setRange(0,0);
    dummySB2->setEnabled(false);

    QFrame *musicControls = new QFrame(this);
    musicControls->setContentsMargins(0,0,0,0);
    musicControls->setMinimumSize(c_piano_min_width, c_waveform_min_height);
    musicControls->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    musicControls->setFrameStyle(QFrame::Panel | QFrame::Raised);

    musicWave = new qtauWaveform(this);
    musicWave->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    musicWave->setMinimumHeight(c_waveform_min_height);
    musicWave->setContentsMargins(0,0,0,0);

    QHBoxLayout *musicWaveL = new QHBoxLayout();
    musicWaveL->setContentsMargins(0,0,0,0);
    musicWaveL->setSpacing(0);
    musicWaveL->addWidget(musicControls);
    musicWaveL->addWidget(musicWave);
    musicWaveL->addWidget(dummySB2);

    musicWavePanel = new QWidget(this);
    musicWavePanel->setContentsMargins(0,0,0,0);
    musicWavePanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);

    musicWavePanel->setLayout(musicWaveL);
    musicWavePanel->setVisible(false);

    //---- notes' dynamics setup area --------------

    QGridLayout *dynBtnL = new QGridLayout();

    QString btnNames[c_dynbuttons_num] = {"VEL", "DYN", "BRE", "BRI", "CLE", "OPE", "GEN", "POR", "PIT", "PBS"};

    for (int i = 0; i < c_dynbuttons_num; ++i)
    {
        qtauDynLabel *l = new qtauDynLabel(btnNames[i], this);
        l->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
        dynBtnL->addWidget(l, i / 2, i % 2, 1, 1);

        l->setStyleSheet(c_dynlbl_css_off);
        l->setFrameStyle(QFrame::Box);
        l->setLineWidth(1);

        connect(l, SIGNAL(leftClicked()),  SLOT(dynBtnLClicked()));
        connect(l, SIGNAL(rightClicked()), SLOT(dynBtnRClicked()));
    }

    dynBtnL->setRowStretch(c_dynbuttons_num / 2, 100);

    QFrame *dynBtnPanel = new QFrame(this);
    dynBtnPanel->setContentsMargins(0,0,0,0);
    dynBtnPanel->setMinimumSize(c_piano_min_width, c_drawzone_min_height);
    dynBtnPanel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    dynBtnPanel->setFrameStyle(QFrame::Panel | QFrame::Raised);

    dynBtnPanel->setLayout(dynBtnL);

    drawZone = new qtauDynDrawer(ui->centralWidget);
    drawZone->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    drawZone->setMinimumHeight(c_drawzone_min_height);
    drawZone->setContentsMargins(0,0,0,0);

    QScrollBar *dummySB3 = new QScrollBar(this);
    dummySB3->setOrientation(Qt::Vertical);
    dummySB3->setRange(0,0);
    dummySB3->setEnabled(false);

    QHBoxLayout *singParamsL = new QHBoxLayout();
    singParamsL->setContentsMargins(0,0,0,0);
    singParamsL->setSpacing(0);
    singParamsL->addWidget(dynBtnPanel);
    singParamsL->addWidget(drawZone);
    singParamsL->addWidget(dummySB3);

    drawZonePanel = new QWidget(this);
    drawZonePanel->setContentsMargins(0,0,0,0);
    drawZonePanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);

    drawZonePanel->setLayout(singParamsL);

    //---- Combining editor panels into hi-level layout ------

    QGridLayout *gl = new QGridLayout();
    gl->setContentsMargins(0,0,0,0);
    gl->setSpacing(0);

    gl->addWidget(tempoPanel, 0, 0, 1, 1);
    gl->addWidget(meter,      0, 1, 1, 1);
    gl->addWidget(piano,      1, 0, 1, 1);
    gl->addWidget(zoom,       2, 0, 1, 1);
    gl->addWidget(noteEditor, 1, 1, 1, 1);
    gl->addWidget(hscr,       2, 1, 1, 1);
    gl->addWidget(vscr,       1, 2, 1, 1);

    QWidget *editorUpperPanel = new QWidget(this);
    editorUpperPanel->setContentsMargins(0,0,0,0);
    editorUpperPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    editorUpperPanel->setMaximumSize(9000,9000);

    editorUpperPanel->setLayout(gl);

    editorSplitter = new QSplitter(Qt::Vertical, this);
    editorSplitter->setContentsMargins(0,0,0,0);
    editorSplitter->addWidget(editorUpperPanel);
    editorSplitter->addWidget(vocalWavePanel);
    editorSplitter->addWidget(musicWavePanel);
    editorSplitter->addWidget(drawZonePanel);
    editorSplitter->setStretchFactor(0, 1);
    editorSplitter->setStretchFactor(1, 0);
    editorSplitter->setStretchFactor(2, 0);
    editorSplitter->setStretchFactor(3, 0);

    QVBoxLayout *edVBL = new QVBoxLayout();
    edVBL->setContentsMargins(0,0,0,0);
    edVBL->addWidget(editorSplitter);

    QWidget *editorPanel = new QWidget(this);
    editorPanel->setContentsMargins(0,0,0,0);
    editorPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    editorPanel->setMaximumSize(9000,9000);

    editorPanel->setLayout(edVBL);

    //---- Voicebank setup tab ---------------------

    QWidget *voicesPanel = new QWidget(this);
    voicesPanel->setContentsMargins(0,0,0,0);
    voicesPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    voicesPanel->setMaximumSize(9000,9000);

    //---- Plugins setup tab -----------------------

    QWidget *pluginsPanel = new QWidget(this);
    pluginsPanel->setContentsMargins(0,0,0,0);
    pluginsPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    pluginsPanel->setMaximumSize(9000,9000);

    //---- Settings tab ----------------------------

    QWidget *settingsPanel = new QWidget(this);
    settingsPanel->setContentsMargins(0,0,0,0);
    settingsPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    settingsPanel->setMaximumSize(9000,9000);

    //---- Documentation tab -----------------------

    QWidget *docsPanel = new QWidget(this);
    docsPanel->setContentsMargins(0,0,0,0);
    docsPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    docsPanel->setMaximumSize(9000,9000);

    QTextEdit *docpad = new QTextEdit(this);
    docpad->setReadOnly(true);
    docpad->setUndoRedoEnabled(false);
    docpad->setContextMenuPolicy(Qt::NoContextMenu);

    QFile embeddedDocTxt(c_doc_txt);

    if (embeddedDocTxt.open(QFile::ReadOnly))
    {
        QTextStream ts(&embeddedDocTxt);
        ts.setAutoDetectUnicode(true);
        ts.setCodec("UTF-8");

        docpad->setText(ts.readAll());
        embeddedDocTxt.close();
    }

    QGridLayout *docL = new QGridLayout();
    docL->setContentsMargins(0,0,0,0);
    docL->addWidget(docpad, 0, 0, 1, 1);

    docsPanel->setLayout(docL);

    //---- Log tab ---------------------------------

    QWidget *logPanel = new QWidget(this);
    logPanel->setContentsMargins(0,0,0,0);
    logPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    logPanel->setMaximumSize(9000,9000);

    logpad = new QTextEdit(this);
    logpad->setReadOnly(true);
    logpad->setUndoRedoEnabled(false);
    logpad->setContextMenuPolicy(Qt::NoContextMenu);
    logpad->setStyleSheet("p, pre { white-space: 1.2; }");

    QGridLayout *logL = new QGridLayout();
    logL->setContentsMargins(0,0,0,0);
    logL->addWidget(logpad, 0, 0, 1, 1);

    logPanel->setLayout(logL);

    //---- Combining tabs togeter ------------------

    tabs = new QTabWidget(this);
    tabs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    tabs->setContentsMargins(0,0,0,0);
    tabs->setMaximumSize(9000, 9000);
    tabs->setTabPosition(QTabWidget::South);
    tabs->setMovable(false); // just to be sure

    tabs->addTab(editorPanel,   QIcon(c_icon_editor),   tr("Editor"));
    tabs->addTab(voicesPanel,   QIcon(c_icon_voices),   tr("Voices"));
    tabs->addTab(pluginsPanel,  QIcon(c_icon_plugins),  tr("Plugins"));
    tabs->addTab(settingsPanel, QIcon(c_icon_settings), tr("Settings"));
    tabs->addTab(docsPanel,     QIcon(c_icon_doc),      tr("Documentation"));
    tabs->addTab(logPanel,      QIcon(c_icon_log),      tr("Log"));

    tabs->widget(0)->setContentsMargins(0,0,0,0);
    tabs->widget(1)->setContentsMargins(0,0,0,0);
    tabs->widget(2)->setContentsMargins(0,0,0,0);
    tabs->widget(3)->setContentsMargins(0,0,0,0);
    tabs->widget(4)->setContentsMargins(0,0,0,0);
    tabs->widget(5)->setContentsMargins(0,0,0,0);

    logTabTextColor = tabs->tabBar()->tabTextColor(5);

    connect(tabs, SIGNAL(currentChanged(int)), SLOT(onTabSelected(int)));

    QVBoxLayout *vbl = new QVBoxLayout();
    vbl->setContentsMargins(0,0,0,0);
    vbl->addWidget(tabs);
    ui->centralWidget->setContentsMargins(0,0,0,0);
    ui->centralWidget->setLayout(vbl);

    //---- Toolbars --------------------------------

    QToolBar *fileTB   = new QToolBar("Fileops",  this);
    QToolBar *playerTB = new QToolBar("Playback", this);
    QToolBar *toolsTB  = new QToolBar("Toolset",  this);

    fileTB  ->setFloatable(false);
    playerTB->setFloatable(false);
    toolsTB ->setFloatable(false);

    fileTB->addAction(ui->actionSave);
    fileTB->addAction(ui->actionSave_audio_as);
    fileTB->addAction(ui->actionUndo);
    fileTB->addAction(ui->actionRedo);

    playerTB->addAction(ui->actionPlay);
    playerTB->addAction(ui->actionStop);
    playerTB->addAction(ui->actionBack);
    playerTB->addAction(ui->actionRepeat);

    volume = new QSlider(Qt::Horizontal, this);
    volume->setMaximum(100);
    volume->setSingleStep(1);
    volume->setPageStep(1);
    volume->setValue(settings.value(c_key_sound, 50).toInt());
    volume->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    connect(playerTB, SIGNAL(orientationChanged(Qt::Orientation)), volume, SLOT(setOrientation(Qt::Orientation)));

    muteBtn = new QAction(QIcon(c_icon_sound), "", this);
    muteBtn->setCheckable(true);
    connect(muteBtn, SIGNAL(toggled(bool)), SLOT(onMute(bool)));

    playerTB->addWidget(volume);
    playerTB->addAction(muteBtn);

    QComboBox *quantizeCombo = new QComboBox(this);
    QComboBox *lengthCombo   = new QComboBox(this);
    quantizeCombo->addItems(QStringList() << "Q/4" << "Q/8" << "Q/16" << "Q/32" << "Q/64");
    lengthCombo  ->addItems(QStringList() << "♪/4" << "♪/8" << "♪/16" << "♪/32" << "♪/64");
    quantizeCombo->setCurrentIndex(3);
    lengthCombo  ->setCurrentIndex(3);

    toolsTB->addAction(ui->actionEdit_Mode);
    toolsTB->addAction(ui->actionGrid_Snap);
    toolsTB->addSeparator();
    toolsTB->addWidget(quantizeCombo);
    toolsTB->addWidget(lengthCombo);

    addToolBar(fileTB);
    addToolBar(playerTB);
    addToolBar(toolsTB);

    toolbars.append(fileTB);
    toolbars.append(playerTB);
    toolbars.append(toolsTB);

    //----------------------------------------------
    connect(quantizeCombo, SIGNAL(currentIndexChanged(int)), SLOT(onQuantizeSelected(int)));
    connect(lengthCombo,   SIGNAL(currentIndexChanged(int)), SLOT(onNotelengthSelected(int)));

    connect(vsLog::instance(), &vsLog::message,             this, &MainWindow::onLog);

    connect(piano,      &qtauPiano      ::heightChanged,    this, &MainWindow::onPianoHeightChanged);
    connect(noteEditor, &qtauNoteEditor ::widthChanged,     this, &MainWindow::onNoteEditorWidthChanged);

    connect(meter,      &qtauMeterBar   ::scrolled,         this, &MainWindow::notesHScrolled);
    connect(piano,      &qtauPiano      ::scrolled,         this, &MainWindow::notesVScrolled);
    connect(drawZone,   &qtauDynDrawer  ::scrolled,         this, &MainWindow::notesHScrolled);
    connect(noteEditor, &qtauNoteEditor ::vscrolled,        this, &MainWindow::notesVScrolled);
    connect(noteEditor, &qtauNoteEditor ::hscrolled,        this, &MainWindow::notesHScrolled);
    connect(vocalWave,  &qtauWaveform   ::scrolled,         this, &MainWindow::notesHScrolled);
    connect(musicWave,  &qtauWaveform   ::scrolled,         this, &MainWindow::notesHScrolled);
    connect(vscr,       &QScrollBar     ::valueChanged,     this, &MainWindow::vertScrolled);
    connect(hscr,       &QScrollBar     ::valueChanged,     this, &MainWindow::horzScrolled);

    connect(noteEditor, &qtauNoteEditor ::rmbScrolled,      this, &MainWindow::onEditorRMBScrolled);
    connect(noteEditor, &qtauNoteEditor ::requestsOffset,   this, &MainWindow::onEditorRequestOffset);

    connect(zoom,       &QSlider        ::valueChanged,     this, &MainWindow::onZoomed);
    connect(meter,      &qtauMeterBar   ::zoomed,           this, &MainWindow::onEditorZoomed);
    connect(noteEditor, &qtauNoteEditor ::zoomed,           this, &MainWindow::onEditorZoomed);
    connect(drawZone,   &qtauDynDrawer  ::zoomed,           this, &MainWindow::onEditorZoomed);
    connect(vocalWave,  &qtauWaveform   ::zoomed,           this, &MainWindow::onEditorZoomed);
    connect(musicWave,  &qtauWaveform   ::zoomed,           this, &MainWindow::onEditorZoomed);

    connect(ui->actionQuit,      &QAction::triggered, [=]() { this->close(); });
    connect(ui->actionOpen,      &QAction::triggered, this, &MainWindow::onOpenUST);
    connect(ui->actionSave,      &QAction::triggered, this, &MainWindow::onSaveUST);
    connect(ui->actionSave_as,   &QAction::triggered, this, &MainWindow::onSaveUSTAs);

    connect(ui->actionUndo,      &QAction::triggered, this, &MainWindow::onUndo);
    connect(ui->actionRedo,      &QAction::triggered, this, &MainWindow::onRedo);
    connect(ui->actionDelete,    &QAction::triggered, this, &MainWindow::onDelete);

    connect(ui->actionEdit_Mode, &QAction::triggered, this, &MainWindow::onEditMode);
    connect(ui->actionGrid_Snap, &QAction::triggered, this, &MainWindow::onGridSnap);

    connect(ui->actionSave_audio_as, &QAction::triggered, this, &MainWindow::onSaveAudioAs);

    //----------------------------------------------

    lastScoreDir     = settings.value(c_key_dir_score,   "").toString();
    lastAudioDir     = settings.value(c_key_dir_audio,   "").toString();
    audioExt         = settings.value(c_key_audio_codec, "").toString();
    showNewLogNumber = settings.value(c_key_show_lognum, true).toBool();

    if (!settings.value(c_key_dynpanel_on, true).toBool())
    {
        QList<int> panelSizes = editorSplitter->sizes();
        panelSizes.last() = 0;
        editorSplitter->setSizes(panelSizes);
    }

    if (settings.value(c_key_win_max, false).toBool())
        showMaximized();
    else
    {
        QRect winGeom = geometry();
        QRect setGeom = settings.value(c_key_win_size, QRect(winGeom.topLeft(), minimumSize())).value<QRect>();

        if (setGeom.width() >= winGeom.width() && setGeom.height() >= setGeom.height())
            setGeometry(setGeom);
    }

    //----------------------------------------------

    vsLog::instance()->enableHistory(false);
    onLog(QString("\t%1 %2 @ %3").arg(tr("Launching QTau")).arg(c_qtau_ver).arg(__DATE__), ELog::success);

    onLog("\t---------------------------------------------", ELog::info);
    vsLog::r(); // print stored messages from program startup
    onLog("\t---------------------------------------------", ELog::info);
    vsLog::n();
}
Пример #27
0
void GridButton::mousePressEventLeft(QMouseEvent *e)
{
     emit leftClicked();
}