示例#1
0
ControllerView::ControllerView( Controller * _model, QWidget * _parent ) :
	QFrame( _parent ),
	ModelView( _model, this ),
	m_subWindow( NULL ),
	m_controllerDlg( NULL ),
	m_show( true )
{
	this->setFrameStyle( QFrame::StyledPanel );
	this->setFrameShadow( QFrame::Raised );

	QVBoxLayout *vBoxLayout = new QVBoxLayout(this);

	QHBoxLayout *hBox = new QHBoxLayout();
	vBoxLayout->addLayout(hBox);

	QLabel *label = new QLabel( "<b>" + _model->displayName() + "</b>", this);
	QSizePolicy sizePolicy = label->sizePolicy();
	sizePolicy.setHorizontalStretch(1);
	label->setSizePolicy(sizePolicy);

	hBox->addWidget(label);

	QPushButton * controlsButton = new QPushButton( tr( "Controls" ), this );
	connect( controlsButton, SIGNAL( clicked() ), SLOT( editControls() ) );

	hBox->addWidget(controlsButton);

	m_nameLabel = new QLabel(_model->name(), this);
	vBoxLayout->addWidget(m_nameLabel);


	m_controllerDlg = getController()->createDialog( gui->mainWindow()->workspace() );

	m_subWindow = gui->mainWindow()->addWindowedWidget( m_controllerDlg );
	
	Qt::WindowFlags flags = m_subWindow->windowFlags();
	flags &= ~Qt::WindowMaximizeButtonHint;
	m_subWindow->setWindowFlags( flags );
	m_subWindow->setFixedSize( m_subWindow->size() );

	m_subWindow->setWindowIcon( m_controllerDlg->windowIcon() );

	connect( m_controllerDlg, SIGNAL( closed() ),
		this, SLOT( closeControls() ) );

	m_subWindow->hide();

	setWhatsThis( tr( "Controllers are able to automate the value of a knob, "
				"slider, and other controls."  ) );

	setModel( _model );
}
示例#2
0
RegWidget::RegWidget(const char *name, IGui *gui, QWidget *parent) 
    : QWidget(parent) {
    igui_ = gui;
    value_ = 0;

    name_ = QString(name);
    while (name_.size() < 3) {
        name_ += tr(" ");
    }

    std::string t1 = "reg " + std::string(name);
    cmdRead_.make_string(t1.c_str());

    QFont font = QFont("Courier");
    font.setStyleHint(QFont::Monospace);
    font.setPointSize(8);
    font.setFixedPitch(true);
    setFont(font);
    QFontMetrics fm(font);

    QHBoxLayout *pLayout = new QHBoxLayout;
    pLayout->setContentsMargins(4, 1, 4, 1);
    setLayout(pLayout);

    QLabel *label = new QLabel(this);
    QSizePolicy labelSizePolicy(QSizePolicy::Preferred, 
                                QSizePolicy::Preferred);
    labelSizePolicy.setHorizontalStretch(0);
    labelSizePolicy.setVerticalStretch(0);
    labelSizePolicy.setHeightForWidth(label->sizePolicy().hasHeightForWidth());
    label->setSizePolicy(labelSizePolicy);
    label->setText(name_);
    label->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
    pLayout->addWidget(label);

    edit_ = new QLineEdit(this);
    pLayout->addWidget(edit_);
    respValue_ = value_ = 0xfeedfaceull;

    char tstr[64];
    RISCV_sprintf(tstr, sizeof(tstr), "%016" RV_PRI64 "x", value_);
    QString text(tstr);
    edit_->setText(text);
    edit_->setMaxLength(19);
    edit_->setFixedWidth(fm.width(text) + 8);
    edit_->setFixedHeight(fm.height() + 2);

    setMinimumWidth(edit_->width() + fm.width(name_) + 16);
    setMinimumHeight(edit_->height());
}
示例#3
0
void OpenconnectAuthWidget::addFormInfo(const QString &iconName, const QString &message)
{
    Q_D(OpenconnectAuthWidget);
    QHBoxLayout *layout = new QHBoxLayout();
    QLabel *icon = new QLabel(this);
    QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    sizePolicy.setHeightForWidth(icon->sizePolicy().hasHeightForWidth());
    icon->setSizePolicy(sizePolicy);
    icon->setMinimumSize(QSize(16, 16));
    icon->setMaximumSize(QSize(16, 16));
    layout->addWidget(icon);

    QLabel *text = new QLabel(this);
    text->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
    text->setWordWrap(true);
    layout->addWidget(text);

    icon->setPixmap(QIcon::fromTheme(iconName).pixmap(KIconLoader::SizeSmall));
    text->setText(message);

    d->ui.loginBoxLayout->addLayout(layout);
}
示例#4
0
void MainWindow::createWidgets()
{
  setCentralWidget(new QWidget(this));
  QVBoxLayout* mainFormBaseLayout = new QVBoxLayout(centralWidget(), 1, 1);

  QSplitter* splitter = new QSplitter(centralWidget());
  splitter->setOrientation( Qt::Vertical  );
  mainFormBaseLayout->addWidget(splitter);

  m_tabEditor = new EditorTabWidget(splitter, this);
  splitter->setCollapsible(m_tabEditor, false);
  splitter->setOpaqueResize(true);

  QTabWidget* tabDebug = new QTabWidget(splitter);
  splitter->setCollapsible(tabDebug, false);
  tabDebug->setGeometry(0,0,0,height()/15);

  QWidget* globalVarTab = new QWidget(tabDebug);
  QVBoxLayout* globalVarTabLayout = new QVBoxLayout(globalVarTab, 1, 1);

  m_globaVarList = new VariablesListView(globalVarTab);
  globalVarTabLayout->addWidget(m_globaVarList);
  tabDebug->insertTab(globalVarTab, QString("Global"));

  QWidget* tabStack = new QWidget(tabDebug);
  QVBoxLayout* varTabLayout = new QVBoxLayout(tabStack, 1, 1);
  QHBoxLayout* stackComboLayout = new QHBoxLayout(0, 6, 6);

  QLabel* stackLabel = new QLabel(tabStack);
  stackLabel->setText(("Stack:"));
  stackLabel->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, stackLabel->sizePolicy().hasHeightForWidth()));
  stackComboLayout->addWidget(stackLabel);

  m_stackCombo = new DebuggerComboStack(tabStack);
  stackComboLayout->addWidget(m_stackCombo);
  varTabLayout->addLayout(stackComboLayout);

  m_localVarList= new VariablesListView(tabStack);
  varTabLayout->addWidget(m_localVarList);
  tabDebug->insertTab(tabStack, QString("Local"));

  QWidget* tabWatch = new QWidget(tabDebug);
  QVBoxLayout* watchTabLayout = new QVBoxLayout(tabWatch, 1, 1);

  QHBoxLayout* addWatchLayout = new QHBoxLayout(0, 6, 6);

  QLabel* addLabel = new QLabel(tabWatch);
  addLabel->setText(("Watch:"));
  addWatchLayout->addWidget(addLabel);

  m_edAddWatch = new KLineEdit(tabWatch);
  m_edAddWatch->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, m_edAddWatch->sizePolicy().hasHeightForWidth()));
  addWatchLayout->addWidget(m_edAddWatch);

  m_btAddWatch = new KPushButton(tabWatch);
  m_btAddWatch->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, m_btAddWatch->sizePolicy().hasHeightForWidth()));
  m_btAddWatch->setText(("Add"));
  addWatchLayout->addWidget(m_btAddWatch);

  QSpacerItem* spacer = new QSpacerItem(430, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
  addWatchLayout->addItem(spacer);
  watchTabLayout->addLayout(addWatchLayout);

  m_watchList = new WatchListView(tabWatch);
  watchTabLayout->addWidget(m_watchList);
  tabDebug->insertTab(tabWatch, QString("Watch"));

  QWidget* breakpointTab = new QWidget(tabDebug);
  QVBoxLayout* breakpointTabLayout = new QVBoxLayout(breakpointTab, 1, 1);

  m_breakpointList = new BreakpointListView(breakpointTab);
  breakpointTabLayout->addWidget(m_breakpointList);
  tabDebug->insertTab(breakpointTab, QString("Breakpoints"));

  QWidget* logTab = new QWidget(tabDebug);
  QVBoxLayout* logTabLayout = new QVBoxLayout(logTab, 1, 1);

  m_logListView = new LogListView(logTab);
  logTabLayout->addWidget(m_logListView);
  tabDebug->insertTab(logTab, QString("Messages"));

  QWidget* outputTab = new QWidget(tabDebug);
  QVBoxLayout* outputTabLayout = new QVBoxLayout(outputTab, 1, 1);

  m_edOutput = new KTextEdit(outputTab);
  outputTabLayout->addWidget(m_edOutput);
  m_edOutput->setReadOnly(true);
  m_edOutput->setTextFormat(Qt::PlainText);
  m_edOutput->setPaper( QBrush(QColor("white")));

  /*
  KTextEditor::Document* doc = KTextEditor::EditorChooser::createDocument(
      0L, "KTextEditor::Document");
  //doc->setReadWrite(false);
  m_edOutput = dynamic_cast<KTextEditor::EditInterface*>(doc);
  m_edOutput->setText("oioi");
  outputTabLayout->addWidget(doc->createView(outputTab));
  */

  tabDebug->insertTab(outputTab, QString("Output"));
}
/*!
 * Function create visual objects and connect slots.
 */
void
CatalogForm::init()
{

	ListView = new aListView(centralWidget(), "listView");
	ListView->setGeometry(30,30,400,300);
	ListView->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
	LineEdit = new aLineEdit(centralWidget(), "lineEdit");
	ListHint = new aListBox(centralWidget(), "listBox");
	StatusFrame = new Q3Frame(centralWidget(), "statusFrame");

	ListView->setRootIsDecorated( true );

	StatusFrame->setGeometry( QRect( 0, 0, 50,5 ) );
	StatusFrame->setFrameShape( Q3Frame::StyledPanel );
	StatusFrame->setFrameShadow( Q3Frame::Raised );
	StatusFrame->hide();

	GridLayout = new Q3GridLayout(centralWidget(), 1, 1, 11, 6, "GridLayout");
	GridLayout->addMultiCellWidget( ListView, 2,3, 0 , 0 );
	GridLayout->addWidget( LineEdit, 1, 0 );
	GridLayout->addWidget( bCancel, 3, 1 );
	QLabel *lb = new QLabel(tr("Search"),centralWidget());
	lb->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, lb->sizePolicy().hasHeightForWidth() ) );
	GridLayout->addWidget( lb ,0,0);
	QSpacerItem* spacer = new QSpacerItem( 20, 390, QSizePolicy::Minimum, QSizePolicy::Expanding );
	GridLayout->addMultiCell( spacer, 0,2,1, 1);

 	QPixmap  pix= rcIcon("cat.png");
	if(pix.isNull())
	{
		aLog::print(aLog::Info, tr("Catalog Form image cat.png not loaded"));
	}
	else
	{
		setIcon( pix );
	}
 	//setFocusPolicy();
  //  connect(this, 	SIGNAL	(destoyed()),
//	    this,	SLOT	(close());

    connect(ListView, 	SIGNAL	(newItemRequest(Q3ListViewItem*)),
	    this,	SLOT	(new_item(Q3ListViewItem*)));

    connect(ListView, 	SIGNAL	(newGroupRequest(Q3ListViewItem*)),
	    this, 	SLOT	(new_group(Q3ListViewItem*)));

    connect(ListView, 	SIGNAL	(delItemRequest(Q3ListViewItem*)),
	    this, 	SLOT	(del_item(Q3ListViewItem*)));

    connect(ListView, 	SIGNAL	(markDeletedRequest(Q3ListViewItem*)),
	    this, 	SLOT	(mark_deleted(Q3ListViewItem*)));

    connect(ListView, 	SIGNAL	(undoMarkDeletedRequest(Q3ListViewItem*)),
	    this, 	SLOT	(undo_mark_deleted(Q3ListViewItem*)));

    connect(ListView, 	SIGNAL	(editRequest(Q3ListViewItem*, int)),
	    this, 	SLOT	(edit(Q3ListViewItem*, int)));

    connect(ListView, 	SIGNAL	(selectRequest(Q3ListViewItem*)),
	    this, 	SLOT	(select(Q3ListViewItem*)));

    connect(LineEdit, 	SIGNAL	(delayTextChanged(const QString&)),
	    this, 	SLOT	(find(const QString&)));

    connect(LineEdit, 	SIGNAL	(keyArrowPressed()),
	    this, 	SLOT	(pressArrow()));

    connect(LineEdit, 	SIGNAL	(keyEnterPressed()),
	    this, 	SLOT	(go()));

    connect(ListView,	SIGNAL	(expanded ( Q3ListViewItem *)),
	    this,	SLOT	(onLoadElements( Q3ListViewItem *)));

    connect(ListHint, 	SIGNAL	(lostFocus()),
	    LineEdit, 	SLOT	(setFocus()));

    connect(ListHint, 	SIGNAL	(lostFocus()),
	   StatusFrame,	SLOT	(hide()));

    connect(ListHint, 	SIGNAL	(lostFocus()),
     ListHint,  SLOT (hide()));

    connect(ListHint,  SIGNAL (keyArrowLRPressed()),
     LineEdit,  SLOT (setFocus()));

    connect(ListHint,  SIGNAL (keyArrowLRPressed(const QString&)),
     this,  SLOT (setText(const QString&)));

    connect(ListHint,  SIGNAL (keyEnterPressed()),
     this,  SLOT (go()));

    connect(ListHint,  SIGNAL (sendMessage(const QString &)),
     this->statusBar(),  SLOT (message( const QString &)));

    connect(ListView,  SIGNAL (sendMessage(const QString &)),
     this->statusBar(),  SLOT (message( const QString &)));

    connect(LineEdit,  SIGNAL (sendMessage(const QString &)),
     this->statusBar(),  SLOT (message( const QString &)));

    LineEdit->setFocus();
}
/**
 * Constructor of the class
 * @param parent
 * @param name
 * @return
 */
NMGModuleToolBoxItem::NMGModuleToolBoxItem( QWidget *parent, QString modName, const QColor & backgroundColor )
		: QWidget( parent )
{
	setObjectName( modName );
	setMouseTracking( true );

	QPalette palette;
	palette.setColor( backgroundRole(), backgroundColor );
	setPalette( palette );

	moduleName = modName;

	QVBoxLayout * layoutVertical = new QVBoxLayout( this );
	layoutVertical->setMargin( 0 );
	layoutVertical->setSpacing( 0 );
	layoutVertical->setObjectName( moduleName + "LayoutVertical" );

	QHBoxLayout * layoutHoritzontal = new QHBoxLayout( 0 );
	layoutHoritzontal->setMargin( 0 );
	layoutHoritzontal->setSpacing( 0 );
	layoutHoritzontal->setObjectName( moduleName + "LayoutHoritzontal" );

	QSpacerItem * leftSpacer = new QSpacerItem( 1, 21, QSizePolicy::Maximum, QSizePolicy::Minimum );
	layoutHoritzontal->addItem( leftSpacer );

	QString toolTip = (( NMGModuleParent * ) NMGModuleManager::self()->getModule( moduleName ) )->getModuleToolTip().c_str();

	QLabel * pixmapLabel1 = new QLabel( this );
	pixmapLabel1->setMaximumSize( QSize( 64, 64 ) );
	pixmapLabel1->setAlignment( Qt::AlignHCenter );
	pixmapLabel1->setObjectName( moduleName + "Label" );

	if ( !toolTip.isEmpty() )
	{
		pixmapLabel1->setToolTip( toolTip );
		pixmapLabel1->setWhatsThis( toolTip );
	}

	QString iconFile = (( NMGModuleParent * ) NMGModuleManager::self()->getModule( moduleName ) )->getModuleIcon().c_str();
	if ( iconFile.isEmpty() ) iconFile = DEFAULT_ICON_NAME;
	pixmapLabel1->setPixmap( * ( NMGImageManager::loadPixmap( iconFile ) ) );
	pixmapLabel1->setScaledContents( TRUE );
	layoutHoritzontal->addWidget( pixmapLabel1 );
	pixmapLabel1->setMouseTracking( true );

	QSpacerItem * rightSpacer = new QSpacerItem( 1, 21, QSizePolicy::Maximum, QSizePolicy::Minimum );
	layoutHoritzontal->addItem( rightSpacer );
	layoutVertical->addLayout( layoutHoritzontal );


	QLabel * txtModuleLabel = new QLabel( "<p align=\"center\">" + moduleName + "</p>", this );
	txtModuleLabel->setObjectName( moduleName + "Label" );
	if ( !toolTip.isEmpty() )
	{
		txtModuleLabel->setToolTip( toolTip );
		txtModuleLabel->setWhatsThis( toolTip );
	}

	QSizePolicy policy1( QSizePolicy::Preferred, QSizePolicy::Preferred );
	policy1.setHorizontalStretch( 0 );
	policy1.setVerticalStretch( 0 );
	policy1.setHeightForWidth( txtModuleLabel->sizePolicy().hasHeightForWidth() );
	txtModuleLabel->setSizePolicy( policy1 );

	/** Size of the label for the plugin's name at toolbar **/
	txtModuleLabel->adjustSize(); //setMaximumSize( QSize( 100, 150 ) );
	QPalette palettelabel;
	palettelabel.setColor( txtModuleLabel->backgroundRole(), backgroundColor );
	txtModuleLabel->setPalette( palettelabel );
	txtModuleLabel->setAlignment( Qt::AlignVCenter ); //how to 'or' with Qt::TextWordWrap ??
	layoutVertical->addWidget( txtModuleLabel );
}
示例#7
0
    void setupUi(QWidget *MainWindow)
    {
        MainWindow->resize(642, 850);
        QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
        sizePolicy.setHorizontalStretch(0);
        sizePolicy.setVerticalStretch(0);
        sizePolicy.setHeightForWidth(MainWindow->sizePolicy().hasHeightForWidth());
        MainWindow->setSizePolicy(sizePolicy);
        MainWindow->setStyleSheet(QString::fromUtf8("\n"
"SandboxGui--TaskPanelView {\n"
"	background-color: green;\n"
"}\n"
""));
        verticalLayout = new QVBoxLayout(MainWindow);
        verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
        verticalLayout_3 = new QVBoxLayout();
        verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3"));
        label = new QLabel(MainWindow);
        label->setObjectName(QString::fromUtf8("label"));
        QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Maximum);
        sizePolicy1.setHorizontalStretch(0);
        sizePolicy1.setVerticalStretch(0);
        sizePolicy1.setHeightForWidth(label->sizePolicy().hasHeightForWidth());
        label->setSizePolicy(sizePolicy1);

        verticalLayout_3->addWidget(label);

        line_2 = new QFrame(MainWindow);
        line_2->setObjectName(QString::fromUtf8("line_2"));
        line_2->setFrameShape(QFrame::HLine);
        line_2->setFrameShadow(QFrame::Sunken);

        verticalLayout_3->addWidget(line_2);


        verticalLayout->addLayout(verticalLayout_3);

        gridLayout_2 = new QGridLayout();
        gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2"));
        ActionBox1 = new QSint::ActionBox(MainWindow);
        ActionBox1->setObjectName(QString::fromUtf8("ActionBox1"));
        ActionBox1->setFrameShape(QFrame::StyledPanel);
        ActionBox1->setFrameShadow(QFrame::Raised);

        gridLayout_2->addWidget(ActionBox1, 0, 0, 1, 1);

        ActionBox2 = new QSint::ActionBox(MainWindow);
        ActionBox2->setObjectName(QString::fromUtf8("ActionBox2"));
        ActionBox2->setFrameShape(QFrame::StyledPanel);
        ActionBox2->setFrameShadow(QFrame::Raised);

        gridLayout_2->addWidget(ActionBox2, 1, 0, 1, 1);

        verticalSpacer = new QSpacerItem(94, 28, QSizePolicy::Minimum, QSizePolicy::Minimum);

        gridLayout_2->addItem(verticalSpacer, 3, 0, 1, 1);

        ActionBox3 = new QSint::ActionBox(MainWindow);
        ActionBox3->setObjectName(QString::fromUtf8("ActionBox3"));
        ActionBox3->setFrameShape(QFrame::StyledPanel);
        ActionBox3->setFrameShadow(QFrame::Raised);

        gridLayout_2->addWidget(ActionBox3, 0, 1, 1, 1);

        ActionBox4 = new QSint::ActionBox(MainWindow);
        ActionBox4->setObjectName(QString::fromUtf8("ActionBox4"));
        ActionBox4->setFrameShape(QFrame::StyledPanel);
        ActionBox4->setFrameShadow(QFrame::Raised);

        gridLayout_2->addWidget(ActionBox4, 1, 1, 1, 1);

        ActionBox5 = new Gui::TaskView::TaskGroup(MainWindow);
        ActionBox5->setObjectName(QString::fromUtf8("ActionBox5"));
        ActionBox5->setFrameShape(QFrame::StyledPanel);
        ActionBox5->setFrameShadow(QFrame::Raised);

        gridLayout_2->addWidget(ActionBox5, 2, 1, 1, 1);

        verticalLayout->addLayout(gridLayout_2);

        verticalLayout_4 = new QVBoxLayout();
        verticalLayout_4->setObjectName(QString::fromUtf8("verticalLayout_4"));
        label_2 = new QLabel(MainWindow);
        label_2->setObjectName(QString::fromUtf8("label_2"));
        sizePolicy1.setHeightForWidth(label_2->sizePolicy().hasHeightForWidth());
        label_2->setSizePolicy(sizePolicy1);

        verticalLayout_4->addWidget(label_2);

        line = new QFrame(MainWindow);
        line->setObjectName(QString::fromUtf8("line"));
        line->setFrameShape(QFrame::HLine);
        line->setFrameShadow(QFrame::Sunken);

        verticalLayout_4->addWidget(line);


        verticalLayout->addLayout(verticalLayout_4);

        verticalLayout_2 = new QVBoxLayout();
        verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2"));
        ActionLabel1 = new QSint::ActionLabel(MainWindow);
        ActionLabel1->setObjectName(QString::fromUtf8("ActionLabel1"));
        QSizePolicy sizePolicy2(QSizePolicy::Preferred, QSizePolicy::Fixed);
        sizePolicy2.setHorizontalStretch(0);
        sizePolicy2.setVerticalStretch(0);
        sizePolicy2.setHeightForWidth(ActionLabel1->sizePolicy().hasHeightForWidth());
        ActionLabel1->setSizePolicy(sizePolicy2);

        verticalLayout_2->addWidget(ActionLabel1);

        ActionLabel2 = new QSint::ActionLabel(MainWindow);
        ActionLabel2->setObjectName(QString::fromUtf8("ActionLabel2"));
        sizePolicy2.setHeightForWidth(ActionLabel2->sizePolicy().hasHeightForWidth());
        ActionLabel2->setSizePolicy(sizePolicy2);
        QIcon icon;
        icon.addFile(QString::fromUtf8(":/icons/document-open.svg"), QSize(), QIcon::Normal, QIcon::Off);
        ActionLabel2->setIcon(icon);

        verticalLayout_2->addWidget(ActionLabel2);

        ActionLabel3 = new QSint::ActionLabel(MainWindow);
        ActionLabel3->setObjectName(QString::fromUtf8("ActionLabel3"));
        sizePolicy2.setHeightForWidth(ActionLabel3->sizePolicy().hasHeightForWidth());
        ActionLabel3->setSizePolicy(sizePolicy2);
        QIcon icon1;
        icon1.addFile(QString::fromUtf8(":/icons/document-print.svg"), QSize(), QIcon::Normal, QIcon::Off);
        ActionLabel3->setIcon(icon1);

        verticalLayout_2->addWidget(ActionLabel3);


        verticalLayout->addLayout(verticalLayout_2);


        retranslateUi(MainWindow);
    } // setupUi
示例#8
0
void coEditorTextValueWidget::setValue(const QString &valueName, const QString &value,
                                       const QString &readableAttrRule,
                                       const QString &attributeDescription,
                                       bool, const QRegExp &rx)
{
    fvariable = valueName;
    fvalue = value;

    QHBoxLayout *layout;
    QLabel *valueLabel;
    QSpacerItem *spacerItem;

    setObjectName(widgetName);
    setMaximumSize(QSize(16777215, 100));
    setBaseSize(QSize(400, 25));
    setToolTip(attributeDescription);

    layout = new QHBoxLayout(this);
    layout->setSpacing(0);
    layout->setMargin(0);
    layout->setObjectName(QString::fromUtf8("layout"));
    valueLabel = new QLabel(this);
    valueLabel->setText(valueName);
    valueLabel->setObjectName(QString::fromUtf8("valueLabel"));
    valueLabel->setBaseSize(QSize(150, 22));

    QSizePolicy labelSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    labelSizePolicy.setHorizontalStretch(1);
    labelSizePolicy.setVerticalStretch(0);
    labelSizePolicy.setHeightForWidth(valueLabel->sizePolicy().hasHeightForWidth());
    valueLabel->setSizePolicy(labelSizePolicy);

    spacerItem = new QSpacerItem(30, 20, QSizePolicy::Preferred, QSizePolicy::Minimum);

    valueLineEdit = new coEditorValidatedQLineEdit(this);
    valueLineEdit->setObjectName(valueName);
    valueLineEdit->setStatusTip(readableAttrRule);
    QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(3), static_cast<QSizePolicy::Policy>(0));
    sizePolicy.setHorizontalStretch(2);
    sizePolicy.setVerticalStretch(0);
    sizePolicy.setHeightForWidth(valueLineEdit->sizePolicy().hasHeightForWidth());
    valueLineEdit->setSizePolicy(sizePolicy);
    valueLineEdit->setMaximumSize(QSize(16777215, 22));
    valueLineEdit->setBaseSize(QSize(200, 22));
    valueLineEdit->setAlignment(Qt::AlignRight);
    valueLineEdit->setDragEnabled(true);

    if (!rx.isEmpty())
    {
        QValidator *validator = new QRegExpValidator(rx, this);
        valueLineEdit->setValidator(validator);
    }
    // returnPressed is only send, if expression is valid. then we need to call coConfigEntry->setValue
    // connect(valueLineEdit, SIGNAL(returnPressed()), this, SLOT(commitNewEntryValueData()));
    valueLineEdit->setText(value); //setText does not call validate
    valueLineEdit->setModified(false);

    //create Contextmenu - Delete value
    deleteValueAction = new QAction(tr("Delete this Value ?"), valueLabel);
    deleteValueAction->setStatusTip(tr("Delete this value ?"));
    addAction(deleteValueAction);
    setContextMenuPolicy(Qt::ActionsContextMenu);

    if (getType() == coEditorValueWidget::Info || getType() == coEditorValueWidget::InfoName
                                                  /*value.isEmpty() &&*/ /*&& !required*/)
    {
        defaultValue = value;
        //
        valueLineEdit->setStyleSheet("background-color: aliceblue");
        connect(deleteValueAction, SIGNAL(triggered()), this, SLOT(explainShowInfoButton()));
    }
    else
    {
        //is valid checks, and sets background color to red if check fails
        /* if (!empty)*/
        valueLineEdit->isValid();
        connect(deleteValueAction, SIGNAL(triggered()), this, SLOT(suicide()));
    }

    valueLineEdit->adjustSize();

    QSize size(250, 45);
    size = size.expandedTo(minimumSizeHint());
    resize(size);

    //connect to save
    connect(valueLineEdit, SIGNAL(editingFinished()), this, SLOT(save()));
    //    connect ( valueLineEdit, SIGNAL (returnPressed() ), this, SLOT (save() ) );
    //NOTE if we want a nasty nagscreen, connect it here
    //connect ( valueLineEdit, SIGNAL (notValid() ),  , SLOT ( ) );
    connect(valueLineEdit, SIGNAL(notValid()), this, SIGNAL(notValid()));

    layout->addWidget(valueLabel);
    layout->addItem(spacerItem);
    layout->addWidget(valueLineEdit);

    setLayout(layout);
}
BackstageOSF::BackstageOSF(QWidget *parent) : BackstagePage(parent)
{
	QGridLayout *layout = new QGridLayout(this);
	layout->setSpacing(0);
	layout->setContentsMargins(0, 0, 0, 0);
	setLayout(layout);

	QWidget *topRow = new QWidget(this);
	layout->addWidget(topRow);

	QGridLayout *topRowLayout = new QGridLayout();
	topRowLayout->setContentsMargins(0, 6, 12, 0);
	topRow->setLayout(topRowLayout);

	QLabel *label = new QLabel("Open Science Framework", topRow);
	QSizePolicy sp = label->sizePolicy();
	sp.setHorizontalStretch(1);
	label->setSizePolicy(sp);
	label->setContentsMargins(12, 12, 12, 1);
	topRowLayout->addWidget(label, 0, 0);

	_nameButton = new QToolButton(topRow);
	_nameButton->hide();
	topRowLayout->addWidget(_nameButton, 0, 1);

	connect(_nameButton, SIGNAL(clicked(bool)), this, SLOT(nameClicked()));

	QWidget *buttonsWidget = new QWidget(this);
	buttonsWidget->setContentsMargins(0, 0, 0, 0);
	layout->addWidget(buttonsWidget);

	QGridLayout *buttonsWidgetLayout = new QGridLayout(buttonsWidget);
	buttonsWidgetLayout->setContentsMargins(0, 0, 12, 0);
	buttonsWidget->setLayout(buttonsWidgetLayout);

	_breadCrumbs = new BreadCrumbs(buttonsWidget);
	buttonsWidgetLayout->addWidget(_breadCrumbs, 0, 0);

	_newFolderButton = new QToolButton(buttonsWidget);
	_newFolderButton->setText("New Folder");
	_newFolderButton->hide();
	buttonsWidgetLayout->addWidget(_newFolderButton, 0, 2);

	_fileNameContainer = new QWidget(this);
	_fileNameContainer->hide();
	_fileNameContainer->setObjectName("browseContainer");
	layout->addWidget(_fileNameContainer);

	QHBoxLayout *saveLayout = new QHBoxLayout(_fileNameContainer);
	_fileNameContainer->setLayout(saveLayout);

	_fileNameTextBox = new QLineEdit(_fileNameContainer);
	QSizePolicy policy = _fileNameTextBox->sizePolicy();
	policy.setHorizontalStretch(1);
	_fileNameTextBox->setSizePolicy(policy);
	_fileNameTextBox->setEnabled(false);

	saveLayout->addWidget(_fileNameTextBox);

	_saveButton = new QPushButton(_fileNameContainer);
	_saveButton->setText("Save");
	_saveButton->setEnabled(false);
	saveLayout->addWidget(_saveButton, 0, Qt::AlignRight);

	QWidget *line;

	line = new QWidget(this);
	line->setFixedHeight(1);
	line->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	line->setStyleSheet("QWidget { background-color: #A3A4A5 ; }");
	layout->addWidget(line);

	_model = new FSBMOSF();

	connect(_model, SIGNAL(authenticationSuccess()), this, SLOT(updateUserDetails()));
	connect(_model, SIGNAL(authenticationClear()), this, SLOT(updateUserDetails()));

	_fsBrowser = new FSBrowser(this);
	_fsBrowser->setViewType(FSBrowser::ListView);
	_fsBrowser->setFSModel(_model);
	layout->addWidget(_fsBrowser);

	_breadCrumbs->setModel(_model);
	_breadCrumbs->setEnabled(false);

	connect(_fsBrowser, SIGNAL(entryOpened(QString)), this, SLOT(notifyDataSetOpened(QString)));
	connect(_fsBrowser, SIGNAL(entrySelected(QString)), this, SLOT(notifyDataSetSelected(QString)));

	connect(_saveButton, SIGNAL(clicked()), this, SLOT(saveClicked()));
	connect(_newFolderButton, SIGNAL(clicked(bool)), this, SLOT(newFolderClicked()));

	line = new QWidget(this);
	line->setFixedWidth(1);
	line->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
	line->setStyleSheet("QWidget { background-color: #A3A4A5 ; }");
	layout->addWidget(line, 0, 1, 6, 1);

	QWidget *about = new QWidget(this);
	about->setObjectName("aboutOSF");
	about->setStyleSheet("#aboutOSF { border-top: 1px solid #A3A4A5 ; }");
	layout->addWidget(about);

	QHBoxLayout *aboutLayout = new QHBoxLayout(about);
	aboutLayout->setSpacing(12);
	about->setLayout(aboutLayout);

	HyperlinkLabel *aboutOSF = new HyperlinkLabel(about);
	aboutOSF->setText("<a href='https://osf.io/getting-started/'>About the OSF</a>");

	HyperlinkLabel *registerOSF = new HyperlinkLabel(about);
	registerOSF->setText("<a href='https://osf.io/'>Register</a>");

	aboutLayout->addWidget(aboutOSF);
	aboutLayout->addWidget(registerOSF);
	aboutLayout->addStretch(1);
}
示例#10
0
    void setupUi(QMainWindow *Detection)
    {
        if (Detection->objectName().isEmpty())
            Detection->setObjectName(QString::fromUtf8("Detection"));
        Detection->resize(729, 480);
        actionE_xit = new QAction(Detection);
        actionE_xit->setObjectName(QString::fromUtf8("actionE_xit"));
        action_Load_Map = new QAction(Detection);
        action_Load_Map->setObjectName(QString::fromUtf8("action_Load_Map"));
        action_Connect = new QAction(Detection);
        action_Connect->setObjectName(QString::fromUtf8("action_Connect"));
        action_Disconnect = new QAction(Detection);
        action_Disconnect->setObjectName(QString::fromUtf8("action_Disconnect"));
        centralWidget = new QWidget(Detection);
        centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
        gridLayoutWidget = new QWidget(centralWidget);
        gridLayoutWidget->setObjectName(QString::fromUtf8("gridLayoutWidget"));
        gridLayoutWidget->setGeometry(QRect(0, 0, 721, 421));
        gridLayout = new QGridLayout(gridLayoutWidget);
        gridLayout->setSpacing(6);
        gridLayout->setContentsMargins(11, 11, 11, 11);
        gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
        gridLayout->setSizeConstraint(QLayout::SetNoConstraint);
        gridLayout->setVerticalSpacing(5);
        gridLayout->setContentsMargins(0, 0, 0, 0);
        ugvFeedLabel = new QLabel(gridLayoutWidget);
        ugvFeedLabel->setObjectName(QString::fromUtf8("ugvFeedLabel"));
        QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        sizePolicy.setHorizontalStretch(0);
        sizePolicy.setVerticalStretch(0);
        sizePolicy.setHeightForWidth(ugvFeedLabel->sizePolicy().hasHeightForWidth());
        ugvFeedLabel->setSizePolicy(sizePolicy);

        gridLayout->addWidget(ugvFeedLabel, 1, 2, 1, 1);

        connectionButton = new QCommandLinkButton(gridLayoutWidget);
        connectionButton->setObjectName(QString::fromUtf8("connectionButton"));

        gridLayout->addWidget(connectionButton, 0, 2, 1, 1);

        uavFeedLabel = new QLabel(gridLayoutWidget);
        uavFeedLabel->setObjectName(QString::fromUtf8("uavFeedLabel"));
        sizePolicy.setHeightForWidth(uavFeedLabel->sizePolicy().hasHeightForWidth());
        uavFeedLabel->setSizePolicy(sizePolicy);
        uavFeedLabel->setMaximumSize(QSize(16777215, 16777215));

        gridLayout->addWidget(uavFeedLabel, 1, 0, 1, 1);

        ugvMapLabel = new QLabel(gridLayoutWidget);
        ugvMapLabel->setObjectName(QString::fromUtf8("ugvMapLabel"));
        QSizePolicy sizePolicy1(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
        sizePolicy1.setHorizontalStretch(0);
        sizePolicy1.setVerticalStretch(0);
        sizePolicy1.setHeightForWidth(ugvMapLabel->sizePolicy().hasHeightForWidth());
        ugvMapLabel->setSizePolicy(sizePolicy1);

        gridLayout->addWidget(ugvMapLabel, 1, 3, 1, 1);

        horizontalLayout_4 = new QHBoxLayout();
        horizontalLayout_4->setSpacing(6);
        horizontalLayout_4->setObjectName(QString::fromUtf8("horizontalLayout_4"));
        label_2 = new QLabel(gridLayoutWidget);
        label_2->setObjectName(QString::fromUtf8("label_2"));

        horizontalLayout_4->addWidget(label_2);

        uavTakeoffLandButton = new QPushButton(gridLayoutWidget);
        uavTakeoffLandButton->setObjectName(QString::fromUtf8("uavTakeoffLandButton"));

        horizontalLayout_4->addWidget(uavTakeoffLandButton);


        gridLayout->addLayout(horizontalLayout_4, 2, 0, 1, 1);

        horizontalLayout_2 = new QHBoxLayout();
        horizontalLayout_2->setSpacing(6);
        horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
        label = new QLabel(gridLayoutWidget);
        label->setObjectName(QString::fromUtf8("label"));

        horizontalLayout_2->addWidget(label);

        ugvSpeedLCD = new QLCDNumber(gridLayoutWidget);
        ugvSpeedLCD->setObjectName(QString::fromUtf8("ugvSpeedLCD"));
        ugvSpeedLCD->setFrameShape(QFrame::Box);

        horizontalLayout_2->addWidget(ugvSpeedLCD);


        gridLayout->addLayout(horizontalLayout_2, 4, 2, 1, 1);

        horizontalLayout_6 = new QHBoxLayout();
        horizontalLayout_6->setSpacing(6);
        horizontalLayout_6->setObjectName(QString::fromUtf8("horizontalLayout_6"));
        label_3 = new QLabel(gridLayoutWidget);
        label_3->setObjectName(QString::fromUtf8("label_3"));

        horizontalLayout_6->addWidget(label_3);

        ugvSpeakerButton = new QPushButton(gridLayoutWidget);
        ugvSpeakerButton->setObjectName(QString::fromUtf8("ugvSpeakerButton"));

        horizontalLayout_6->addWidget(ugvSpeakerButton);


        gridLayout->addLayout(horizontalLayout_6, 2, 2, 1, 1);

        verticalLayout = new QVBoxLayout();
        verticalLayout->setSpacing(6);
        verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
        label_4 = new QLabel(gridLayoutWidget);
        label_4->setObjectName(QString::fromUtf8("label_4"));
        label_4->setAlignment(Qt::AlignCenter);

        verticalLayout->addWidget(label_4);

        sauverStatus = new QTextBrowser(gridLayoutWidget);
        sauverStatus->setObjectName(QString::fromUtf8("sauverStatus"));
        sauverStatus->setEnabled(true);
        QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Minimum);
        sizePolicy2.setHorizontalStretch(0);
        sizePolicy2.setVerticalStretch(0);
        sizePolicy2.setHeightForWidth(sauverStatus->sizePolicy().hasHeightForWidth());
        sauverStatus->setSizePolicy(sizePolicy2);
        sauverStatus->setMaximumSize(QSize(777215, 215));

        verticalLayout->addWidget(sauverStatus);


        gridLayout->addLayout(verticalLayout, 4, 3, 1, 1);

        label_5 = new QLabel(gridLayoutWidget);
        label_5->setObjectName(QString::fromUtf8("label_5"));

        gridLayout->addWidget(label_5, 0, 0, 1, 1);

        Detection->setCentralWidget(centralWidget);
        menuBar = new QMenuBar(Detection);
        menuBar->setObjectName(QString::fromUtf8("menuBar"));
        menuBar->setGeometry(QRect(0, 0, 729, 23));
        menuFile = new QMenu(menuBar);
        menuFile->setObjectName(QString::fromUtf8("menuFile"));
        menu_Tools = new QMenu(menuBar);
        menu_Tools->setObjectName(QString::fromUtf8("menu_Tools"));
        menu_Help = new QMenu(menuBar);
        menu_Help->setObjectName(QString::fromUtf8("menu_Help"));
        Detection->setMenuBar(menuBar);
        mainToolBar = new QToolBar(Detection);
        mainToolBar->setObjectName(QString::fromUtf8("mainToolBar"));
        Detection->addToolBar(Qt::TopToolBarArea, mainToolBar);
        statusBar = new QStatusBar(Detection);
        statusBar->setObjectName(QString::fromUtf8("statusBar"));
        Detection->setStatusBar(statusBar);

        menuBar->addAction(menuFile->menuAction());
        menuBar->addAction(menu_Tools->menuAction());
        menuBar->addAction(menu_Help->menuAction());
        menuFile->addAction(action_Load_Map);
        menuFile->addAction(action_Disconnect);
        menuFile->addAction(actionE_xit);
        menu_Tools->addAction(action_Connect);

        retranslateUi(Detection);
        QObject::connect(actionE_xit, SIGNAL(activated()), Detection, SLOT(close()));
        QObject::connect(action_Connect, SIGNAL(activated()), connectionButton, SLOT(click()));

        QMetaObject::connectSlotsByName(Detection);
    } // setupUi
示例#11
0
FSBrowser::FSBrowser(QWidget *parent, FSBrowser::BrowseMode mode) : QWidget(parent)
{
	QLabel *label = NULL;

	_browseMode = mode;
	_viewType = FSBrowser::IconView;

	QGridLayout *layout = new QGridLayout(this);
	layout->setContentsMargins(12, 12, 0, 0);  //Position all file and folder elements asn recent file label
	setLayout(layout);
		
	switch(mode)
		
	{		
	case FSBrowser::BrowseRecentFiles:
		label = new QLabel("Recent Files");
		break;
		
	case FSBrowser::BrowseExamples:
		label = new QLabel("Examples");		
		break;
		
	case FSBrowser::BrowseCurrent:
		layout->addWidget(new QLabel(QString("Double-click on the file below to synchronize or use ") + getShortCutKey() + "-Y"));
		break;
		
	default:
		break;		
	}
	
	if (label)
	{
		QFont f= QFont("SansSerif");
		f.setPointSize(18);
		label->setFont(f);
		QSizePolicy sp = label->sizePolicy();
		sp.setHorizontalStretch(1);
		label->setSizePolicy(sp);
		label->setContentsMargins(0, 0, 0, 0);
		layout->addWidget(label);
	}
	
	_scrollArea = new VerticalScrollArea(this);
	_scrollArea->setFrameShape(QScrollArea::NoFrame);
	layout->addWidget(_scrollArea);

	_scrollPane = new QWidget;
	_scrollArea->setWidget(_scrollPane);

	_scrollPaneLayout = new QVBoxLayout(_scrollPane);
	_scrollPaneLayout->setSpacing(1);
	_scrollPaneLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
	_scrollPane->setLayout(_scrollPaneLayout);

	_buttonGroup = new QButtonGroup(this);

	_authWidget = new AuthWidget(this);
	_authWidget->hide();

	_processLabel = new QLabel(this);
	_processLabel->setAlignment(Qt::AlignCenter);
	_processLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
	_processLabel->setMovie(new QMovie(":/icons/loading.gif", QByteArray(), _processLabel));
	_processLabel->setHidden(true);
	layout->addWidget(_processLabel);

	connect(_authWidget, SIGNAL(loginRequested(QString,QString)), this, SLOT(loginRequested(QString,QString)));
}
    void setupUi(QDialog *MVPPlayerRemoteDialog)
    {
        if (MVPPlayerRemoteDialog->objectName().isEmpty())
            MVPPlayerRemoteDialog->setObjectName(QStringLiteral("MVPPlayerRemoteDialog"));
        MVPPlayerRemoteDialog->resize(380, 396);
        MVPPlayerRemoteDialog->setAcceptDrops(true);
        verticalLayout_4 = new QVBoxLayout(MVPPlayerRemoteDialog);
        verticalLayout_4->setObjectName(QStringLiteral("verticalLayout_4"));
        verticalLayout_2 = new QVBoxLayout();
#ifndef Q_OS_MAC
        verticalLayout_2->setSpacing(-1);
#endif
        verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2"));
        verticalLayout_2->setContentsMargins(-1, 0, 0, -1);
        verticalLayout_3 = new QVBoxLayout();
        verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3"));
        verticalLayout_3->setSizeConstraint(QLayout::SetMinimumSize);
        horizontalLayout_4 = new QHBoxLayout();
        horizontalLayout_4->setObjectName(QStringLiteral("horizontalLayout_4"));
        horizontalLayout_4->setSizeConstraint(QLayout::SetMinimumSize);
        sliderVolume = new QSlider(MVPPlayerRemoteDialog);
        sliderVolume->setObjectName(QStringLiteral("sliderVolume"));
        QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
        sizePolicy.setHorizontalStretch(0);
        sizePolicy.setVerticalStretch(0);
        sizePolicy.setHeightForWidth(sliderVolume->sizePolicy().hasHeightForWidth());
        sliderVolume->setSizePolicy(sizePolicy);
        sliderVolume->setMinimumSize(QSize(0, 0));
        sliderVolume->setMaximum(100);
        sliderVolume->setValue(100);
        sliderVolume->setOrientation(Qt::Horizontal);

        horizontalLayout_4->addWidget(sliderVolume);

        lblVol = new QLabel(MVPPlayerRemoteDialog);
        lblVol->setObjectName(QStringLiteral("lblVol"));
        QSizePolicy sizePolicy1(QSizePolicy::Maximum, QSizePolicy::Preferred);
        sizePolicy1.setHorizontalStretch(0);
        sizePolicy1.setVerticalStretch(0);
        sizePolicy1.setHeightForWidth(lblVol->sizePolicy().hasHeightForWidth());
        lblVol->setSizePolicy(sizePolicy1);
        lblVol->setPixmap(QPixmap(QString::fromUtf8(":/mvpplayer/app/icon.png")));
        lblVol->setAlignment(Qt::AlignCenter);

        horizontalLayout_4->addWidget(lblVol);


        verticalLayout_3->addLayout(horizontalLayout_4);

        layoutButtonsBar = new QHBoxLayout();
        layoutButtonsBar->setObjectName(QStringLiteral("layoutButtonsBar"));
        btnServer = new QToolButton(MVPPlayerRemoteDialog);
        btnServer->setObjectName(QStringLiteral("btnServer"));
        QIcon icon;
        icon.addFile(QStringLiteral(":/mvpplayer/toolbar/connection.png"), QSize(), QIcon::Normal, QIcon::Off);
        btnServer->setIcon(icon);
        btnServer->setIconSize(QSize(32, 32));
        btnServer->setCheckable(true);

        layoutButtonsBar->addWidget(btnServer);


        verticalLayout_3->addLayout(layoutButtonsBar);


        verticalLayout_2->addLayout(verticalLayout_3);

        line_2 = new QFrame(MVPPlayerRemoteDialog);
        line_2->setObjectName(QStringLiteral("line_2"));
        line_2->setFrameShape(QFrame::HLine);
        line_2->setFrameShadow(QFrame::Sunken);

        verticalLayout_2->addWidget(line_2);

        cbMute = new QCheckBox(MVPPlayerRemoteDialog);
        cbMute->setObjectName(QStringLiteral("cbMute"));
        cbMute->setChecked(true);

        verticalLayout_2->addWidget(cbMute);

        verticalLayout = new QVBoxLayout();
        verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
        verticalLayout->setSizeConstraint(QLayout::SetNoConstraint);
        horizontalLayout_2 = new QHBoxLayout();
        horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2"));
        label = new QLabel(MVPPlayerRemoteDialog);
        label->setObjectName(QStringLiteral("label"));

        horizontalLayout_2->addWidget(label);

        lblCurrentTrack = new QLabel(MVPPlayerRemoteDialog);
        lblCurrentTrack->setObjectName(QStringLiteral("lblCurrentTrack"));
        QSizePolicy sizePolicy2(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
        sizePolicy2.setHorizontalStretch(0);
        sizePolicy2.setVerticalStretch(0);
        sizePolicy2.setHeightForWidth(lblCurrentTrack->sizePolicy().hasHeightForWidth());
        lblCurrentTrack->setSizePolicy(sizePolicy2);
        lblCurrentTrack->setWordWrap(true);

        horizontalLayout_2->addWidget(lblCurrentTrack);

        lblTrackLength = new QLabel(MVPPlayerRemoteDialog);
        lblTrackLength->setObjectName(QStringLiteral("lblTrackLength"));
        lblTrackLength->setAlignment(Qt::AlignCenter);

        horizontalLayout_2->addWidget(lblTrackLength);


        verticalLayout->addLayout(horizontalLayout_2);

        horizontalLayout_3 = new QHBoxLayout();
        horizontalLayout_3->setObjectName(QStringLiteral("horizontalLayout_3"));
        sliderPosition = new QSlider(MVPPlayerRemoteDialog);
        sliderPosition->setObjectName(QStringLiteral("sliderPosition"));
        sliderPosition->setMaximum(100);
        sliderPosition->setOrientation(Qt::Horizontal);
        sliderPosition->setInvertedAppearance(false);
        sliderPosition->setInvertedControls(false);
        sliderPosition->setTickPosition(QSlider::TicksBelow);
        sliderPosition->setTickInterval(1);

        horizontalLayout_3->addWidget(sliderPosition);


        verticalLayout->addLayout(horizontalLayout_3);

        horizontalLayout_5 = new QHBoxLayout();
        horizontalLayout_5->setObjectName(QStringLiteral("horizontalLayout_5"));
        btnClearPlaylist = new QToolButton(MVPPlayerRemoteDialog);
        btnClearPlaylist->setObjectName(QStringLiteral("btnClearPlaylist"));
        QIcon icon1;
        icon1.addFile(QStringLiteral(":/mvpplayer/action/cancel.png"), QSize(), QIcon::Normal, QIcon::Off);
        btnClearPlaylist->setIcon(icon1);

        horizontalLayout_5->addWidget(btnClearPlaylist);

        lblPlaylist = new QLabel(MVPPlayerRemoteDialog);
        lblPlaylist->setObjectName(QStringLiteral("lblPlaylist"));

        horizontalLayout_5->addWidget(lblPlaylist);


        verticalLayout->addLayout(horizontalLayout_5);

        playlist = new QListWidget(MVPPlayerRemoteDialog);
        playlist->setObjectName(QStringLiteral("playlist"));
        QSizePolicy sizePolicy3(QSizePolicy::Expanding, QSizePolicy::Maximum);
        sizePolicy3.setHorizontalStretch(0);
        sizePolicy3.setVerticalStretch(0);
        sizePolicy3.setHeightForWidth(playlist->sizePolicy().hasHeightForWidth());
        playlist->setSizePolicy(sizePolicy3);
        playlist->setDragDropMode(QAbstractItemView::DropOnly);

        verticalLayout->addWidget(playlist);


        verticalLayout_2->addLayout(verticalLayout);


        verticalLayout_4->addLayout(verticalLayout_2);

        QWidget::setTabOrder(cbMute, sliderPosition);
        QWidget::setTabOrder(sliderPosition, playlist);

        retranslateUi(MVPPlayerRemoteDialog);

        QMetaObject::connectSlotsByName(MVPPlayerRemoteDialog);
    } // setupUi
示例#13
0
/*!
    This function constructs a dialog which contains a label and a linedit for every
    variable that is stored in the given map except the double-delimiter entry
    It return true if everything was ok and false if the user hit cancel
 */
bool SnippetWidget::showMultiVarDialog(QMap<QString, QString> * map, QMap<QString, QString> * mapSave,
                                       int & iWidth, int & iBasicHeight, int & iOneHeight)
{
  //if no var -> no need to show
  if (map->count() == 0)
    return true;

  //if only var is the double-delimiter -> no need to show
  QMap<QString, QString>::Iterator it = map->begin();
  if ( map->count() == 1 && it.data()==_SnippetConfig.getDelimiter()+_SnippetConfig.getDelimiter() )
    return true;

  QMap<QString, KTextEdit *> mapVar2Te;  //this map will help keeping track which TEXTEDIT goes with which variable
  QMap<QString, QCheckBox *> mapVar2Cb;  //this map will help keeping track which CHECKBOX goes with which variable

  // --BEGIN-- building a dynamic dialog
  QDialog dlg(this);
  dlg.setCaption(i18n("Enter Values for Variables"));

  QGridLayout * layout = new QGridLayout( &dlg, 1, 1, 11, 6, "layout");
  QGridLayout * layoutTop = new QGridLayout( 0, 1, 1, 0, 6, "layoutTop");
  QGridLayout * layoutVar = new QGridLayout( 0, 1, 1, 0, 6, "layoutVar");
  QGridLayout * layoutBtn = new QGridLayout( 0, 1, 1, 0, 6, "layoutBtn");

  KTextEdit *te = NULL;
  QLabel * labTop = NULL;
  QCheckBox * cb = NULL;

  labTop = new QLabel( &dlg, "label" );
  labTop->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0,
                         labTop->sizePolicy().hasHeightForWidth() ) );
  labTop->setText(i18n("Enter the replacement values for these variables:"));
  layoutTop->addWidget(labTop, 0, 0);
  layout->addMultiCellLayout( layoutTop, 0, 0, 0, 1 );


  int i = 0;                                           //walk through the variable map and add
  for ( it = map->begin(); it != map->end(); ++it ) {  //a checkbox, a lable and a lineedit to the main layout
    if (it.key() == _SnippetConfig.getDelimiter() + _SnippetConfig.getDelimiter())
      continue;

    cb = new QCheckBox( &dlg, "cbVar" );
    cb->setChecked( FALSE );
    cb->setText(it.key());
    layoutVar->addWidget( cb, i ,0, Qt::AlignTop );

    te = new KTextEdit( &dlg, "teVar" );
    layoutVar->addWidget( te, i, 1, Qt::AlignTop );

    if ((*mapSave)[it.key()].length() > 0) {
      cb->setChecked( TRUE );
      te->setText((*mapSave)[it.key()]);
    }

    mapVar2Te[it.key()] = te;
    mapVar2Cb[it.key()] = cb;

    QToolTip::add( cb, i18n("Enable this to save the value entered to the right as the default value for this variable") );
    QWhatsThis::add( cb, i18n("If you enable this option, the value entered to the right will be saved. "
                              "If you use the same variable later, even in another snippet, the value entered to the right "
			      "will be the default value for that variable.") );

    i++;
  }
  layout->addMultiCellLayout( layoutVar, 1, 1, 0, 1 );

  KPushButton * btn1 = new KPushButton( &dlg, "pushButton1" );
  btn1->setText(i18n("&Cancel"));
  btn1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0,
                         btn1->sizePolicy().hasHeightForWidth() ) );
  layoutBtn->addWidget( btn1, 0, 0 );

  KPushButton * btn2 = new KPushButton( &dlg, "pushButton2" );
  btn2->setText(i18n("&Apply"));
  btn2->setDefault( TRUE );
  btn2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0,
                         btn2->sizePolicy().hasHeightForWidth() ) );
  layoutBtn->addWidget( btn2, 0, 1 );

  layout->addMultiCellLayout( layoutBtn, 2, 2, 0, 1 );
  // --END-- building a dynamic dialog

  //connect the buttons to the QDialog default slots
  connect(btn1, SIGNAL(clicked()), &dlg, SLOT(reject()) );
  connect(btn2, SIGNAL(clicked()), &dlg, SLOT(accept()) );

  //prepare to execute the dialog
  bool bReturn = false;
  //resize the textedits
  if (iWidth > 1) {
    QRect r = dlg.geometry();
    r.setHeight(iBasicHeight + iOneHeight*mapVar2Te.count());
    r.setWidth(iWidth);
    dlg.setGeometry(r);
  }
  if ( i > 0 && // only if there are any variables
    dlg.exec() == QDialog::Accepted ) {

    QMap<QString, KTextEdit *>::Iterator it2;
    for ( it2 = mapVar2Te.begin(); it2 != mapVar2Te.end(); ++it2 ) {
      if (it2.key() == _SnippetConfig.getDelimiter() + _SnippetConfig.getDelimiter())
        continue;
      (*map)[it2.key()] = it2.data()->text();    //copy the entered values back to the given map

      if (mapVar2Cb[it2.key()]->isChecked())     //if the checkbox is on; save the values for later
        (*mapSave)[it2.key()] = it2.data()->text();
      else
        (*mapSave).erase(it2.key());
    }
    bReturn = true;

    iBasicHeight = dlg.geometry().height() - layoutVar->geometry().height();
    iOneHeight = layoutVar->geometry().height() / mapVar2Te.count();
    iWidth = dlg.geometry().width();
  }

  //do some cleanup
  QMap<QString, KTextEdit *>::Iterator it1;
  for (it1 = mapVar2Te.begin(); it1 != mapVar2Te.end(); ++it1)
    delete it1.data();
  mapVar2Te.clear();
  QMap<QString, QCheckBox *>::Iterator it2;
  for (it2 = mapVar2Cb.begin(); it2 != mapVar2Cb.end(); ++it2)
    delete it2.data();
  mapVar2Cb.clear();
  delete layoutTop;
  delete layoutVar;
  delete layoutBtn;
  delete layout;

  if (i==0) //if nothing happened this means, that there are no variables to translate
    return true; //.. so just return OK

  return bReturn;
}
示例#14
0
void OpenconnectAuthWidget::validatePeerCert(const QString &fingerprint,
                                             const QString &peerCert, const QString &reason, bool *accepted)
{
    Q_D(OpenconnectAuthWidget);

    const QString host = QLatin1String(openconnect_get_hostname(d->vpninfo));
    const QString port = QString::number(openconnect_get_port(d->vpninfo));
    const QString key = QString("certificate:%1:%2").arg(host,  port);
    const QString value = d->secrets.value(key);

#if !OPENCONNECT_CHECK_VER(5,0)
#define openconnect_check_peer_cert_hash(v,d) strcmp(d, fingerprint.toUtf8().data())
#endif

    if (openconnect_check_peer_cert_hash(d->vpninfo, value.toUtf8().data())) {
        QWidget *widget = new QWidget();
        QVBoxLayout *verticalLayout;
        QHBoxLayout *horizontalLayout;
        QLabel *icon;
        QLabel *infoText;
        QTextBrowser *certificate;

        verticalLayout = new QVBoxLayout(widget);
        horizontalLayout = new QHBoxLayout(widget);
        icon = new QLabel(widget);
        QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
        sizePolicy.setHorizontalStretch(0);
        sizePolicy.setVerticalStretch(0);
        sizePolicy.setHeightForWidth(icon->sizePolicy().hasHeightForWidth());
        icon->setSizePolicy(sizePolicy);
        icon->setMinimumSize(QSize(48, 48));
        icon->setMaximumSize(QSize(48, 48));

        horizontalLayout->addWidget(icon);

        infoText = new QLabel(widget);
        infoText->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);

        horizontalLayout->addWidget(infoText);

        verticalLayout->addLayout(horizontalLayout);

        certificate = new QTextBrowser(widget);
        certificate->setTextInteractionFlags(Qt::TextSelectableByMouse);
        certificate->setOpenLinks(false);

        verticalLayout->addWidget(certificate);

        icon->setPixmap(QIcon::fromTheme("dialog-information").pixmap(KIconLoader::SizeLarge));
        infoText->setText(i18n("Check failed for certificate from VPN server \"%1\".\n"
                               "Reason: %2\nAccept it anyway?", openconnect_get_hostname(d->vpninfo),reason));
        infoText->setWordWrap(true);
        certificate->setText(peerCert);

        QPointer<QDialog> dialog = new QDialog(this);
        dialog.data()->setWindowModality(Qt::WindowModal);
        dialog->setLayout(new QVBoxLayout);
        QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, dialog);
        connect(buttons, &QDialogButtonBox::accepted, dialog.data(), &QDialog::accept);
        connect(buttons, &QDialogButtonBox::rejected, dialog.data(), &QDialog::reject);
        dialog->layout()->addWidget(widget);
        dialog->layout()->addWidget(buttons);
        if(dialog.data()->exec() == QDialog::Accepted) {
            *accepted = true;
        } else {
            *accepted = false;
        }
        if (dialog) {
            dialog.data()->deleteLater();
        }
        widget->deleteLater();
    } else {
        *accepted = true;
    }
    if (*accepted) {
        d->secrets.insert(key, QString(fingerprint));
    }
    d->mutex.lock();
    d->workerWaiting.wakeAll();
    d->mutex.unlock();
}
示例#15
0
void addTab(std::string tabName, ImageStorage* imgstore, Ui::MainWindow *ui)
{
	/*ui->processBtn->setEnabled(true);
	ui->previousBtn->setEnabled(true);*/

	QWidget *tab = new QWidget();
	QString qname = QString::fromStdString(tabName);
	tab->setObjectName(qname);
	QHBoxLayout *horizontalLayout = new QHBoxLayout(tab);
	horizontalLayout->setSpacing(6);
	horizontalLayout->setContentsMargins(11, 11, 11, 11);
	horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
	QScrollArea * scrollArea = new QScrollArea(tab);
	scrollArea->setObjectName(QStringLiteral("scrollArea"));
	scrollArea->setWidgetResizable(true);
	QWidget * scrollAreaWidgetContents = new QWidget();
	scrollAreaWidgetContents->setObjectName(QStringLiteral("scrollAreaWidgetContents"));
	scrollAreaWidgetContents->setGeometry(QRect(0, 0, 492, 447));
	QHBoxLayout* horizontalLayout_13 = new QHBoxLayout(scrollAreaWidgetContents);
	horizontalLayout->setSpacing(6);
	horizontalLayout_13->setContentsMargins(11, 11, 11, 11);
	horizontalLayout_13->setObjectName(QStringLiteral("horizontalLayout_13"));
	QLabel* label = new QLabel(scrollAreaWidgetContents);
	std::string stmp = tabName;
	stmp.append("_label");
	QString qname2 = QString::fromStdString(stmp);
	label->setObjectName(qname2);
	QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Expanding);
	sizePolicy2.setHorizontalStretch(0);
	sizePolicy2.setVerticalStretch(0);
	sizePolicy2.setHeightForWidth(label->sizePolicy().hasHeightForWidth());
	label->setSizePolicy(sizePolicy2);

	horizontalLayout_13->addWidget(label);
	scrollArea->setWidget(scrollAreaWidgetContents);
	horizontalLayout->addWidget(scrollArea);
	ui->imageTab->addTab(tab, QString());

	std::string tmp1 = tabName.c_str();
	const char* tmp2 = tmp1.c_str();
	ui->imageTab->setTabText(ui->imageTab->indexOf(tab), QApplication::translate("MainWindow", tmp2, 0));
	ui->imageTab->setCurrentIndex(ui->imageTab->indexOf(tab));


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

	//---------------------
	//display image

	cv::Mat image = std::get<1>(imgstore->getCurrent()->second);  
	QImage img;  
	if(image.channels() == 3)    // RGB image  
	{  
		//cvtColor(image, image, CV_BGR2RGB);  
		img = QImage((const uchar*)(image.data),  //(const unsigned char*)  
			image.cols, image.rows,  
			image.cols*image.channels(),
			QImage::Format_RGB888);  
	}else                     // gray image  
	{  
		img = QImage((const uchar*)(image.data),  
			image.cols, image.rows,  
			image.cols*image.channels(),
			QImage::Format_Indexed8);  
	}  

	if (!img.isNull())
	{
		label->setPixmap(QPixmap::fromImage(img));  
		label->resize(label->pixmap()->size());  
		label->setAlignment(Qt::AlignCenter);
		label->show();
	}
	else
	{
		ASSERT(0);
	}
	  

	//---------------------
}