예제 #1
0
MixerItem::MixerItem(QWidget *parent, int playerIndex, const Player &player,
                     const TuningDictionary &dictionary,
                     const PlayerEditPubSub &editPubSub,
                     const PlayerRemovePubSub &removePubSub)
    : QWidget(parent),
      ui(new Ui::MixerItem),
      myDictionary(dictionary),
      myEditPubSub(editPubSub),
      myRemovePubSub(removePubSub),
      myPlayerIndex(playerIndex),
      myTuning(player.getTuning())
{
    ui->setupUi(this);

    ui->playerIndexLabel->setText(QString("%1.").arg(playerIndex + 1));
    ui->playerNameLabel->setText(
        QString::fromStdString(player.getDescription()));
    ui->playerNameEdit->setText(ui->playerNameLabel->text());
    ui->playerVolume->setValue(player.getMaxVolume());
    ui->playerPan->setValue(player.getPan());
    ui->playerTuning->setText(QString::fromStdString(
                                  boost::lexical_cast<std::string>(player.getTuning())));

    ui->removeButton->setIcon(
        style()->standardIcon(QStyle::SP_TitleBarCloseButton));

    ui->playerNameEdit->hide();

    connect(ui->playerNameLabel, &ClickableLabel::clicked, ui->playerNameLabel,
            &QWidget::hide);
    connect(ui->playerNameLabel, &ClickableLabel::clicked, ui->playerNameEdit,
            &QWidget::show);
    connect(ui->playerNameLabel, &ClickableLabel::clicked, [=]() {
        ui->playerNameEdit->setFocus();
    });

    connect(ui->playerNameEdit, &QLineEdit::editingFinished, this,
            &MixerItem::onPlayerNameEdited);

    connect(ui->playerVolume, &QSlider::valueChanged, [=]() {
        onEdited(false);
    });
    connect(ui->playerPan, &QDial::valueChanged, [=]() {
        onEdited(false);
    });

    connect(ui->playerTuning, &ClickableLabel::clicked, this,
            &MixerItem::editTuning);

    connect(ui->removeButton, &QPushButton::clicked, [&]() {
        myRemovePubSub.publish(myPlayerIndex);
    });
}
예제 #2
0
LoginDialog::LoginDialog( const QString& username )
           : m_username( username )
           , m_subscriber( true )
{
    ui.setupUi( this );
    if (username.size())
    {
        ui.username->setText( username );
        ui.password->setFocus();
    }
	
#ifdef Q_WS_MAC
	ui.spacerItem->changeSize( 0, 0 );
	ui.spinner->hide();
	
	QVBoxLayout* v = new QVBoxLayout( ui.transient = new QDialog( this, Qt::Sheet ) );
	v->addWidget( ui.text = new QLabel( tr("Authenticating") ) );
	v->addWidget( ui.progress = new QProgressBar );
	v->addWidget( ui.cancel = new QPushButton( ' ' + tr("Cancel") + ' ' ) );
	v->setAlignment( ui.cancel, Qt::AlignRight );
	v->setSizeConstraint( QLayout::SetFixedSize );
	ui.text->setWordWrap( true );
	ui.cancel->setMinimumWidth( ui.cancel->sizeHint().width() );
	ui.transient->setModal( true );
	ui.progress->setRange( 0, 0 );
	ui.text->setFixedWidth( ui.text->sizeHint().width() * 2.5 );
    ui.urls->setAttribute( Qt::WA_MacSmallSize );
    
	connect( ui.cancel, SIGNAL(clicked()), ui.transient, SLOT(reject()) );
	connect( ui.transient, SIGNAL(rejected()), SLOT(cancel()) );

	//Qt is shit
	ui.buttonBox->layout()->setMargin( 0 );
	ui.buttonBox->setContentsMargins( 0, 0, -5, -7 );
	ui.buttonBox->layout()->setContentsMargins( 0, 0, 0, 0 );
	int left, top, right, bottom;
	layout()->getContentsMargins ( &left, &top, &right, &bottom );
	layout()->setContentsMargins( left, top, right, bottom - 10 );
	//Qt is shit
#else
    ui.spinner->hide();
#endif

	ok()->setText( tr("Log In") );
    ok()->setDisabled( true );

    connect( ui.buttonBox, SIGNAL(accepted()), SLOT(authenticate()) );
    connect( ui.buttonBox, SIGNAL(rejected()), SLOT(reject()) );
    connect( ui.username, SIGNAL(textEdited( QString )), SLOT(onEdited()) );
    connect( ui.password, SIGNAL(textEdited( QString )), SLOT(onEdited()) );
}
예제 #3
0
void MixerItem::onPlayerNameEdited()
{
    // Avoid sending another message when the editor becomes hidden.
    if (ui->playerNameEdit->isHidden())
        return;

    ui->playerNameLabel->setText(ui->playerNameEdit->text());
    ui->playerNameEdit->hide();
    ui->playerNameLabel->show();

    onEdited(true);
}
예제 #4
0
void MixerItem::editTuning()
{
    // We need to make sure that the TuningDialog is deleted before we call
    // onEdited, otherwise it will get deleted twice.
    std::unique_ptr<TuningDialog> dialog(
        new TuningDialog(this, myTuning, myDictionary));

    if (dialog->exec() == QDialog::Accepted)
    {
        myTuning = dialog->getTuning();
        dialog.reset();
        onEdited(true);
    }
}
예제 #5
0
StringListEditor::StringListEditor(const QString& title, QWidget* parent) : QGroupBox(title, parent) {
	// create layout
	_hLayout = new QVBoxLayout( this );
	_hLayout->setMargin(5);
	_hLayout->setSpacing(3);
	
	// create toolbar
	QToolBar* tb = new QToolBar;
	tb->layout()->setMargin(0);
	tb->layout()->setSpacing(0);
	tb->setIconSize(QSize(16, 16));
	_hLayout->addWidget(tb);
	
	// create listwidget
	_list = new QListWidget;
	_list->setMinimumHeight(40);
	_list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	_hLayout->addWidget(_list);
	
	// create actions
	QAction* addAction = new QAction( QIcon( ":/listeditor/add.png" ), tr("Add Item"), tb);
	QAction* removeAction = new QAction( QIcon( ":/listeditor/remove.png" ), tr("Remove Item"), tb);
	QAction* clearAction = new QAction( QIcon( ":/listeditor/clear.png" ), tr("Clear Items"), tb);
	QAction* upAction = new QAction( QIcon( ":/listeditor/up.png" ), tr("Move Item Up"), tb);
	QAction* downAction = new QAction( QIcon( ":/listeditor/down.png" ), tr("Move Item Down"), tb);
	QAction* editAction = new QAction( QIcon( ":/listeditor/edit.png" ), tr("Edit Item"), tb);
	
	// add actions to toolbar
	tb->addAction(addAction);
	tb->addAction(removeAction);
	tb->addAction(clearAction);
	tb->addAction(upAction);
	tb->addAction(downAction);
	tb->addAction(editAction);
	
	// connections
	connect(addAction, SIGNAL(triggered()), this, SLOT(onAddItem()));
	connect(removeAction, SIGNAL(triggered()), this, SLOT(onRemoveItem()));
	connect(clearAction, SIGNAL(triggered()), this, SLOT(onClearItem()));
	connect(upAction, SIGNAL(triggered()), this, SLOT(onMoveUpItem()));
	connect(downAction, SIGNAL(triggered()), this, SLOT(onMoveDownItem()));
	connect(editAction, SIGNAL(triggered()), this, SLOT(onEditItem()));
	connect(_list, SIGNAL(itemChanged(QListWidgetItem*)), this, SIGNAL(edited()));
	connect( this, SIGNAL(edited()), this, SLOT(onEdited()));
}
예제 #6
0
ToyGrid::ToyGrid(EnumToyType type, Client *pClient, QWidget *parent, Qt::WindowFlags flags)
	: Toy(type, pClient, parent, flags)
	, m_Mode(ToyWidget::MODE_DEFAULT)
	, m_GridSize(0, 0)
	, m_SendOnConnect(false)
	, m_IgnoreEdits(0)
	, m_pContextMenu(0)
	, m_Loading(false)
{
	m_EditPanel = new EditPanel(this);
	m_EditPanel->hide();
	connect(m_EditPanel, SIGNAL(edited()), this, SLOT(onEdited()));
	connect(m_EditPanel, SIGNAL(done()), this, SLOT(onDone()));
	
	QString name;
	Toy::GetName(m_Type, name);
	SetText(name);
	
	SetColor( palette().color(QPalette::Window) );
	UpdateImagePath();
}