Example #1
0
/**
\param comp
\param parent
**/
ClienteCuenta::ClienteCuenta (QWidget *parent) : QWidget(parent)
{

    BL_FUNC_DEBUG

    m_clienteview = (ClienteView *) parent;

    QWidget *w = new QWidget();
    m_clienteview->mui_tab->insertTab(1, w, _("Contabilidad"));
        
    QWidget *frame = new QFrame(w);

    QLineEdit *lineedit_cliente = new QLineEdit();
    lineedit_cliente->setObjectName("mui_cuenta_cliente");
    lineedit_cliente->setFixedWidth(100);
    lineedit_cliente->setStatusTip(_("Sobreescribe la configuracion por defecto para la cuenta contable de este cliente. La cuenta debe existir en la contabilidad."));
    QLabel *label_cliente = new QLabel(_("Cuenta contable:"));

    /// Campo para guardar datos de forma temporal.
    QLineEdit *lineedit_tmp_cliente = new QLineEdit();
    lineedit_tmp_cliente->setObjectName("tmp_cuenta_cliente");
    lineedit_tmp_cliente->setText("");
    lineedit_tmp_cliente->hide();

    QHBoxLayout *layout_cliente = new QHBoxLayout;
    layout_cliente->addWidget(label_cliente);
    layout_cliente->addWidget(lineedit_cliente);
    layout_cliente->addWidget(lineedit_tmp_cliente);
    

    frame->setLayout(layout_cliente);
    frame->setMinimumHeight(70);
    
    

}
Example #2
0
GlobStore::GlobStore(QWidget *parent)
            : QWidget(parent)
{
    int l1;

    midiControl = new MidiControl(this);
    midiControl->ID = -2;
    midiControl->parentDockID = -2;

    activeStore = 0;
    currentRequest = 0;
    switchAtBeat = 0;

    storeSignalMapper = new QSignalMapper(this);
    connect(storeSignalMapper, SIGNAL(mapped(int)),
             this, SLOT(storeAll(int)));

    timeModeBox = new QComboBox;
    timeModeBox->addItem(tr("End of"));
    timeModeBox->addItem(tr("After"));
    connect(timeModeBox, SIGNAL(activated(int)),
             this, SLOT(updateTimeModeBox(int)));

    switchAtBeatBox = new QComboBox;
    for (l1 = 0; l1 < 16; l1++) {
        switchAtBeatBox->addItem(QString::number(l1 + 1)+" beats");
    }
    switchAtBeatBox->hide();
    connect(switchAtBeatBox, SIGNAL(activated(int)),
             this, SLOT(updateSwitchAtBeat(int)));

    timeModuleBox = new QComboBox;
    timeModuleBox->setCurrentIndex(0);
    connect(timeModuleBox, SIGNAL(activated(int)),
             this, SLOT(updateTimeModule(int)));

    QWidget *indicatorBox = new QWidget;
    QHBoxLayout *indicatorLayout = new QHBoxLayout;
    indicator = new Indicator(20, ' ');
    indicatorBox->setMinimumHeight(30);
    indicatorBox->setMinimumWidth(30);
    indicatorLayout->addWidget(indicator);
    indicatorLayout->setMargin(2);
    indicatorLayout->setSpacing(1);
    indicatorBox->setLayout(indicatorLayout);

    QHBoxLayout *timeModeLayout = new QHBoxLayout;
    timeModeLayout->addWidget(timeModeBox);
    timeModeLayout->addWidget(timeModuleBox);
    timeModeLayout->addWidget(switchAtBeatBox);
    timeModeLayout->addWidget(indicatorBox);
    timeModeLayout->setSpacing(0);
    timeModeLayout->addStretch();

    QHBoxLayout *upperRowLayout = new QHBoxLayout;
    upperRowLayout->addLayout(timeModeLayout);
    upperRowLayout->addStretch();

    QAction* removeStoreAction = new QAction(tr("&Remove"), this);
    QToolButton *removeStoreButton = new QToolButton;
    removeStoreButton->setDefaultAction(removeStoreAction);
    removeStoreButton->setFixedSize(60, 20);
    removeStoreButton->setArrowType (Qt::ArrowType(1));
    connect(removeStoreAction, SIGNAL(triggered()), this, SLOT(removeLocation()));

    QToolButton *toolButton = new QToolButton;
    toolButton->setText("Global");
    toolButton->setMinimumSize(QSize(56,32));
    midiControl->addMidiLearnMenu("GlobRestore", toolButton, 0);
    
    QFrame *topRow = new QFrame;
    QVBoxLayout *topRowLayout = new QVBoxLayout;
    topRowLayout->addWidget(toolButton);
    topRowLayout->addStretch();
    topRowLayout->setSpacing(0);
    topRowLayout->setMargin(0);
    topRow->setFrameStyle(QFrame::StyledPanel);
    topRow->setMinimumSize(QSize(48,48));;
    topRow->setLayout(topRowLayout);

    QVBoxLayout *buttonLayout = new QVBoxLayout;
    buttonLayout->addWidget(topRow);

    QVBoxLayout *columnLayout = new QVBoxLayout;
    columnLayout->addLayout(buttonLayout);
    columnLayout->addWidget(removeStoreButton);
    columnLayout->addStretch(1);

    indivButtonLayout = new QHBoxLayout;
    indivButtonLayout->setSpacing(0);
    indivButtonLayout->setMargin(0);
    indivButtonLayout->addLayout(columnLayout);
    indivButtonLayout->setSizeConstraint(QLayout::SetFixedSize);

    QHBoxLayout *secondRowLayout = new QHBoxLayout;
    secondRowLayout->addLayout(indivButtonLayout);
    secondRowLayout->addStretch(1);

    QVBoxLayout *centLayout = new QVBoxLayout;
    centLayout->addLayout(upperRowLayout);
    centLayout->addLayout(secondRowLayout);
    centLayout->addStretch(1);

    addLocation();

    setLayout(centLayout);
    schedRestoreVal = 0;
    schedRestore = false;
    dispReqIx = 0;
    dispReqSelected = 0;
    needsGUIUpdate = false;
    modified = false;
}
Example #3
0
subway_panel::subway_panel(int len, int hei, subway_panel::position_T pos, QString name): QFrame()
{
    desktop = QApplication::desktop();
    this->setWindowFlags(Qt::FramelessWindowHint|Qt::Window|Qt::WindowStaysOnTopHint);
    position = pos;
    switch(pos)
    {
	case top:
	case bottom:
	if(len == 0)
	{
	    length = desktop->width();
	}
	else length = len;
	this->setMinimumWidth(length);
	this->setMaximumWidth(length);
	weight = hei;
	this->setMaximumHeight(weight);
	this->setMinimumHeight(weight);
	layout = new QBoxLayout(QBoxLayout::LeftToRight,this);
	((QBoxLayout*)layout)->setAlignment(Qt::AlignLeft);
	((QBoxLayout*)layout)->setSpacing(0);
	((QBoxLayout*)layout)->setMargin(0);
	((QBoxLayout*)layout)->setContentsMargins(0,0,0,0);
	break;
    }
    switch(pos)
    {
	case top:
	  setScreenPos(QPoint(0,0));
	  break;
	case bottom:
	  setScreenPos(QPoint(0,desktop->height()-weight));
	  break;
	case left:
	case right:
	  break;
    }
    settings = new QSettings("Subway","Panel-" + name + "-Applets");
    if(settings->value("initialized","").toString() == "")
    {
	//Initialize new panel
	settings->setValue("initialized","y");
	settings->setValue("appletnum",1);
	settings->setValue("applet1","window-list");
	settings->setValue("applet1-height",32);
	settings->setValue("applet1-width",32);
	//settings->setValue("applet1-align","left");
    }
    this->setLayout(layout);
    for(int i = 1;i<=settings->value("appletnum").toInt();i++)
    {
	QString applet_setting_name = QString("applet")+QVariant(i).toString();
	QString name = settings->value(applet_setting_name).toString();
	QWidget *applet;
	if(name == "window-list")
	{
	    applet = new window_list(this);
	}
	else
	{
	    applet = new QWidget(this);
	}
	int tmp;
	if((tmp = settings->value(applet_setting_name+"-height").toInt()) != 0)
	{
	    applet->setMinimumHeight(tmp);
	    applet->setMaximumHeight(tmp);
	}
	else
	{
	    QSizePolicy sp = applet->sizePolicy();
	    sp.setVerticalPolicy(QSizePolicy::Expanding);
	    applet->setSizePolicy(sp);
	}
	if((tmp = settings->value(applet_setting_name+"-width").toInt()) != 0)
	{
	    applet->setMaximumWidth(tmp);
	    applet->setMinimumWidth(tmp);
	}
	else
	{
	    QSizePolicy sp = applet->sizePolicy();
	    sp.setHorizontalPolicy(QSizePolicy::Expanding);
	    applet->setSizePolicy(sp);
	}
	//layout->addWidget(applet);
	layout->insertWidget(layout->count(),applet);
    }
    this->setAttribute(Qt::WA_X11NetWmWindowTypeDock);
    display = this->x11Info().display();
    XfitMan fitman = xfitMan();
    switch(pos)
    {
      case bottom:
	fitman.setStrut(winId(),  0, 0, 0, weight,
               /* Left   */   0, 0,
               /* Right  */   0, 0,
               /* Top    */   0, 0,
               /* Bottom */   0, desktop->width()
                         );
	break;
      case top:
	fitman.setStrut(winId(),  0, 0, weight, 0,
               /* Left   */   0, 0,
               /* Right  */   0, 0,
               /* Top    */   0, desktop->width(),
               /* Bottom */   0, 0
                         );
    }
}
Example #4
0
//-----------------------------------------------------------------------------
void DebugScriptWindow::setupUI()
{
  // Testing setting up the UI programatically, as opposed to using QTCreator
  // and its generated XML.

  QWidget* dockWidgetContents = new QWidget();
  dockWidgetContents->setObjectName(QString::fromUtf8("DebugWindowContents"));
  this->setWidget(dockWidgetContents);

  mMainLayout = new QVBoxLayout(dockWidgetContents);
  mMainLayout->setSpacing(6);
  mMainLayout->setContentsMargins(9, 9, 9, 9);
  mMainLayout->setObjectName(QString::fromUtf8("verticalLayout"));

  // Script debug implementation.
  {
    QWidget* scriptTabContents = new QWidget();
    mMainLayout->addWidget(scriptTabContents);

    QHBoxLayout* scriptLayout = new QHBoxLayout(scriptTabContents);
    scriptTabContents->setLayout(scriptLayout);

    // Output / one line interaction
    {
      QWidget* outputContents = new QWidget();
      scriptLayout->addWidget(outputContents);

      QVBoxLayout* outputLayout = new QVBoxLayout();
      outputContents->setLayout(outputLayout);

      mListWidget = new QListWidget();
      outputLayout->addWidget(mListWidget);

      // Lower line edit and label.
      {
        QWidget* cont = new QWidget();
        cont->setMinimumHeight(0);
        outputLayout->addWidget(cont);

        QHBoxLayout* hboxLayout = new QHBoxLayout();
        cont->setLayout(hboxLayout);

        QLabel* lbl = new QLabel();
        lbl->setText(QString::fromUtf8("Command: "));
        lbl->setMinimumSize(QSize(0, 0));
        hboxLayout->addWidget(lbl);

        mScriptOneLineEdit = new QLineEdit();
        hboxLayout->addWidget(mScriptOneLineEdit);
        QObject::connect(mScriptOneLineEdit, SIGNAL(returnPressed()), this,
                         SLOT(oneLineEditOnReturnPressed()));
        QObject::connect(mScriptOneLineEdit, SIGNAL(textEdited(const QString&)),
                         this, SLOT(oneLineEditOnEdited(const QString&)));
      }
    }

    // Script interaction.
    {
      QWidget* editContents = new QWidget();
      scriptLayout->addWidget(editContents);

      QVBoxLayout* editLayout = new QVBoxLayout();
      editContents->setLayout(editLayout);

      mScriptTextEdit = new QTextEdit();
      QFont font("Monospace");
      font.setStyleHint(QFont::TypeWriter);
      mScriptTextEdit->setCurrentFont(font);
      editLayout->addWidget(mScriptTextEdit);

      // Combo box combined with execute button.
      {
        QWidget* comboExecContents = new QWidget();
        comboExecContents->setMinimumHeight(0);
        editLayout->addWidget(comboExecContents);

        QHBoxLayout* comboExecLayout = new QHBoxLayout();
        comboExecContents->setLayout(comboExecLayout);

        QLabel* lbl = new QLabel();
        lbl->setText(QString::fromUtf8("Examples: "));
        comboExecLayout->addWidget(lbl);

        mScriptExamplesBox = new QComboBox();
        comboExecLayout->addWidget(mScriptExamplesBox);
        QString emptyExample = QString::fromUtf8(" ");

        mScriptExamplesBox->addItem(QString::fromUtf8(" "),
                                    QVariant(emptyExample));

        QString regressionTesting = QString::fromUtf8(
            "-- Please modify the variables below to point to valid paths.\n"
            "local homeDir = os.getenv('HOME')\n"
            "regress_scriptDir = homeDir .. '/sci/imagevis3d/Tuvok/LuaScripting"
            "/Regression/iv3d'\n"
            "regress_c60Dir = homeDir .. '/sci/datasets/c60.uvf'\n"
            "regress_outputDir = homeDir .. '/sci/datasets/output'\n"
            "luaVerboseMode(true)\n\n"
            "-- Todo: Switch to LuaFileSystem -- cross platform\n"
            "for fname in dir(regress_scriptDir) do\n"
            "  if fname ~= '.' and fname ~= '..' then\n"
            "    -- Ignore vim swap files\n"
            "    ext = fname:match('.(%a*)$'):lower()\n"
            "    if ext ~= 'swp' then\n"
            "      print('Running \\'' .. fname .. '\\'')\n"
            "      dofile(regress_scriptDir .. '/' .. fname)\n"
            "    end\n"
            "  end\n"
            "end\n\n"
            "luaVerboseMode(false)\n");
        mScriptExamplesBox->addItem(QString::fromUtf8("Regression Testing"),
                                    QVariant(regressionTesting));

        QString autoScreenCap = QString::fromUtf8(
            "-- This script will only run on a Posix compliant OS.\n"
            "-- Opens the dataset given by 'filename' and begins taking screen captures.\n"
            "-- You can manually transform the dataset while the script is running.\n"
            "-- Expect horrible things to happen if you close the render window while\n"
            "-- the script is running.\n"
            "local homeDir = os.getenv('HOME')\n"
            "local filename = homeDir .. '/sci/datasets/c60.uvf'\n"
            "local outputDir = homeDir .. '/sci/datasets/output/images'\n"
            "local numScreenCaps = 128\n\n"
            "print('Animate and capture script')\n"
            "print('Results will be output to: ' .. outputDir)\n"
            "os.execute('mkdir -p ' .. outputDir)\n\n"
            "-- data = Render window to animate.\n"
            "-- numFrames = Number of frames to capture during the animation.\n"
            "function doAnim (data, numFrames)\n"
            "  local datasetPath = data.getDataset().fullpath()\n"
            "  local baseName = os.capture('basename ' .. datasetPath .. ' .uvf', false)\n"
            "  print('Using basename: ' .. baseName)\n"
            "  t = 0.0\n"
            "  dt = 2.0 * math.pi / numFrames\n"
            "  for i=1,numFrames do\n"
            "    t = t + dt\n"
            "    print('Capturing screen ' .. i)\n"
            "    data.screenCapture(outputDir .. '/' .. baseName .. '_' .. i .. '.png', false)\n"
            "    -- Dirty hack to get the UI to update.\n"
            "    iv3d.processUI()\n"
            "  end\n"
            "end\n\n"
            "print('Loading data')\n"
            "data = iv3d.renderer.new(filename)\n"
            "print('Performing screen captures')\n"
            "data.setRendererTarget(1)\n"
            "doAnim(data, numScreenCaps)\n"
            "data.setRendererTarget(0)\n");
        mScriptExamplesBox->addItem(QString::fromUtf8("Auto Screen Cap"),
                                    QVariant(autoScreenCap));


        QString exampleMath = QString::fromUtf8(
            "print('-- Binary Operators --')\n"
            "print(5 + 79)\n"
            "print('Basic binary operators: ' .. (3 * 5 - 2) / 5 + 1 )\n"
            "print('Exponentiation: ' .. 3 ^ 5)\n"
            "a = 17; b = 5;\n"
            "print('Modulo: ' .. a % b)\n"
            "print('-- Relational Operators --')\n"
            "print('Is it equal?: ' .. tostring(a%b == a-math.floor(a/b)*b))\n"
            "print('a less than b?: ' .. tostring(a < b))\n"
            "print('a greater than b?: ' .. tostring(a > b))\n");
        mScriptExamplesBox->addItem(QString::fromUtf8("Basic Math"),
                                    QVariant(exampleMath));
        QString exampleLightOnAll = QString::fromUtf8(
            "for i in ...;\n"
            "...\n"
            "...\n"
            "...\n"
            "..");
        mScriptExamplesBox->addItem(QString::fromUtf8("Turn On All Lighting"),
                                    QVariant(exampleLightOnAll));
        QString rotate360AndScreenCap = QString::fromUtf8(
            "for i in ...;\n"
            "...\n"
            "...\n"
            "...\n"
            "..");
        mScriptExamplesBox->addItem(QString::fromUtf8("Rotate 360 and Screen "
                                                      "Cap"),
                                    QVariant(rotate360AndScreenCap));
        QObject::connect(mScriptExamplesBox, SIGNAL(currentIndexChanged(int)),
                         this, SLOT(exampComboIndexChanged(int)));

        QSpacerItem* spacer = new QSpacerItem(40, 10,
                                              QSizePolicy::Expanding,
                                              QSizePolicy::Preferred);
        comboExecLayout->addSpacerItem(spacer);

        mExecButton = new QPushButton();
        mExecButton->setMinimumSize(QSize(0, 23));  // Required, if not, button
        // is shifted downwards beyond its layout control.
        mExecButton->setText(QString::fromUtf8("Execute Script"));
        comboExecLayout->addWidget(mExecButton);
        QObject::connect(mExecButton, SIGNAL(clicked()), this,
                         SLOT(execClicked()));
      }
    }
  }
  connect(mScriptTextEdit, SIGNAL(textChanged()), this, SLOT(fixFont()));
}
Example #5
0
void MENU_KERNEL::ADD_MENU_KERNEL_BUTTON ( QLayout * layout,int button_type,QString button_name,int index )
{
    QWidget * widget = new QWidget ( this );

    QString button_text_label_style_sheet = "font: 12px;";

    int button_pos = -1;

    for ( int i = 0 ; i < m_button_positions.size() ; i++ ) {
         QStringList button_info = m_button_positions.at(i).split ( "//t//" );
        if ( button_info.at(0).toInt() EQ M_KERNEL_MENU_SECENEGI[index].enum_id ) {
            button_pos = button_info.at(1).toInt();
            break;
        }
    }

    QToolButton * menu_button_item = new QToolButton ( widget );

    menu_button_item->setText ( button_name );

    if ( button_type EQ MENU_BODY_ITEM ) {
        connect ( menu_button_item,SIGNAL ( clicked() ),this,SLOT ( SLOT_MENU_ITEM_CLICKED() ) );
        menu_button_item->setSizePolicy ( QSizePolicy::Fixed,QSizePolicy::Fixed );
        menu_button_item->setObjectName ( QVariant ( M_KERNEL_MENU_SECENEGI[index].enum_id ).toString() );
        menu_button_item->setStyleSheet ( "QToolButton { text-align: left;  background-color:rgba (255, 255, 255, 0); "
                                          "font: 14px \"Monospace\";  } ;" );
    }
    else {
        menu_button_item->setSizePolicy ( QSizePolicy::Expanding,QSizePolicy::Fixed );
    }

    if ( button_pos EQ -1 ) {
         button_pos = m_default_button_pos;
    }

    if ( button_pos EQ BUTTON_USTUNDE_SAG_TARAFTA ) {
        QVBoxLayout * box_layout = new QVBoxLayout;
        widget->setLayout ( box_layout );
        box_layout->addWidget ( menu_button_item );
        menu_button_item->setToolButtonStyle ( Qt::ToolButtonTextBesideIcon );
    }
    else if ( button_pos EQ BUTTON_USTUNDE_ALT_TARAFTA ) {
        QVBoxLayout * box_layout = new QVBoxLayout;
        widget->setLayout ( box_layout );
        box_layout->addWidget ( menu_button_item );
        menu_button_item->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon );
    }
    else if ( button_pos EQ BUTTON_DISINDA_SAG_TARAFTA ) {
        QHBoxLayout * box_layout = new QHBoxLayout;
        widget->setLayout ( box_layout );
        box_layout->addWidget ( menu_button_item );
        menu_button_item->setToolButtonStyle ( Qt::ToolButtonIconOnly ) ;

        QLabel * label = new QLabel;
        label->setSizePolicy ( QSizePolicy::Expanding,QSizePolicy::Fixed );
        label->setAlignment ( Qt::AlignCenter );
        label->setStyleSheet(button_text_label_style_sheet);
        label->setText ( button_name );
        box_layout->addWidget ( label );
        SET_WIDGET_DEFAULTS ( label,index );
    }
    else if ( button_pos EQ BUTTON_DISINDA_ALT_TARAFTA ) {
        QVBoxLayout * box_layout = new QVBoxLayout;
        box_layout->addSpacerItem(new QSpacerItem(20,40,QSizePolicy::Fixed,QSizePolicy::Expanding));
        widget->setLayout ( box_layout );

        QHBoxLayout * horizontal_box_layout = new QHBoxLayout;
        box_layout->addLayout ( horizontal_box_layout );

        horizontal_box_layout->addSpacerItem ( new QSpacerItem ( 40,20,QSizePolicy::Expanding,QSizePolicy::Fixed));
        horizontal_box_layout->addWidget ( menu_button_item );
        horizontal_box_layout->addSpacerItem ( new QSpacerItem ( 40,20,QSizePolicy::Expanding,QSizePolicy::Fixed));
        menu_button_item->setToolButtonStyle ( Qt::ToolButtonIconOnly );

        QLabel * label = new QLabel;
        label->setSizePolicy ( QSizePolicy::Preferred,QSizePolicy::Fixed );
        label->setAlignment ( Qt::AlignCenter );
        label->setStyleSheet(button_text_label_style_sheet);
        label->setText ( button_name );
        box_layout->addWidget ( label );
        box_layout->addSpacerItem(new QSpacerItem(20,40,QSizePolicy::Fixed,QSizePolicy::Expanding));
        SET_WIDGET_DEFAULTS ( label,index );
    }
    else if ( button_pos EQ BUTTON_TEXT_YOK            ) {
        QVBoxLayout * box_layout = new QVBoxLayout;
        widget->setLayout ( box_layout );
        box_layout->addWidget ( menu_button_item );
        menu_button_item->setToolButtonStyle ( Qt::ToolButtonIconOnly );
    }

    if ( button_pos EQ BUTTON_ICON_YOK            ) {
        QVBoxLayout * box_layout = new QVBoxLayout;
        widget->setLayout ( box_layout );
        layout->addWidget ( widget );
        menu_button_item->setToolButtonStyle ( Qt::ToolButtonTextBesideIcon );
        menu_button_item->setIcon ( QIcon ( ":/kernel_icons/kernel_align_icon.png" ) );
        menu_button_item->setSizePolicy ( QSizePolicy::Expanding,QSizePolicy::Fixed);
        QString temp_obj_name = menu_button_item->objectName();
        menu_button_item->setObjectName ( "NO_ICON" );
        menu_button_item->setIconSize ( QSize(32,ICONSUZ_BUTTON_YUKSEKLIGI ) );
        SET_WIDGET_DEFAULTS ( menu_button_item,index );
        menu_button_item->setObjectName ( temp_obj_name );
        box_layout->addWidget(menu_button_item);
        layout->addWidget ( widget );
    }
    else if ( button_pos EQ -2 ) {
        //FIXME Qt nin 12095 nolu toolbutton stylesheet bugi duzelene kadar kalacak

        disconnect(menu_button_item);

        menu_button_item->close();

        QString button_tab = M_KERNEL_MENU_SECENEGI[index].tab_str;

        button_tab.replace("\t","      ",Qt::CaseInsensitive);

        QPushButton * push_button = new QPushButton (widget);
        push_button->setStyleSheet("text-align: left; margin:0; padding:0;");
        push_button->setText      (button_tab + menu_button_item->text());
        push_button->setObjectName(menu_button_item->objectName());

        connect ( push_button,SIGNAL ( clicked() ),this,SLOT ( SLOT_MENU_ITEM_CLICKED() ) );

        layout->setSpacing(0);
        layout->addWidget ( push_button );
        push_button->setSizePolicy ( QSizePolicy::Expanding,QSizePolicy::Expanding);
        QString temp_obj_name = push_button->objectName();
        push_button->setObjectName ( "NO_ICON" );
        push_button->setIconSize ( QSize(32,ICONSUZ_BUTTON_YUKSEKLIGI ) );
        SET_WIDGET_DEFAULTS ( push_button,index );
        push_button->setObjectName ( temp_obj_name );
    }
    else {
        SET_WIDGET_DEFAULTS ( menu_button_item,index );
        layout->addWidget ( widget );
    }

    if (M_KERNEL_MENU_SECENEGI[index].enum_id EQ -999) {
        //Bos icon
        menu_button_item->setStyleSheet("background:rgba(255,255,255,0); color:rgba(255,255,255,0); border:0;");
    }

    if ( m_seperator_list.contains(M_KERNEL_MENU_SECENEGI[index].enum_id ) ) {
        QWidget * spacer = new QWidget;
        spacer->setMinimumHeight ( BUTTONLAR_ARASI_SEPERATOR_BOSLUGU );
        spacer->setMaximumHeight  ( BUTTONLAR_ARASI_SEPERATOR_BOSLUGU );
        layout->addWidget ( spacer );
    }
}
void FilterSettingWidget::filterChanged(int _index)
{
	index = _index;

	// Clear filter settings
	foreach(QWidget *widget, settingWidgets)
		delete widget;
	settingWidgets.clear();

	foreach(PropertyAdaptor *adaptor, adaptors)
		delete adaptor;
	adaptors.clear();

	// Ensure size
	if ((int) chain->getChain().size() <= index)
		return;

	if (index >= 0) {
		// Add new filter name
		ImageFilterBase *filter = chain->getChain()[index];

		QString name = ((FilterButton*)list->itemWidget(list->item(index)))->getName();

		QLabel *label = new QLabel("Settings: "+name+") "+ QString::fromStdString(filter->name));
		label->setStyleSheet("QLabel{color:#8E5316;font-size:15px;font:bold;padding:3px;}");
		filterLayout->addWidget(label);
		settingWidgets.append(label);

		// Add new filter properties
		const FilterProperties& properties =  filter->getFilterProperties();

		if (properties.empty()){
			QLabel *label = new QLabel(tr("No settings available."));
			label->setStyleSheet("QLabel{color:#8E5316;font-size:15px;padding:3px;}");
			filterLayout->addWidget(label);
			settingWidgets.append(label);
		}

		for (FilterProperties::const_iterator it=properties.begin(); it!=properties.end(); ++it) {
			QLabel *label = new QLabel(QString::fromStdString(it->name));
			label->setStyleSheet("QLabel{color:#8E5316;font-size:15px;font:bold;}");

			filterLayout->addWidget(label);
			settingWidgets.append(label);

			PropertyAdaptor *adaptor = new PropertyAdaptor(filter, it->name);
			adaptors.append(adaptor);

			QString curValue(QString::fromStdString(filter->getProperty(it->name)));

			// Create the property widget
			QWidget *tmp = createPropertyWidget(*it, curValue, adaptor);

			tmp->setStyleSheet(stylesheet);

			tmp->setMinimumHeight(30);
			filterLayout->addWidget(tmp);
			settingWidgets.append(tmp);
		}
	}
}
int Dialog::showDialog(const QString& view, QObject* viewModel, int type)
{
    QDialog* dialog = NULL;
    QMainWindow* mainWindow = NULL;
    QWidget* windowWidget = NULL;
    QWidget* layoutWidget = NULL;

    switch (type)
    {
    case Dialog::MainWindow:
        mainWindow = new QMainWindow();
        windowWidget = mainWindow;
        layoutWidget = new QWidget(windowWidget);
        mainWindow->setCentralWidget(layoutWidget);
        break;

    case Dialog::ModalDialog:
        dialog = new QDialog(QApplication::activeWindow());
        windowWidget = dialog;
        layoutWidget = dialog;
        break;

    default:
        dialog = new QDialog();
        windowWidget = dialog;
        layoutWidget = dialog;
        break;
    }

    QGridLayout* layout = new QGridLayout(layoutWidget);

    // Create view

    QDeclarativeView* v = new QDeclarativeView(layoutWidget);

    if (viewModel)
    {
        int count = viewModel->metaObject()->propertyCount();
        for (int i = 0; i < count; ++i)
        {
            QMetaProperty p = viewModel->metaObject()->property(i);
            if (p.isReadable() && p.typeName() == QString("QDeclarativeImageProvider*"))
            {
                QString name = p.name();
                QDeclarativeImageProvider* value = p.read(viewModel).value<QDeclarativeImageProvider*>();

                v->engine()->addImageProvider(name.toLatin1(), new ProxyImageProvider(value));
            }
        }

        v->rootContext()->setContextProperty("dataContext", viewModel);
    }

    QString path;
    foreach (path, importPaths)
        v->engine()->addImportPath(path);
    foreach (path, pluginPaths)
        v->engine()->addPluginPath(path);

    v->setSource(QUrl(view));
    v->setResizeMode(QDeclarativeView::SizeRootObjectToView);

    // Initialize dialog

    QGraphicsObject* root = v->rootObject();

    QVariant property = root->property("dialogTitle");
    if (property.isValid())
        windowWidget->setWindowTitle(property.toString());

    property = root->property("dialogMinWidth");
    if (property.isValid())
        layoutWidget->setMinimumWidth(property.toInt());

    property = root->property("dialogMinHeight");
    if (property.isValid())
        layoutWidget->setMinimumHeight(property.toInt());

    property = root->property("dialogMaxWidth");
    if (property.isValid())
        layoutWidget->setMaximumWidth(property.toInt());

    property = root->property("dialogMaxHeight");
    if (property.isValid())
        layoutWidget->setMaximumHeight(property.toInt());

    property = root->property("dialogResizable");
    if (property.isValid() && !property.toBool())
        layout->setSizeConstraint(QLayout::SetFixedSize);

    Qt::WindowStates states = windowWidget->windowState();
    Qt::WindowFlags flags = windowWidget->windowFlags();

    property = root->property("dialogMinimizeButton");
    if (property.isValid())
        flags = property.toBool() ? flags | Qt::WindowMinimizeButtonHint : flags & ~Qt::WindowMinimizeButtonHint;

    property = root->property("dialogMaximizeButton");
    if (property.isValid())
        flags = property.toBool() ? flags | Qt::WindowMaximizeButtonHint : flags & ~Qt::WindowMaximizeButtonHint;

    property = root->property("dialogCloseButton");
    if (property.isValid())
        flags = property.toBool() ? flags | Qt::WindowCloseButtonHint : flags & ~Qt::WindowCloseButtonHint;

    property = root->property("dialogFullScreen");
    if (property.isValid())
        states = property.toBool() ? states | Qt::WindowFullScreen : states & ~Qt::WindowFullScreen;

    flags = flags & ~Qt::WindowContextHelpButtonHint;

    windowWidget->setWindowFlags(flags);
    windowWidget->setWindowState(states);

    property = root->property("dialogToolBar");
    if (type == Dialog::MainWindow && property.isValid() && property.typeName() == QString("QDeclarativeListProperty<QDeclarativeItem>"))
    {
        QToolBar* toolbar = new QToolBar(mainWindow);
        toolbar->setMovable(false);
        toolbar->setFloatable(false);
        toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        toolbar->setAllowedAreas(Qt::TopToolBarArea);

        QDeclarativeListProperty<QDeclarativeItem> btnList = property.value< QDeclarativeListProperty<QDeclarativeItem> >();
        int btnCount = btnList.count(&btnList);

        for (int i = 0; i < btnCount; ++i)
        {
            QDeclarativeItem* item = btnList.at(&btnList, i);

            if (!item->property("text").isValid())
                continue;

            QString itemText = item->property("text").toString();
            QString itemTooltip = item->property("tooltip").isValid() ? item->property("tooltip").toString() : "";
            QString itemIconSource = item->property("iconSource").isValid() ? item->property("iconSource").toString() : "";
            int itemIconSize = item->property("iconSize").isValid() ? item->property("iconSize").toInt() : -1;

            if (itemText == "|")
            {
                toolbar->addSeparator();
            }
            else if (itemText == "-")
            {
                QWidget* spacer = new QWidget();
                spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
                toolbar->addWidget(spacer);
            }
            else
            {
                QAction* action = new QAction(mainWindow);
                action->setText(itemText);
                action->setToolTip(itemTooltip);
                action->setIcon(QIcon(itemIconSource));
                QObject::connect(action, SIGNAL(triggered()), item, SLOT(trigger()));

                if (item->property("enabled").isValid())
                    new PropertyBinding(action, "enabled", item, "enabled", PropertyBinding::OneWay, NULL, this);

                if (item->property("visible").isValid())
                    new PropertyBinding(action, "visible", item, "visible", PropertyBinding::OneWay, NULL, this);

                toolbar->addAction(action);
            }

            if (itemIconSize != -1)
                toolbar->setIconSize(QSize(itemIconSize, itemIconSize));
        }

        mainWindow->setUnifiedTitleAndToolBarOnMac(true);
        mainWindow->addToolBar(toolbar);
    }

    property = root->property("dialogMenu");
    if (type == Dialog::MainWindow && property.isValid() && property.typeName() == QString("QDeclarativeListProperty<QDeclarativeItem>"))
    {
        QDeclarativeListProperty<QDeclarativeItem> list = property.value< QDeclarativeListProperty<QDeclarativeItem> >();
        int count = list.count(&list);

        for (int i = 0; i < count; ++i)
        {
            QDeclarativeItem* item = list.at(&list, i);

            if (!item->property("text").isValid())
                continue;

            QString itemText = item->property("text").toString();
            QMenu * menuItem = mainWindow->menuBar()->addMenu(itemText);

            if (!item->property("submenu").isValid() || item->property("submenu").typeName() != QString("QDeclarativeListProperty<QDeclarativeItem>"))
                continue;

            QDeclarativeListProperty<QDeclarativeItem> innerList = item->property("submenu").value< QDeclarativeListProperty<QDeclarativeItem> >();
            int innerCount = innerList.count(&innerList);

            for (int j = 0; j < innerCount; ++j)
            {
                QDeclarativeItem* innerItem = innerList.at(&innerList, j);

                if (!innerItem->property("text").isValid())
                    continue;

                QString innerItemText = innerItem->property("text").toString();
                QString innerItemShortcut = innerItem->property("shortcut").isValid() ? innerItem->property("shortcut").toString() : "";
                QString innerItemIconSource = innerItem->property("iconSource").isValid() ? innerItem->property("iconSource").toString() : "";

                if (innerItemText == "-")
                {
                    menuItem->addSeparator();
                }
                else
                {
                    QAction * action = menuItem->addAction(QIcon(innerItemIconSource), innerItemText);
                    action->setShortcut(QKeySequence(innerItemShortcut));

                    QObject::connect(action, SIGNAL(triggered()), innerItem, SLOT(trigger()));

                    if (innerItem->property("enabled").isValid())
                        new PropertyBinding(action, "enabled", innerItem, "enabled", PropertyBinding::OneWay, NULL, this);

                    if (innerItem->property("visible").isValid())
                        new PropertyBinding(action, "visible", innerItem, "visible", PropertyBinding::OneWay, NULL, this);
                }
            }
        }
    }

    new DialogCallbacks(windowWidget, v, root);

    // Initialize layout

    layout->setMargin(0);
    layout->addWidget(v, 0, 0);

    // Execute

    switch (type)
    {
    case Dialog::ModalDialog:
        dialog->exec();
        break;

    case Dialog::MainWindow:
    {
        if (mainWindowGeometry.isEmpty())
        {
            mainWindow->adjustSize();
            mainWindow->move(QApplication::desktop()->screen()->rect().center() - mainWindow->rect().center());
        }
        else
            mainWindow->restoreGeometry(mainWindowGeometry);
    }

    default:
        windowWidget->setAttribute(Qt::WA_DeleteOnClose);
        windowWidget->show();
        break;
    }

    int result = 0;

    property = root->property("dialogResult");
    if (property.isValid())
        result = property.toInt();

    if (type == Dialog::ModalDialog)
        delete dialog;

    return result;
}
Example #8
0
StartupView::StartupView( QWidget * parent ) 
  : QWidget( parent )
{
  m_templateListModel = boost::shared_ptr<TemplateListModel>( new TemplateListModel() );

  setStyleSheet("openstudio--StartupView { background: #E6E6E6; }");
  
#ifdef Q_WS_MAC
  setWindowFlags(Qt::FramelessWindowHint);
#else
  setWindowFlags(Qt::CustomizeWindowHint);
#endif

  QWidget * recentProjectsView = new QWidget();
  recentProjectsView->setStyleSheet("QWidget { background: #F2F2F2; }");
  QVBoxLayout * recentProjectsLayout = new QVBoxLayout();
  recentProjectsLayout->setContentsMargins(10,10,10,10);
  QLabel * recentProjectsLabel = new QLabel("Recent Projects");
  recentProjectsLabel->setStyleSheet("QLabel { font: bold }");
  recentProjectsLayout->addWidget(recentProjectsLabel,0,Qt::AlignTop);
  recentProjectsView->setLayout(recentProjectsLayout);

  QToolButton * openButton = new QToolButton();
  openButton->setText("Open File");
  openButton->setStyleSheet("QToolButton { font: bold; }");
  openButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  QIcon openIcon(":/images/open_file.png");
  openButton->setIcon(openIcon);
  openButton->setIconSize(QSize(40,40));
  connect( openButton, SIGNAL(clicked()), this, SIGNAL(openClicked()) );

  QToolButton * importButton = new QToolButton();
  importButton->setText("Import Idf");
  importButton->setStyleSheet("QToolButton { font: bold; }");
  importButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  QIcon importIcon(":/images/import_file.png");
  importButton->setIcon(importIcon);
  importButton->setIconSize(QSize(40,40));
  connect( importButton, SIGNAL(clicked()), this, SIGNAL(importClicked()) );
/*  
  QToolButton * importSDDButton = new QToolButton();
  importSDDButton->setText("Import SDD");
  importSDDButton->setStyleSheet("QToolButton { font: bold; }");
  importSDDButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  QIcon importSDDIcon(":/images/import_file.png");
  importSDDButton->setIcon(importSDDIcon);
  importSDDButton->setIconSize(QSize(40,40));
  connect( importSDDButton, SIGNAL(clicked()), this, SIGNAL(importSDDClicked()) );
*/
  QWidget * projectChooserView = new QWidget();
  projectChooserView->setFixedWidth(238);
  projectChooserView->setStyleSheet("QWidget { background: #F2F2F2; }");
  QVBoxLayout * projectChooserLayout = new QVBoxLayout();
  projectChooserLayout->setContentsMargins(10,10,10,10);
  QLabel * projectChooserLabel = new QLabel("Create New From Template");
  projectChooserLabel->setStyleSheet("QLabel { font: bold }");
  projectChooserLayout->addWidget(projectChooserLabel,0,Qt::AlignTop);
  m_listView = new QListView();
  m_listView->setViewMode(QListView::IconMode);
  m_listView->setModel(m_templateListModel.get());
  m_listView->setFocusPolicy(Qt::NoFocus);
  m_listView->setFlow(QListView::LeftToRight);
  m_listView->setUniformItemSizes(true);
  m_listView->setSelectionMode(QAbstractItemView::SingleSelection);
  projectChooserLayout->addWidget(m_listView);
  projectChooserView->setLayout(projectChooserLayout);

  m_projectDetailView = new QWidget();
  m_projectDetailView->setStyleSheet("QWidget { background: #F2F2F2; }");
  QVBoxLayout * projectDetailLayout = new QVBoxLayout();
  projectDetailLayout->setContentsMargins(10,10,10,10);
  m_projectDetailView->setLayout(projectDetailLayout);

  QWidget * footerView = new QWidget();
  footerView->setObjectName("FooterView");
  footerView->setStyleSheet("QWidget#FooterView { background: #E6E6E6; }");
  footerView->setMaximumHeight(50);
  footerView->setMinimumHeight(50);

  QPushButton * cancelButton = new QPushButton();
  cancelButton->setObjectName("StandardGrayButton");
  cancelButton->setMinimumSize(QSize(99,28));
  #ifdef OPENSTUDIO_PLUGIN
    cancelButton->setText("Cancel");
    connect( cancelButton, SIGNAL(clicked()), this, SLOT(hide()) );
  #else
    #ifdef Q_OS_MAC
      cancelButton->setText("Quit");
    #else
      cancelButton->setText("Exit");
    #endif
    connect( cancelButton, SIGNAL(clicked()), OpenStudioApp::instance(), SLOT(quit()) );
  #endif
  cancelButton->setStyleSheet("QPushButton { font: bold; }");

  QPushButton * chooseButton = new QPushButton();
  chooseButton->setObjectName("StandardBlueButton");
  chooseButton->setText("Choose");
  chooseButton->setMinimumSize(QSize(99,28));
  connect( chooseButton, SIGNAL(clicked()), this, SLOT(newFromTemplateSlot()) );
  chooseButton->setStyleSheet("QPushButton { font: bold; }");

  QHBoxLayout * hFooterLayout = new QHBoxLayout();
  hFooterLayout->setSpacing(25);
  hFooterLayout->setContentsMargins(0,0,0,0);
  hFooterLayout->addStretch();
  hFooterLayout->addWidget(cancelButton);
  hFooterLayout->addWidget(chooseButton);
  footerView->setLayout(hFooterLayout);

  QHBoxLayout * hLayout = new QHBoxLayout();
  QVBoxLayout * vLayout = new QVBoxLayout();

  QVBoxLayout * vOpenLayout = new QVBoxLayout();
  vOpenLayout->addWidget(recentProjectsView);
  vOpenLayout->addWidget(openButton);
  vOpenLayout->addWidget(importButton);
  //vOpenLayout->addWidget(importSDDButton);

  hLayout->addLayout(vOpenLayout);
  hLayout->addWidget(projectChooserView);
  hLayout->addWidget(m_projectDetailView,1);

  vLayout->addSpacing(50);
  vLayout->addLayout(hLayout);
  vLayout->addWidget(footerView);

  setLayout(vLayout);

  connect(m_listView,SIGNAL(clicked( const QModelIndex &)),this,SLOT( showDetailsForItem( const QModelIndex & ) ));

  m_listView->setCurrentIndex(m_templateListModel->index(0,0));
  showDetailsForItem(m_templateListModel->index(0,0));
}
AnimatedVectorControl::AnimatedVectorControl(const std::string& name, AnimatedVector* pairedValue, float min, float max, std::string label) : Control(name, label)
{
	QWidget* mainWidget = new QWidget();

	QHBoxLayout* layout = new QHBoxLayout(mainWidget);
	mainWidget->setLayout(layout);
	layout->setSpacing(1);
	layout->setMargin(0);

	mainWidget->setMinimumHeight(26);

	Vector value = pairedValue->getVector();
	bool isKey = pairedValue->isKeyed();

	for (unsigned int i = 0; i < 3; i++)
	{
		DoubleSpinBoxEx* pSpin = new DoubleSpinBoxEx(mainWidget);
		m_Spins[i] = pSpin;

		pSpin->setMinimumSize(65, 22);
		pSpin->setMaximumHeight(22);

		pSpin->setMinimum(min);
		pSpin->setMaximum(max);

		pSpin->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

		pSpin->setBGColour(isKey ? QColor(192, 192, 255) : Qt::white);

		pSpin->setValue((value)[i]);

		layout->addWidget(pSpin);
	}

	m_pAnimationButton = new PushButtonEx(QIcon(":/imagine/images/animation.png"), "", mainWidget);
	m_pAnimationButton->setMaximumWidth(20);
	m_pAnimationButton->setMinimumWidth(20);
	m_pAnimationButton->setMaximumHeight(20);
	m_pAnimationButton->setMinimumHeight(20);
	m_pAnimationButton->setToolTip("Set key");

	layout->addSpacing(5);
	layout->addWidget(m_pAnimationButton);

	m_widget = mainWidget;

	m_pairedValue = pairedValue;

	m_pConnectionProxy->registerValueChangedDouble(m_Spins[0]);
	m_pConnectionProxy->registerValueChangedDouble(m_Spins[1]);
	m_pConnectionProxy->registerValueChangedDouble(m_Spins[2]);

	m_pConnectionProxy->registerButtonClicked(m_pAnimationButton);

	// set up menu actions
	m_actSetAnimated = new QAction("Set Animated", m_pAnimationButton);
	m_actDeleteAnimation = new QAction("Delete Animation", m_pAnimationButton);
	m_actSetKey = new QAction("Set Key", m_pAnimationButton);
	m_actDeleteKey = new QAction("Delete Key", m_pAnimationButton);
	m_actLinearInterpolation = new QAction("Linear Interpolation", m_pAnimationButton);
	m_actQuadraticInterpolation = new QAction("Quadratic Interpolation", m_pAnimationButton);
	m_actCubicInterpolation = new QAction("Cubic Interpolation", m_pAnimationButton);

	m_actLinearInterpolation->setCheckable(true);
	m_actQuadraticInterpolation->setCheckable(true);
	m_actCubicInterpolation->setCheckable(true);

	setInterpolationTypeChecked(m_pairedValue->getInterpolationType());

	m_signalMapper = new QSignalMapper(m_pAnimationButton);

	m_pAnimationButton->connect(m_actSetAnimated, SIGNAL(triggered()), m_signalMapper, SLOT(map()));
	m_signalMapper->setMapping(m_actSetAnimated, 0);

	m_pAnimationButton->connect(m_actDeleteAnimation, SIGNAL(triggered()), m_signalMapper, SLOT(map()));
	m_signalMapper->setMapping(m_actDeleteAnimation, 1);

	m_pAnimationButton->connect(m_actSetKey, SIGNAL(triggered()), m_signalMapper, SLOT(map()));
	m_signalMapper->setMapping(m_actSetKey, 2);

	m_pAnimationButton->connect(m_actDeleteKey, SIGNAL(triggered()), m_signalMapper, SLOT(map()));
	m_signalMapper->setMapping(m_actDeleteKey, 3);

	m_pAnimationButton->connect(m_actLinearInterpolation, SIGNAL(triggered()), m_signalMapper, SLOT(map()));
	m_signalMapper->setMapping(m_actLinearInterpolation, 4);

	m_pAnimationButton->connect(m_actQuadraticInterpolation, SIGNAL(triggered()), m_signalMapper, SLOT(map()));
	m_signalMapper->setMapping(m_actQuadraticInterpolation, 5);

	m_pAnimationButton->connect(m_actCubicInterpolation, SIGNAL(triggered()), m_signalMapper, SLOT(map()));
	m_signalMapper->setMapping(m_actCubicInterpolation, 6);

	m_pConnectionProxy->registerMenuSelected(m_signalMapper);
}
AgendaView::AgendaView(QWidget *parent)
    :SIView(parent)
{
    const QDateTime &dateTime = QDateTime::currentDateTime();
    setCurrentMonth((Month)(dateTime.date().month() - 1));

    setObjectName(QString().sprintf("AgendaView%p", parent));

    QWidget *centralWidget = new QWidget(this);
    centralWidget->setObjectName(QString().sprintf("%p", centralWidget));

    resize(QApplication::desktop()->width(), 436);
    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    setMinimumWidth(QApplication::desktop()->width());
    setMinimumHeight(436);

    centralWidget->setStyleSheet(QString("QWidget#%1 { background-image: url(:/images/res/fondo_base.png); }").arg(centralWidget->objectName()));
    //centralWidget->setStyleSheet(QString("QWidget#%1 { background-image: url(:/images/res/screens/agenda.png); }").arg(centralWidget->objectName()));
    centralWidget->resize(size());
    centralWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    centralWidget->setMinimumWidth(QApplication::desktop()->width());
    centralWidget->setMinimumHeight(436);

    m_monthLabel = new QLabel(centralWidget);
    m_monthLabel->setObjectName(QString().sprintf("monthLabel%p", m_monthLabel));
    m_monthLabel->setGeometry(QRect(0, 19, 360, 20));
    m_monthLabel->setStyleSheet(QString::fromUtf8("QLabel#%1 { font: 75 20px \"AvantGardeMdITCTT\"; color: rgb(222,222,222) }").arg(m_monthLabel->objectName()));
    m_monthLabel->setWordWrap(false);
    m_monthLabel->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter);
    m_monthLabel->setText(months[currentMonth()].toUpper());

    QPushButton *buttonLeft = new QPushButton(centralWidget);
    buttonLeft->setObjectName("buttonLeft");
    buttonLeft->setGeometry(0, 0, 54, 54);
    buttonLeft->setText("");
    buttonLeft->setFlat(true);
    buttonLeft->setStyleSheet(QString("QPushButton#buttonLeft { background-color: rgba(255,0,0,0); color: rgb(222, 222, 222); font: 75 20px \"AvantGardeMdITCTT\"; }"));
    connect(buttonLeft, SIGNAL(clicked()), this, SLOT(backMonthPressed()));

    QPushButton *buttonRight = new QPushButton(centralWidget);
    buttonRight->setObjectName("buttonRight");
    buttonRight->setGeometry(306, 0, 54, 54);
    buttonRight->setText("");
    buttonRight->setFlat(true);
    buttonRight->setStyleSheet(QString("QPushButton#buttonRight { background-color: rgba(255,0,0,0); color: rgb(222, 222, 222); font: 75 20px \"AvantGardeMdITCTT\"; }"));
    connect(buttonRight, SIGNAL(clicked()), this, SLOT(forwardMonthPressed()));

    m_calendarWidget = new CustomCalendarWidget(centralWidget);
    m_calendarWidget->setObjectName(QString::fromUtf8("calendarWidget"));
    m_calendarWidget->setGeometry(QRect(5, 20, 350, 325));
    m_calendarWidget->setGridVisible(false);
    m_calendarWidget->setSelectionMode(QCalendarWidget::SingleSelection);
    m_calendarWidget->setVerticalHeaderFormat(QCalendarWidget::NoVerticalHeader);
    m_calendarWidget->setHorizontalHeaderFormat(QCalendarWidget::ShortDayNames);
    m_calendarWidget->setNavigationBarVisible(true);
    m_calendarWidget->setDateEditEnabled(false);
    m_calendarWidget->setLocale(QLocale(QLocale::Spanish, QLocale::Argentina));
    m_calendarWidget->setAutoFillBackground(false);
    m_calendarWidget->setStyleSheet(QString("CustomCalendarWidget#calendarWidget { background-color: rgba(0,255,0,0); alternate-background-color: rgba(255, 255, 0, 0); selection-color: rgb(255, 255, 0); font: 75 20px \"AvantGardeMdITCTT\"; }"));
    QTextCharFormat format;
    format.setForeground(QColor(190,190,190));
    format.setBackground(QColor(255,0,0,0));
    format.setFontCapitalization(QFont::AllLowercase);
    m_calendarWidget->setHeaderTextFormat(format);
    format.setForeground(QColor(150,150,150));
    format.setBackground(QColor(255,0,0,0));
    format.setFontPointSize(6);
    m_calendarWidget->setWeekdayTextFormat(Qt::Monday, format);
    m_calendarWidget->setWeekdayTextFormat(Qt::Tuesday, format);
    m_calendarWidget->setWeekdayTextFormat(Qt::Wednesday, format);
    m_calendarWidget->setWeekdayTextFormat(Qt::Thursday, format);
    m_calendarWidget->setWeekdayTextFormat(Qt::Friday, format);
    m_calendarWidget->setWeekdayTextFormat(Qt::Saturday, format);
    m_calendarWidget->setWeekdayTextFormat(Qt::Sunday, format);
    m_calendarWidget->setDateList(&GlobalDataObject::instance().datesExercisedList());
    connect(m_calendarWidget, SIGNAL(clicked(QDate)), this, SLOT(dateSelected(QDate)));

    QWidget *labelTip = new QWidget(centralWidget);
    labelTip->setObjectName(QString().sprintf("labelTip%p", labelTip));
    labelTip->setGeometry(0, 375, 264, 26);
    labelTip->setStyleSheet(QString("QWidget#%1 { image: url(:/images/res/agenda_tip.png); }").arg(labelTip->objectName()));
    labelTip->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

}
//------------------------------------------------------------------------------
//
void QEResizeableFrame::setWidget (QWidget* widgetIn)
{
   QWidget* workingWidget = NULL;

   // Sanity check.
   //
   if (widgetIn) {
      // Cannot set self as widget nor the current widget nor the default widget.
      //
      if ((widgetIn == this) ||
          (widgetIn == this->userWidget) ||
          (widgetIn == this->defaultWidget)) {
         // Here be dragons - cannot set do this.
         //
         qDebug () << "QEResizeableFrame::setWidget - unexpected widget parameter";
         return;
      }
   }

   // First clear all widgets (if any) from the layout.
   //
   this->layout->removeWidget (this->grabber);

   this->layout->removeWidget (this->defaultWidget);
   this->defaultWidget->setParent (NULL);

   // If there is user widget then remove and delete it is well.
   //
   if (this->userWidget) {
      this->layout->removeWidget (this->userWidget);
      delete this->userWidget;
      this->userWidget = NULL;
   }

   // Now we can start putting it back together again.
   //
   this->userWidget = widgetIn;

   // Did user specify a widget - if not use default widget.
   //
   if (this->userWidget) {
      workingWidget = this->userWidget;
   } else {
      workingWidget = this->defaultWidget;
   }

   // Reparent userWidget/defaultWidget.
   //
   workingWidget->setParent (this);

   // Ensure user widget resizeable.
   // Actual size is controlled by allowedMin and allowedMax.
   // designer deafults to 16777215
   if (this->isVertical()) {
      workingWidget->setMinimumHeight (0);
      workingWidget->setMaximumHeight (8000);
   } else {
      workingWidget->setMinimumWidth (0);
      workingWidget->setMaximumWidth (8000);
   }

   switch (this->grabbingEdge) {
      case BottomEdge:
      case RightEdge:
         this->layout->addWidget (workingWidget);
         this->layout->addWidget (this->grabber);
         break;

      case TopEdge:
      case LeftEdge:
         this->layout->addWidget (this->grabber);
         this->layout->addWidget (workingWidget);
         break;
   }
}
//The main constructor.
GofunWidget::GofunWidget(WFlags f) : QWidget(0,0,f)
{    
	//Set up some accelerators
	accel = new QAccel(this);
	
	//Do some layout magic
	QHBoxLayout* hbox = new QHBoxLayout(this);
	QVBoxLayout* vbox = new QVBoxLayout();
	QHBoxLayout* hboxr = new QHBoxLayout();
	QHBoxLayout* hboxlabel = new QHBoxLayout();
    
	//This button group contains the buttons for the different directories
	cats_bg = new GofunVButtonGroup(this);
	cats_bg->setExclusive(true);
	cats_bg->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding,false);
	connect(cats_bg, SIGNAL(clicked(int)),this, SLOT(changeDirectory(int)));
    
	//We 'load' this WidgetStack with GofunIconViews later on
	view_ws = new QWidgetStack(this);
	view_ws->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding,false);
	
	//It should be obvious what that is being
	QPushButton* quit = new QPushButton(tr("Quit"), this, "quit");
	quit->setFont(QFont("Times", 18));
	quit->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum,false);
	connect(quit, SIGNAL(clicked()), qApp, SLOT(quit()));
	
	//The button marking your way to the settings-dialog
	QToolButton* config = new QToolButton(this);
    	config->setPixmap(QPixmap("config.png"));
	QToolTip::add(config,tr("Settings"));
	connect(config, SIGNAL(clicked()),this, SLOT(openSettingsDlg()));
	
	//A helpful help-button
	QToolButton* help = new QToolButton(this);
	help->setPixmap(QPixmap("help.png"));
	QToolTip::add(help,tr("Help"));
	connect(help, SIGNAL(clicked()),this, SLOT(showHelp()));
	
	//Layout magic, basically we add the WidgetStack and a vertical box to the
	//top horizontal box
	hbox->addWidget(view_ws);
	hbox->addLayout(vbox);
		    
	//Isn't it nice?
	QLabel* gflabel = new QLabel("GoFun",this);
	gflabel->setFont(QFont("Times",18, QFont::Bold));
	gflabel->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum,0);
	vbox->addLayout(hboxlabel);
	hboxlabel->addWidget(gflabel);
	
	//Common it is ...
	QToolButton* gficon = new QToolButton(this);
	gficon->setFixedWidth(32);
	gficon->setPixmap(QPixmap("gofun.png"));
	QToolTip::add(gficon,tr("About"));
	hboxlabel->addWidget(gficon);
	
	connect(gficon,SIGNAL(clicked()),this,SLOT(showAbout()));
	
	//The last steps in our layout magic
	vbox->addWidget(cats_bg);
	tools_cat = new GofunDirectoryButton("GoTools",this);
	vbox->addWidget(tools_cat);
	QWidget* wid = new QWidget(this);
	wid->setMinimumHeight(5);
	vbox->addWidget(wid);
	vbox->addLayout(hboxr);
	hboxr->addWidget(quit);            
	hboxr->addWidget(config);
	hboxr->addWidget(help);
	
	//This toolbutton shall be used to add directories
    	QToolButton* cat_add = new QToolButton(Qt::DownArrow,cats_bg);
	connect(cat_add, SIGNAL(clicked()),this, SLOT(popupDirectoryAdd()));
	QToolTip::add(cat_add,tr("Click this button to operate on directories"));
	cats_bg->insert(cat_add);   
	
	//Now load the whole GoFun-Data and care for its displaying
	loadData();
}
Example #13
0
/*!
 * INIT: create dock widgets.
 */
void socketcangui::createDockWidgets() {
  // Send widget (table; normally in the lower part)
  QWidget *sendwidget = new QWidget;
  QHBoxLayout *sendwidgetLayout = new QHBoxLayout;
  sendtable = new QTreeWidget;
  sendtable->setColumnCount(6);
  sendtable->setAlternatingRowColors(true);
  sendtable->setHeaderLabels(QStringList() << tr("#") << tr("Interval (ms)") << tr("CAN ID (hex)") << tr("EFF") << tr("DLC") << tr("Data (hex)") << tr("Active"));
  timerdisplaylist.clear();
  QString tmpstring;
  // insert ten send rows
  for (int i = 0; i < 10; i++) {
    tmpstring = QString::number(i);
    timerdisplaylist.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList() << tmpstring << "0" << "0" << "0" << "0" << "0" << "0"));
    // make the row editable
    timerdisplaylist.at(i)->setFlags(timerdisplaylist.at(i)->flags() | Qt::ItemIsEditable);
  }
  sendtable->addTopLevelItems(timerdisplaylist);
  // create the ten send timers
  for (int i = 0; i < 10; i++) {
    timerlist[i] = new QTimer;
  }
  // Really ugly but the timeout()-SIGNAL won't tell us which timer it was
  connect(timerlist[0], SIGNAL(timeout()), this, SLOT(sendtimer0fired()));
  connect(timerlist[1], SIGNAL(timeout()), this, SLOT(sendtimer1fired()));
  connect(timerlist[2], SIGNAL(timeout()), this, SLOT(sendtimer2fired()));
  connect(timerlist[3], SIGNAL(timeout()), this, SLOT(sendtimer3fired()));
  connect(timerlist[4], SIGNAL(timeout()), this, SLOT(sendtimer4fired()));
  connect(timerlist[5], SIGNAL(timeout()), this, SLOT(sendtimer5fired()));
  connect(timerlist[6], SIGNAL(timeout()), this, SLOT(sendtimer6fired()));
  connect(timerlist[7], SIGNAL(timeout()), this, SLOT(sendtimer7fired()));
  connect(timerlist[8], SIGNAL(timeout()), this, SLOT(sendtimer8fired()));
  connect(timerlist[9], SIGNAL(timeout()), this, SLOT(sendtimer9fired()));
  connect(sendtable, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(sendtablechanged(QTreeWidgetItem *, int)));

  sendwidgetLayout->addWidget(sendtable);
  sendwidget->setMinimumHeight(100);
  sendwidget->setLayout(sendwidgetLayout);
  QDockWidget *sendwidgetDock = new QDockWidget(tr("Send packets"));
  sendwidgetDock->setWidget(sendwidget);
  addDockWidget(Qt::BottomDockWidgetArea, sendwidgetDock);
  // make the dock widget non-closeable
  sendwidgetDock->setFeatures(sendwidgetDock->features() & ~QDockWidget::DockWidgetClosable);

  // Control widget (normally on the right side)
  QWidget *controlwidget = new QWidget;
  QVBoxLayout *controlwidgetLayout = new QVBoxLayout;
  controlwidget->setLayout(controlwidgetLayout);
  QDockWidget *controlwidgetDock = new QDockWidget(tr("Capture control"));
  controlwidgetDock->setWidget(controlwidget);
  addDockWidget(Qt::RightDockWidgetArea, controlwidgetDock);
  // make the dock widget non-closeable
  controlwidgetDock->setFeatures(controlwidgetDock->features() & ~QDockWidget::DockWidgetClosable);

  QLabel *ifacelabel = new QLabel(tr("CAN Interfaces:"));
  QPushButton *updateifaces = new QPushButton(tr("Update"));
  QHBoxLayout *ifacesheader = new QHBoxLayout;
  ifacesheader->addWidget(ifacelabel);
  ifacesheader->addWidget(updateifaces);
  controlwidgetLayout->addLayout(ifacesheader);
  ifacelist = new QTreeWidget;
  ifacelist->setColumnCount(2);
  ifacelist->setHeaderLabels(QStringList() << tr("Interface") << tr("Status"));
  controlwidgetLayout->addWidget(ifacelist);
  connect(updateifaces, SIGNAL(clicked()), this, SLOT(updateinterfacelist()));
  connect(ifacelist, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(ifacelistdclicked(QModelIndex)));

  QHBoxLayout *capturelayout = new QHBoxLayout;
  controlwidgetLayout->addLayout(capturelayout);
  QLabel *capturelabel = new QLabel(tr("Capture Interface:"));
  capturelayout->addWidget(capturelabel);

  ifacecombo = new QComboBox;
  capturelayout->addWidget(ifacecombo);
  capturepb = new QPushButton(tr("Start"));
  capturelayout->addWidget(capturepb);

  // Tell Qt that canpacket can be used with SLOTs and SIGNALs
  qRegisterMetaType<canpacket>("canpacket");
  connect(capturepb, SIGNAL(clicked()), this, SLOT(startorstopthread()));
  connect(&mycanthread, SIGNAL(dataarrived(canpacket)), myclf, SLOT(adddataitem(canpacket)));

  // Tell Qt that threadstatus can be used with SLOTs and SIGNALs
  qRegisterMetaType<threadstatus>("threadstatus");
  connect(&mycanthread, SIGNAL(statusChanged(threadstatus)), this, SLOT(updateStatus(threadstatus)));

  // Status widget (normally on the right side)
  QWidget *statuswidget = new QWidget;
  QVBoxLayout *statuswidgetLayout = new QVBoxLayout;
  statuswidget->setLayout(statuswidgetLayout);
  statuswidgetDock = new QDockWidget(tr("Capture status"));
  statuswidgetDock->setWidget(statuswidget);
  addDockWidget(Qt::RightDockWidgetArea, statuswidgetDock);
  // make the dock widget non-closeable
  statuswidgetDock->setFeatures(statuswidgetDock->features() & ~QDockWidget::DockWidgetClosable);

  statusdisplaylabel = new QLabel(tr("Idle"));
  statusdisplaylabel->setStyleSheet(HTMLLIGHTRED);
  statusdisplaylabel->setFrameShape(QFrame::Panel);
  statusdisplaylabel->setFrameShadow(QLabel::Sunken);
  statusdisplaylabel->setAlignment(Qt::AlignHCenter);
  QHBoxLayout *statusdisplaylayout = new QHBoxLayout;
  statusdisplaylayout->addWidget(statusdisplaylabel);
  statuswidgetLayout->addLayout(statusdisplaylayout);

  statusincounter = new QLabel("");
  statuswidgetLayout->addWidget(statusincounter);
  statusoutcounter = new QLabel("");
  statuswidgetLayout->addWidget(statusoutcounter);
  statusinbcounter = new QLabel("");
  statuswidgetLayout->addWidget(statusinbcounter);
  statusoutbcounter = new QLabel("");
  statuswidgetLayout->addWidget(statusoutbcounter);
}
Example #14
0
QWidget* FiPage::makeSplitTab()
{
  QFormLayout* flay = new QFormLayout;  // Build edit area
  flay->addRow(tr("Date"),      mSplitDate = new QLineEdit);
  flay->addRow(tr("Ratio"),     mRatio = new QLineEdit);
  flay->addRow(tr("Comment"),   mSplitComment = new QLineEdit);

  // Add an "empty" line
  int charWidth = QFontMetrics(font()).averageCharWidth();
  QWidget* widget = new QWidget;
  widget->setMinimumHeight(charWidth * 2);
  flay->addRow(widget);

  flay->addRow(tr("Pre:Post"),  mPrePost = new QLineEdit);

  mSplitDate->setMaximumWidth(charWidth * 15);
  mSplitDate->setInputMask("D999-9D-9D");
  connect(mPrePost, SIGNAL(editingFinished()), this, SLOT(prePostEdited()));
  mPrePost->setMaximumWidth(charWidth * 10);
  mPrePost->setInputMask("D0:D0");
  mSplitComment->setMinimumWidth(charWidth * 30);

  QHBoxLayout* hbox = new QHBoxLayout;  // Build button line
  hbox->setMargin(0);

  QToolButton* btn = new QToolButton;
  hbox->addWidget(btn);
  btn->setToolTip(tr("Save Split Changes"));
  btn->setAutoRaise(true);
  btn->setIcon(QIcon::fromTheme("document-save"));
//   btn->setShortcut(QKeySequence(QKeySequence::Save));
  connect(btn, SIGNAL(clicked()), this, SLOT(saveSplit()));

  btn = new QToolButton;
  hbox->addWidget(btn);
  btn->setToolTip(tr("Add Split (Search for Split)"));
  btn->setAutoRaise(true);
  btn->setIcon(QIcon::fromTheme("list-add"));
//   btn->setShortcut(QKeySequence(QKeySequence::Save));
  connect(btn, SIGNAL(clicked()), this, SLOT(newSplit()));

  hbox->addStretch();

  btn = new QToolButton;
  hbox->addWidget(btn);
  btn->setToolTip(tr("Delete Split"));
  btn->setAutoRaise(true);
  btn->setIcon(QIcon::fromTheme("edit-delete"));
//   btn->setShortcut(QKeySequence(QKeySequence::Save));
  connect(btn, SIGNAL(clicked()), this, SLOT(deleteSplit()));

  flay->addRow("", hbox);               // Complete edit area..

  hbox = new QHBoxLayout;               // ..but add a stretch to the right
  hbox->setMargin(0);
  hbox->addLayout(flay);
  hbox->addStretch(1);
//   hbox->setStretch(0, 2);

  widget = new QWidget;
  widget->setLayout(hbox);

  mSplitView = new SqlTableView;
  mSplitView->verticalHeader()->hide();
  connect(mSplitView, SIGNAL(newSelection(const QModelIndex &))
          , this, SLOT(splitClicked(const QModelIndex &)));

  QSplitter* splitter = new QSplitter(Qt::Horizontal);
  splitter->addWidget(mSplitView);
  splitter->addWidget(widget);

  return splitter;
}
Example #15
0
ParStore::ParStore(GlobStore *p_globStore, const QString &name,
            QAction *p_muteOutAction,
            QAction *p_deferChangesAction,
            QWidget* parent):
                QWidget(parent), globStore(p_globStore)
{
    // when temp.empty is true, restoring from that set is ignored
    temp.empty = false;
    temp.muteOut = false;
    temp.res = 1;
    temp.size = 0;
    temp.loopMode = 0;
    temp.waveForm = 0;
    temp.portOut = 0;
    temp.channelOut = 0;
    temp.chIn = 0;
    temp.wave.clear();
    temp.muteMask.clear();
    /* LFO Modules */
    temp.ccnumber = -1;
    temp.ccnumberIn = 0;
    temp.freq = 0;
    temp.ampl = 0;
    temp.offs = 0;
    /* Seq Modules */
    temp.loopMarker = 0;
    temp.notelen = 0;
    temp.vel = 0;
    temp.transp = 0;
    temp.dispVertical = 0;
    /* Arp Modules */
    temp.indexIn0 = 0;
    temp.indexIn1 = 0;
    temp.rangeIn0 = 0;
    temp.rangeIn1 = 0;
    temp.attack = 0;
    temp.release = 0;
    temp.repeatMode = 0;
    temp.rndTick = 0;
    temp.rndLen = 0;
    temp.rndVel = 0;
    temp.pattern = "";
    list.clear();

    ndc = new Indicator(14, name.at(0), this);

    topButton = new QToolButton(this);
    topButton->setFont(QFont("Helvetica", 8));
    topButton->setText(name);
    topButton->setMinimumSize(QSize(75, 10));

    muteOutAction = p_muteOutAction;
    muteOut = new QToolButton(this);
    muteOut->setDefaultAction(muteOutAction);
    muteOut->setFont(QFont("Helvetica", 8));
    muteOut->setMinimumSize(QSize(10, 10));

    deferChangesAction = p_deferChangesAction;
    deferChanges = new QToolButton(this);
    deferChanges->setDefaultAction(deferChangesAction);
    deferChanges->setFont(QFont("Helvetica", 8));
    deferChanges->setMinimumSize(QSize(10, 10));

    QHBoxLayout *muteRowLayout = new QHBoxLayout;
    muteRowLayout->addStretch();
    muteRowLayout->addWidget(muteOut);
    muteRowLayout->addWidget(deferChanges);
    muteRowLayout->setMargin(0);
    muteRowLayout->setSpacing(0);

    QVBoxLayout *controlLayout = new QVBoxLayout;
    controlLayout->addWidget(topButton);
    controlLayout->addLayout(muteRowLayout);
    controlLayout->setMargin(0);
    controlLayout->setSpacing(0);

    QWidget *indicatorBox = new QWidget(this);
    QHBoxLayout *indicatorLayout = new QHBoxLayout;
    indicatorBox->setMinimumHeight(20);
    indicatorBox->setMinimumWidth(25);
    indicatorLayout->addWidget(ndc);
    indicatorLayout->setMargin(2);
    indicatorLayout->setSpacing(1);
    indicatorBox->setLayout(indicatorLayout);

    QFrame *topRow = new QFrame(this);
    QHBoxLayout *topRowLayout = new QHBoxLayout;
    topRowLayout->addWidget(indicatorBox);
    topRowLayout->addLayout(controlLayout);
    topRowLayout->setSpacing(0);
    topRowLayout->setMargin(0);
    topRow->setMinimumSize(QSize(48,46));;
    topRow->setFrameStyle(QFrame::StyledPanel);
    topRow->setLayout(topRowLayout);

    QVBoxLayout *buttonLayout = new QVBoxLayout();
    buttonLayout->addWidget(topRow);

    locContextMenu = new QMenu(this);

    QAction *storeHereAction = new QAction(tr("&Store here"), this);
    storeHereAction->setProperty("index", list.count());
    storeHereAction->setIcon(QIcon(filesave_xpm));
    locContextMenu->addAction(storeHereAction);
    connect(storeHereAction, SIGNAL(triggered()), this, SLOT(mapStoreSignal()));

    QAction *onlyPatternAction = new QAction(tr("&Act on pattern only"), this);
    onlyPatternAction->setProperty("index", list.count());
    onlyPatternAction->setCheckable(true);
    locContextMenu->addAction(onlyPatternAction);
    connect(onlyPatternAction, SIGNAL(toggled(bool)), this, SLOT(updateOnlyPattern(bool)));

    jumpToIndexMenu = new QMenu(tr("When finished"), this);

    jumpToGroup = new QActionGroup(this);
    connect(jumpToGroup, SIGNAL(triggered(QAction *))
             , this, SLOT(mapJumpToGroup(QAction *)));

    jumpToIndexMenu->addAction(new QAction(tr("Stay here"), this));
    jumpToIndexMenu->actions().last()->setProperty("index", -2);
    jumpToIndexMenu->actions().last()->setActionGroup(jumpToGroup);
    jumpToIndexMenu->actions().last()->setCheckable(true);
    jumpToIndexMenu->actions().last()->setChecked(true);

    jumpToIndexMenu->addAction(new QAction(tr("Jump back"), this));
    jumpToIndexMenu->actions().last()->setProperty("index", -1);
    jumpToIndexMenu->actions().last()->setActionGroup(jumpToGroup);
    jumpToIndexMenu->actions().last()->setCheckable(true);

    jumpToIndexMenu->addSeparator()->setText(tr("Jump to:"));

    locContextMenu->addMenu(jumpToIndexMenu);

    for (int l1 = 0; l1 < list.size() - 1; l1++) addLocation();

    QVBoxLayout *columnLayout = new QVBoxLayout;
    columnLayout->addLayout(buttonLayout);
    columnLayout->addStretch();
    columnLayout->setMargin(0);
    columnLayout->setSpacing(0);
    setLayout(columnLayout);

    globStore->indivButtonLayout->addWidget(this);


    restoreRequest = -1;
    oldRestoreRequest = 0;
    restoreRunOnce = false;
    activeStore = 0;
    currentRequest = 0;
    dispReqIx = 0;
    dispReqSelected = 0;
    needsGUIUpdate = false;
}
Example #16
0
QWidget *AbstractController::createWidget( buttonType_e button, int options )
{
    bool b_flat  = options & WIDGET_FLAT;
    bool b_big   = options & WIDGET_BIG;
    bool b_shiny = options & WIDGET_SHINY;
    bool b_special = false;

    QWidget *widget = NULL;
    switch( button )
    {
    case PLAY_BUTTON: {
        PlayButton *playButton = new PlayButton;
        setupButton( playButton );
        BUTTON_SET_BAR(  playButton );
        CONNECT_MAP_SET( playButton, PLAY_ACTION );
        CONNECT( this, inputPlaying( bool ),
                 playButton, updateButtonIcons( bool ));
        playButton->updateButtonIcons( THEMIM->getIM()->playingStatus() == PLAYING_S );
        widget = playButton;
        }
        break;
    case STOP_BUTTON:{
        NORMAL_BUTTON( STOP );
        }
        break;
    case OPEN_BUTTON:{
        NORMAL_BUTTON( OPEN );
        }
        break;
    case OPEN_SUB_BUTTON:{
        NORMAL_BUTTON( OPEN_SUB );
        }
        break;
    case PREVIOUS_BUTTON:{
        NORMAL_BUTTON( PREVIOUS );
        }
        break;
    case NEXT_BUTTON: {
        NORMAL_BUTTON( NEXT );
        }
        break;
    case SLOWER_BUTTON:{
        NORMAL_BUTTON( SLOWER );
        ENABLE_ON_INPUT( SLOWERButton );
        }
        break;
    case FASTER_BUTTON:{
        NORMAL_BUTTON( FASTER );
        ENABLE_ON_INPUT( FASTERButton );
        }
        break;
    case PREV_SLOW_BUTTON:{
        QToolButtonExt *but = new QToolButtonExt;
        setupButton( but );
        BUTTON_SET_BAR( but );
        CONNECT( but, shortClicked(), THEMIM, prev() );
        CONNECT( but, longClicked(), THEAM, skipBackward() );
        widget = but;
        }
        break;
    case NEXT_FAST_BUTTON:{
        QToolButtonExt *but = new QToolButtonExt;
        setupButton( but );
        BUTTON_SET_BAR( but );
        CONNECT( but, shortClicked(), THEMIM, next() );
        CONNECT( but, longClicked(), THEAM, skipForward() );
        widget = but;
        }
        break;
    case FRAME_BUTTON: {
        NORMAL_BUTTON( FRAME );
        ENABLE_ON_VIDEO( FRAMEButton );
        }
        break;
    case FULLSCREEN_BUTTON:
    case DEFULLSCREEN_BUTTON:
        {
        NORMAL_BUTTON( FULLSCREEN );
        ENABLE_ON_VIDEO( FULLSCREENButton );
        }
        break;
    case FULLWIDTH_BUTTON: {
            NORMAL_BUTTON( FULLWIDTH );
        }
        break;
    case EXTENDED_BUTTON:{
        NORMAL_BUTTON( EXTENDED );
        }
        break;
    case PLAYLIST_BUTTON:{
        NORMAL_BUTTON( PLAYLIST );
        }
        break;
    case SNAPSHOT_BUTTON:{
        NORMAL_BUTTON( SNAPSHOT );
        ENABLE_ON_VIDEO( SNAPSHOTButton );
        }
        break;
    case RECORD_BUTTON:{
        QToolButton *recordButton = new QToolButton;
        setupButton( recordButton );
        CONNECT_MAP_SET( recordButton, RECORD_ACTION );
        BUTTON_SET_BAR(  recordButton );
        ENABLE_ON_INPUT( recordButton );
        recordButton->setCheckable( true );
        CONNECT( THEMIM->getIM(), recordingStateChanged( bool ),
                 recordButton, setChecked( bool ) );
        widget = recordButton;
        }
        break;
    case ATOB_BUTTON: {
        AtoB_Button *ABButton = new AtoB_Button;
        setupButton( ABButton );
        ABButton->setShortcut( qtr("Shift+L") );
        BUTTON_SET_BAR( ABButton );
        ENABLE_ON_INPUT( ABButton );
        CONNECT_MAP_SET( ABButton, ATOB_ACTION );
        CONNECT( THEMIM->getIM(), AtoBchanged( bool, bool),
                 ABButton, updateButtonIcons( bool, bool ) );
        widget = ABButton;
        }
        break;
    case INPUT_SLIDER: {
        SeekSlider *slider = new SeekSlider( Qt::Horizontal, NULL, !b_shiny );
        SeekPoints *chapters = new SeekPoints( this, p_intf );
        CONNECT( THEMIM->getIM(), chapterChanged( bool ), chapters, update() );
        slider->setChapters( chapters );

        /* Update the position when the IM has changed */
        CONNECT( THEMIM->getIM(), positionUpdated( float, int64_t, int ),
                slider, setPosition( float, int64_t, int ) );
        /* And update the IM, when the position has changed */
        CONNECT( slider, sliderDragged( float ),
                 THEMIM->getIM(), sliderUpdate( float ) );
        CONNECT( THEMIM->getIM(), cachingChanged( float ),
                 slider, updateBuffering( float ) );
        /* Give hint to disable slider's interactivity when useless */
        CONNECT( THEMIM->getIM(), inputCanSeek( bool ),
                 slider, setSeekable( bool ) );
        widget = slider;
        }
        break;
    case MENU_BUTTONS:
        widget = discFrame();
        break;
    case TELETEXT_BUTTONS:
        widget = telexFrame();
        widget->hide();
        break;
    case VOLUME_SPECIAL:
        b_special = true;
    case VOLUME:
        {
            SoundWidget *snd = new SoundWidget( this, p_intf, b_shiny, b_special );
            widget = snd;
        }
        break;
    case TIME_LABEL:
        {
            TimeLabel *timeLabel = new TimeLabel( p_intf );
            widget = timeLabel;
        }
        break;
    case SPLITTER:
        {
            QFrame *line = new QFrame;
            line->setFrameShape( QFrame::VLine );
            line->setFrameShadow( QFrame::Raised );
            line->setLineWidth( 0 );
            line->setMidLineWidth( 1 );
            widget = line;
        }
        break;
    case ADVANCED_CONTROLLER:
        if( qobject_cast<AdvControlsWidget *>(this) == NULL )
        {
            advControls = new AdvControlsWidget( p_intf, this );
            widget = advControls;
        }
        break;
    case REVERSE_BUTTON:{
        QToolButton *reverseButton = new QToolButton;
        setupButton( reverseButton );
        CONNECT_MAP_SET( reverseButton, REVERSE_ACTION );
        BUTTON_SET_BAR(  reverseButton );
        reverseButton->setCheckable( true );
        /* You should, of COURSE change this to the correct event,
           when/if we have one, that tells us if trickplay is possible . */
        CONNECT( this, inputIsTrickPlayable( bool ), reverseButton, setVisible( bool ) );
        reverseButton->setVisible( false );
        widget = reverseButton;
        }
        break;
    case SKIP_BACK_BUTTON: {
        NORMAL_BUTTON( SKIP_BACK );
        ENABLE_ON_INPUT( SKIP_BACKButton );
        }
        break;
    case SKIP_FW_BUTTON: {
        NORMAL_BUTTON( SKIP_FW );
        ENABLE_ON_INPUT( SKIP_FWButton );
        }
        break;
    case QUIT_BUTTON: {
        NORMAL_BUTTON( QUIT );
        }
        break;
    case RANDOM_BUTTON: {
        NORMAL_BUTTON( RANDOM );
        RANDOMButton->setCheckable( true );
        RANDOMButton->setChecked( var_GetBool( THEPL, "random" ) );
        CONNECT( THEMIM, randomChanged( bool ),
                 RANDOMButton, setChecked( bool ) );
        }
        break;
    case LOOP_BUTTON:{
        LoopButton *loopButton = new LoopButton;
        setupButton( loopButton );
        loopButton->setToolTip( qtr( "Click to toggle between loop all, loop one and no loop") );
        loopButton->setCheckable( true );
        {
            int i_state = NORMAL;
            if( var_GetBool( THEPL, "loop" ) )   i_state = REPEAT_ALL;
            if( var_GetBool( THEPL, "repeat" ) ) i_state = REPEAT_ONE;
            loopButton->updateButtonIcons( i_state );
        }

        CONNECT( THEMIM, repeatLoopChanged( int ), loopButton, updateButtonIcons( int ) );
        CONNECT( loopButton, clicked(), THEMIM, loopRepeatLoopStatus() );
        widget = loopButton;
        }
        break;
    case INFO_BUTTON: {
        NORMAL_BUTTON( INFO );
        }
        break;
    case PLAYBACK_BUTTONS:{
        widget = new QWidget;
        DeckButtonsLayout *layout = new DeckButtonsLayout( widget );
        BrowseButton *prev = new BrowseButton( widget, BrowseButton::Backward );
        BrowseButton *next = new BrowseButton( widget );
        RoundButton *play = new RoundButton( widget );
        layout->setBackwardButton( prev );
        layout->setForwardButton( next );
        layout->setRoundButton( play );
        CONNECT_MAP_SET( prev, PREVIOUS_ACTION );
        CONNECT_MAP_SET( next, NEXT_ACTION );
        CONNECT_MAP_SET( play, PLAY_ACTION );
        }
        break;
    case ASPECT_RATIO_COMBOBOX:
        widget = new AspectRatioComboBox( p_intf );
        widget->setMinimumHeight( 26 );
        break;
    case SPEED_LABEL:
        widget = new SpeedLabel( p_intf, this );
        break;
    case TIME_LABEL_ELAPSED:
        widget = new TimeLabel( p_intf, TimeLabel::Elapsed );
        break;
    case TIME_LABEL_REMAINING:
        widget = new TimeLabel( p_intf, TimeLabel::Remaining );
        break;
    default:
        msg_Warn( p_intf, "This should not happen %i", button );
        break;
    }

    /* Customize Buttons */
    if( b_flat || b_big )
    {
        QFrame *frame = qobject_cast<QFrame *>(widget);
        if( frame )
        {
            QList<QToolButton *> allTButtons = frame->findChildren<QToolButton *>();
            for( int i = 0; i < allTButtons.count(); i++ )
                applyAttributes( allTButtons[i], b_flat, b_big );
        }
        else
        {
            QToolButton *tmpButton = qobject_cast<QToolButton *>(widget);
            if( tmpButton )
                applyAttributes( tmpButton, b_flat, b_big );
        }
    }
    return widget;
}
Example #17
0
KBugReport::KBugReport( QWidget * _parent, bool modal, const KAboutData *aboutData )
  : KDialog( _parent ), d( new KBugReportPrivate(this) )
{
  setCaption( i18n("Submit Bug Report") );
  setButtons( Ok | Cancel );
  setModal(modal);

  // Use supplied aboutdata, otherwise the one from the active componentData
  // otherwise the KGlobal one. _activeInstance should neved be 0L in theory.
  d->m_aboutData = aboutData ? aboutData
      : (KGlobal::activeComponent().isValid() ? KGlobal::activeComponent().aboutData()
                                  : KGlobal::mainComponent().aboutData());
#ifndef EMSCRIPTEN
  d->m_process = 0;
#endif
  QWidget * parent = new QWidget(this);
  d->submitBugWeb = false;

  if ( d->m_aboutData->bugAddress() == QLatin1String("*****@*****.**") )
  {
    // This is a core KDE application -> redirect to the web form
    d->submitBugWeb = true;
    setButtonGuiItem( Cancel, KStandardGuiItem::close() );
  }

  QLabel * tmpLabel;
  QVBoxLayout * lay = new QVBoxLayout( parent);

  KTitleWidget *title = new KTitleWidget( this );
  title->setText(i18n( "Submit Bug Report" ) );
  title->setPixmap( KIcon( "tools-report-bug" ).pixmap( 32 ) );
  lay->addWidget( title );

  QGridLayout *glay = new QGridLayout();
  lay->addLayout(glay);

  int row = 0;

  if ( !d->submitBugWeb )
  {
    // From
    QString qwtstr = i18n( "Your email address. If incorrect, use the Configure Email button to change it" );
    tmpLabel = new QLabel( i18nc("Email sender address", "From:"), parent );
    glay->addWidget( tmpLabel, row,0 );
    tmpLabel->setWhatsThis(qwtstr );
    d->m_from = new QLabel( parent );
    glay->addWidget( d->m_from, row, 1 );
    d->m_from->setWhatsThis(qwtstr );


    // Configure email button
    d->m_configureEmail = new QPushButton( i18n("Configure Email..."),
                                        parent );
    connect( d->m_configureEmail, SIGNAL(clicked()), this,
             SLOT(_k_slotConfigureEmail()) );
    glay->addWidget( d->m_configureEmail, 0, 2, 3, 1, Qt::AlignTop|Qt::AlignRight );

    // To
    qwtstr = i18n( "The email address this bug report is sent to." );
    tmpLabel = new QLabel( i18nc("Email receiver address", "To:"), parent );
    glay->addWidget( tmpLabel, ++row,0 );
    tmpLabel->setWhatsThis(qwtstr );
    tmpLabel = new QLabel( d->m_aboutData->bugAddress(), parent );
    tmpLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
    glay->addWidget( tmpLabel, row, 1 );
    tmpLabel->setWhatsThis(qwtstr );

    setButtonGuiItem( Ok,  KGuiItem( i18n("&Send"), "mail-send", i18n( "Send bug report." ),
                    i18n( "Send this bug report to %1." ,  d->m_aboutData->bugAddress() ) ) );
    row++;
  }
  else
  {
    d->m_configureEmail = 0;
    d->m_from = 0;
  }

  // Program name
  QString qwtstr = i18n( "The application for which you wish to submit a bug report - if incorrect, please use the Report Bug menu item of the correct application" );
  tmpLabel = new QLabel( i18n("Application: "), parent );
  glay->addWidget( tmpLabel, row, 0 );
  tmpLabel->setWhatsThis(qwtstr );
  d->appcombo = new KComboBox( false, parent );
  d->appcombo->setWhatsThis(qwtstr );
  QStringList packageList;
  for (int c = 0; packages[c]; ++c)
    packageList << QString::fromLatin1(packages[c]);
  d->appcombo->addItems(packageList);
  connect(d->appcombo, SIGNAL(activated(int)), SLOT(_k_appChanged(int)));
  d->appname = d->m_aboutData
                                    ? d->m_aboutData->productName()
                                    : qApp->applicationName() ;
  glay->addWidget( d->appcombo, row, 1 );
  int index = 0;
  for (; index < d->appcombo->count(); index++) {
      if (d->appcombo->itemText(index) == d->appname) {
          break;
      }
  }
  if (index == d->appcombo->count()) { // not present
      d->appcombo->addItem(d->appname);
  }
  d->appcombo->setCurrentIndex(index);

  tmpLabel->setWhatsThis(qwtstr );

  // Version
  qwtstr = i18n( "The version of this application - please make sure that no newer version is available before sending a bug report" );
  tmpLabel = new QLabel( i18n("Version:"), parent );
  glay->addWidget( tmpLabel, ++row, 0 );
  tmpLabel->setWhatsThis(qwtstr );
  if (d->m_aboutData)
      d->m_strVersion = d->m_aboutData->version();
  else
      d->m_strVersion = i18n("no version set (programmer error)");
  d->kde_version = QString::fromLatin1( KDE_VERSION_STRING );
  d->kde_version += ", " + QString::fromLatin1( KDE_DISTRIBUTION_TEXT );
  if ( !d->submitBugWeb )
      d->m_strVersion += ' ' + d->kde_version;
  d->m_version = new QLabel( d->m_strVersion, parent );
  d->m_version->setTextInteractionFlags(Qt::TextBrowserInteraction);
  //glay->addWidget( d->m_version, row, 1 );
  glay->addWidget( d->m_version, row, 1, 1, 2 );
  d->m_version->setWhatsThis(qwtstr );

  tmpLabel = new QLabel(i18n("OS:"), parent);
  glay->addWidget( tmpLabel, ++row, 0 );

  struct utsname unameBuf;
  uname( &unameBuf );
  d->os = QString::fromLatin1( unameBuf.sysname ) +
          " (" + QString::fromLatin1( unameBuf.machine ) + ") "
          "release " + QString::fromLatin1( unameBuf.release );

  tmpLabel = new QLabel(d->os, parent);
  tmpLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
  glay->addWidget( tmpLabel, row, 1, 1, 2 );

  tmpLabel = new QLabel(i18n("Compiler:"), parent);
  glay->addWidget( tmpLabel, ++row, 0 );
  tmpLabel = new QLabel(QString::fromLatin1(KDE_COMPILER_VERSION), parent);
  tmpLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
  glay->addWidget( tmpLabel, row, 1, 1, 2 );

  if ( !d->submitBugWeb )
  {
    // Severity
    d->m_bgSeverity = new QGroupBox( i18n("Se&verity"), parent );
    static const char * const sevNames[5] = { "critical", "grave", "normal", "wishlist", "i18n" };
    const QString sevTexts[5] = { i18n("Critical"), i18n("Grave"), i18nc("normal severity","Normal"), i18n("Wishlist"), i18n("Translation") };
    QHBoxLayout *severityLayout=new QHBoxLayout(d->m_bgSeverity);
    for (int i = 0 ; i < 5 ; i++ )
    {
      // Store the severity string as the name
      QRadioButton *rb = new QRadioButton( sevTexts[i], d->m_bgSeverity);
      rb->setObjectName(sevNames[i] );
      d->severityButtons.append(rb);
      severityLayout->addWidget(rb);
      if (i==2) rb->setChecked(true); // default : "normal"
    }

    lay->addWidget( d->m_bgSeverity );

    // Subject
    QHBoxLayout * hlay = new QHBoxLayout();
    lay->addItem(hlay);
    tmpLabel = new QLabel( i18n("S&ubject: "), parent );
    hlay->addWidget( tmpLabel );
    d->m_subject = new KLineEdit( parent );
    d->m_subject->setClearButtonShown(true);
    d->m_subject->setFocus();
    tmpLabel->setBuddy( d->m_subject );
    hlay->addWidget( d->m_subject );

    QString text = i18n("Enter the text (in English if possible) that you wish to submit for the "
                        "bug report.\n"
                        "If you press \"Send\", a mail message will be sent to the maintainer of "
                        "this program.\n");
    QLabel * label = new QLabel( parent);

    label->setText( text );
    lay->addWidget( label );

    // The multiline-edit
    d->m_lineedit = new KTextEdit( parent);
    d->m_lineedit->setMinimumHeight( 180 ); // make it big
    d->m_lineedit->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
    d->m_lineedit->setLineWrapMode(QTextEdit::WidgetWidth);
    d->m_lineedit->setCheckSpellingEnabled(true);
    d->m_lineedit->setSpellCheckingLanguage("en");
    lay->addWidget( d->m_lineedit, 10 /*stretch*/ );

    d->_k_slotSetFrom();
  } else {
    // Point to the web form

    lay->addSpacing(10);
    QString text = i18n("<qt>To submit a bug report, click on the button below. This will open a web browser "
                        "window on <a href=\"http://bugs.kde.org\">http://bugs.kde.org</a> where you will find "
                        "a form to fill in. The information displayed above will be transferred to that server.</qt>");
    QLabel * label = new QLabel( text, parent);
    label->setOpenExternalLinks( true );
    label->setTextInteractionFlags( Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard );
    label->setWordWrap( true );
    lay->addWidget( label );
    lay->addSpacing(10);

    d->appcombo->setFocus();

    d->_k_updateUrl();

    setButtonText(Ok, i18n("&Launch Bug Report Wizard"));
    setButtonIcon(Ok, KIcon("tools-report-bug"));
  }
  parent->setMinimumHeight( parent->sizeHint().height() + 20 ); // WORKAROUND: prevent "cropped" kcombobox
  setMainWidget(parent);
}
FloatPairControl::FloatPairControl(const std::string& name, float* pairedValue1, float* pairedValue2, float min, float max, std::string label,
			 unsigned int flags) : Control(name, label), m_minimum1(min), m_maximum1(max), m_minimum2(min), m_maximum2(max)
{
	QWidget* mainWidget = new QWidget();
	mainWidget->setMinimumHeight(26);

	QHBoxLayout* layout = new QHBoxLayout(mainWidget);
	mainWidget->setLayout(layout);
	layout->setSpacing(1);
	layout->setMargin(0);
//	layout->setContentsMargins(0, 0, 0, 0);

	m_doubleSpin1 = new DoubleSpinBoxEx();

	m_doubleSpin1->setMinimumSize(70, 22);

	m_doubleSpin1->setMinimum(min);
	m_doubleSpin1->setMaximum(max);

	m_doubleSpin1->setValue(*pairedValue1);

	m_doubleSpin2 = new DoubleSpinBoxEx();

//	m_doubleSpin1->setMi
	m_doubleSpin2->setMinimumSize(70, 22);

	m_doubleSpin2->setMinimum(min);
	m_doubleSpin2->setMaximum(max);

	m_doubleSpin2->setValue(*pairedValue2);

	layout->addWidget(m_doubleSpin1);

	if (flags & eParameterScrubButton || flags & eParameterScrubButtonFine)
	{
		m_delta = 0.1f;
		if (flags & eParameterScrubButtonFine)
			m_delta = 0.01f;

		ScrubButton* pScrubButton1 = new ScrubButton();
		ScrubButton* pScrubButton2 = new ScrubButton();

		layout->addSpacing(5);
		layout->addWidget(pScrubButton1);
		layout->addSpacerItem(new QSpacerItem(10, 0));
		layout->addWidget(m_doubleSpin2);
		layout->addSpacing(5);
		layout->addWidget(pScrubButton2);

		m_pConnectionProxy->registerDeltaChange(pScrubButton1, 0);
		m_pConnectionProxy->registerDeltaChange(pScrubButton2, 1);
	}
	else
	{
		layout->addSpacing(5);
		layout->addWidget(m_doubleSpin2);
	}

	m_widget = mainWidget;

	m_pairedValue1 = pairedValue1;
	m_pairedValue2 = pairedValue2;

	m_lastValue1 = *pairedValue1;
	m_lastValue2 = *pairedValue2;

	m_pConnectionProxy->registerValueChangedDouble(m_doubleSpin1);
	m_pConnectionProxy->registerValueChangedDouble(m_doubleSpin2);
}
Example #19
0
	QWidget *FilterWidget::getAttrWidget( Attr *a, QWidget *parent )
	{
		QWidget *w = 0;
		switch( a->getType() )
		{
			case Attr::Int:
				w = new QSpinBox(parent);
				((QSpinBox*)w)->setMinimum( -2147483647 );
				((QSpinBox*)w)->setMaximum( 2147483647 );
				((QSpinBox*)w)->setSingleStep( 1 );
				((QSpinBox*)w)->setReadOnly ( a->isReadOnly() );
				break;
			case Attr::Double:
				w = new QDoubleSpinBox(parent);
				w->setMinimumHeight( 20 );
				break;
			case Attr::String:
			case Attr::LTree:
				w = new QLineEdit(parent);
				w->setMinimumHeight( 20 );
				break;
			case Attr::Password:
				w = new QLineEdit(parent);
				((QLineEdit*)w)->setEchoMode( QLineEdit::Password );
				w->setMinimumHeight( 20 );
				break;
			case Attr::Email: // FIXME: NEED VALIDATOR FOR EMAIL!
				w = new QLineEdit(parent);
				w->setMinimumHeight( 20 );
				break;
			case Attr::Bool:
				w = new QCheckBox(parent);
				w->setMinimumHeight( 20 );
				break;
			case Attr::Date:
				w = new QDateEdit(QDate(), parent);
				((QDateEdit*)w)->setCalendarPopup ( true );
				w->setMinimumHeight( 20 );
				break;
			case Attr::Time:
				w = new QTimeEdit(QTime(), parent);
				w->setMinimumHeight( 20 );
				break;
			case Attr::DateTime:
				w = new QDateTimeEdit(QDateTime(), parent);
				((QDateTimeEdit*)w)->setCalendarPopup( true );
				w->setMinimumHeight( 20 );
				break;
			case Attr::ObjectRef: {
				w = new ObjectSelector(a, keeper, this);
				((ObjectSelector*)w)->setParentWidget(parentWidget);
				w->setMinimumHeight( a->isArray() ? 100 : 20 );
				break;
			}
			default:
				w = new QLabel( QString("not implemented editor for: %1").
						arg( a->getType() ), parent);
				break;
		}
		return w;
	}
Example #20
0
TreeArea::TreeArea(QWidget *parent): QWidget(parent)
{
    this->setMinimumWidth(250);
    this->setMaximumWidth(250);

    // sorts Tree
    this->sortsTree = new QTreeWidget(this);
    this->sortsTree->setContextMenuPolicy(Qt::CustomContextMenu);
    this->sortsTree->setHeaderLabel("Sorts");
    this->sortsTree->setSelectionMode(QAbstractItemView::MultiSelection);
    QPalette p = this->sortsTree->palette();
    p.setColor(QPalette::Base, QColor(207, 226, 243));
    this->sortsTree->setPalette(p);

    // search field
    QWidget *search = new QWidget(this);
    search->setMinimumWidth(250);
    search->setMaximumWidth(250);
    search->setMinimumHeight(50);
    search->setMaximumHeight(50);
    this->searchBox = new QLineEdit(search);
    this->searchBox->setAlignment(Qt::AlignLeft);
    this->searchBox->setMinimumWidth(125);
    this->searchBox->setMaximumWidth(125);
    this->searchBox->setMinimumHeight(30);
    this->searchBox->setMaximumHeight(30);
    this->searchButton = new QPushButton("Search", search);
    this->searchButton->setMinimumWidth(60);
    this->searchButton->setMaximumWidth(60);
    this->searchButton->setMinimumHeight(30);
    this->searchButton->setMaximumHeight(30);
    this->cancelSearchButton = new QPushButton("X", search);
    this->cancelSearchButton->setMinimumWidth(20);
    this->cancelSearchButton->setMaximumWidth(20);
    this->cancelSearchButton->setMinimumHeight(30);
    this->cancelSearchButton->setMaximumHeight(30);

    QHBoxLayout *layoutsearch = new QHBoxLayout;
    layoutsearch->addWidget(this->searchBox);
    layoutsearch->addWidget(this->searchButton);
    layoutsearch->addWidget(this->cancelSearchButton);
    search->setLayout(layoutsearch);

    // widget containing the button to add a sort to a group
    QWidget *sortsToGroup = new QWidget(this);
    sortsToGroup->setMinimumWidth(250);
    sortsToGroup->setMaximumWidth(250);
    sortsToGroup->setMinimumHeight(50);
    sortsToGroup->setMaximumHeight(50);
    this->addToGroupButton = new QPushButton("Add to", sortsToGroup);
    this->addToGroupButton->setMinimumWidth(220);
    this->addToGroupButton->setMaximumWidth(220);
    this->addToGroupButton->setMinimumHeight(30);
    this->addToGroupButton->setMaximumHeight(30);

    QHBoxLayout *layoutSortsToGroup = new QHBoxLayout;
    layoutSortsToGroup->addWidget(this->addToGroupButton);
    sortsToGroup->setLayout(layoutSortsToGroup);

    QWidget *group = new QWidget(this);
    group->setMinimumWidth(250);
    group->setMaximumWidth(250);
    group->setMinimumHeight(50);
    group->setMaximumHeight(50);
    this->addGroupButton = new QPushButton("Add group", group);
    this->addGroupButton->setMinimumWidth(100);
    this->addGroupButton->setMaximumWidth(100);
    this->addGroupButton->setMinimumHeight(30);
    this->addGroupButton->setMaximumHeight(30);
    this->removeGroupButton = new QPushButton("Remove", group);
    this->removeGroupButton->setMinimumWidth(110);
    this->removeGroupButton->setMaximumWidth(110);
    this->removeGroupButton->setMinimumHeight(30);
    this->removeGroupButton->setMaximumHeight(30);

    QHBoxLayout *layoutGroup = new QHBoxLayout;
    layoutGroup->addWidget(this->addGroupButton);
    layoutGroup->addWidget(this->removeGroupButton);
    group->setLayout(layoutGroup);

    // groups Tree
    this->groupsTree = new QTreeWidget(this);
    this->groupsTree->setContextMenuPolicy(Qt::CustomContextMenu);
    this->groupsTree->setHeaderLabel("Groups");
    this->groupsTree->setSelectionMode(QAbstractItemView::SingleSelection);
    QPalette f = this->groupsTree->palette();
    f.setColor(QPalette::Base, QColor(207, 226, 243));
    this->groupsTree->setPalette(f);


    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(search);
    layout->addWidget(this->sortsTree);
    layout->addWidget(sortsToGroup);
    layout->addWidget(this->groupsTree);
    layout->addWidget(group);
    this->setLayout(layout);

    // palette of the groups tree
    this->palette = new QList<QColor>();
    this->palette->push_back(Qt::red);
    this->palette->push_back(Qt::yellow);
    this->palette->push_back(Qt::blue);
    this->palette->push_back(Qt::green);
    this->palette->push_back(Qt::cyan);
    this->palette->push_back(Qt::magenta);
    this->palette->push_back(Qt::gray);
    this->palette->push_back(Qt::darkRed);

    this->groupsPalette = new QMap<QTreeWidgetItem*, QColor>();

    // connect
    QObject::connect(this->searchButton, SIGNAL(clicked()), this, SLOT(searchSort()));
    QObject::connect(this->cancelSearchButton, SIGNAL(clicked()), this, SLOT(cancelSearch()));

    QObject::connect(this->addGroupButton, SIGNAL(clicked()), this, SLOT(addGroup()));
    QObject::connect(this->removeGroupButton, SIGNAL(clicked()), this, SLOT(remove()));
    QObject::connect(this->addToGroupButton, SIGNAL(clicked()), this, SLOT(addToGroup()));

    QObject::connect(this->sortsTree, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(sortsItemClicked(const QPoint&)));
    QObject::connect(this->groupsTree, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(groupsItemClicked(const QPoint&)));

}
/******************************************************************************
* Return the minimum size for the dialog.
* If the minimum size would be too high to fit the desktop, the tab contents
* are made scrollable.
*/
QSize StackedScrollGroup::adjustSize(bool force)
{
    if (force)
        mSized = false;
    if (mSized)
        return QSize();

    // Cancel any previous minimum height and set the height of the
    // scroll widget contents widgets.
    mMinHeight = -1;
    mHeightReduction = 0;
    QSize s = maxMinimumSizeHint();
    if (s.isEmpty())
        return QSize();
    int maxTabHeight = s.height();
    for (int i = 0, count = mWidgets.count();  i < count;  ++i)
    {
        mWidgets[i]->setMinimumHeight(maxTabHeight);
        QWidget* w = static_cast<StackedScrollWidget*>(mWidgets[i])->widget();
        if (w)
            w->resize(s);
    }
    for (QWidget* w = mWidgets[0]->parentWidget();  w && w != mDialog;  w = w->parentWidget())
    {
        w->setMinimumHeight(0);
        w->adjustSize();
    }
    mDialog->setMinimumHeight(0);

    int decoration = mDialog->frameGeometry().height() - mDialog->geometry().height();
    if (!decoration)
    {
        // On X11 at least, the window decoration height may not be
        // available, so use a guess of 25 pixels.
        decoration = 25;
    }
    int desk = KAlarm::desktopWorkArea().height();
    // There is no stored size, or the deferral group is visible.
    // Allow the tab contents to be scrolled vertically if that is necessary
    // to avoid the dialog exceeding the screen height.
    QSize dlgsize = mDialog->KDialog::minimumSizeHint();
    int y = dlgsize.height() + decoration - desk;
    if (y > 0)
    {
        mHeightReduction = y;
        mMinHeight = maxTabHeight - y;
        kDebug() << "Scrolling: max tab height=" << maxTabHeight << ", reduction=" << mHeightReduction << "-> min tab height=" << mMinHeight;
        if (mMinHeight > 0)
        {
            for (int i = 0, count = mWidgets.count();  i < count;  ++i)
            {
                mWidgets[i]->setMinimumHeight(mMinHeight);
                mWidgets[i]->resize(QSize(mWidgets[i]->width(), mMinHeight));
            }
        }
        mSized = true;
        QSize s = mWidgets[0]->parentWidget()->sizeHint();
        if (s.height() < mMinHeight)
            s.setHeight(mMinHeight);
        mWidgets[0]->parentWidget()->resize(s);
        for (QWidget* w = mWidgets[0]->parentWidget();  w && w != mDialog;  w = w->parentWidget())
            w->setMinimumHeight(qMin(w->minimumSizeHint().height(), w->sizeHint().height()));
        dlgsize.setHeight(dlgsize.height() - mHeightReduction);
        s = mDialog->KDialog::minimumSizeHint();
        if (s.height() > dlgsize.height())
            dlgsize.setHeight(s.height());
        mDialog->setMinimumHeight(dlgsize.height());
    }
    mSized = true;
    mDialog->resize(dlgsize);
    return s;
}
Example #22
0
RImageDock::RImageDock(OGLWidget* newOGLWidget, QWidget *parent)
    :QWidget(parent)
{
    widgetTitle = QString("");
    frameIndex = 0;
    this->oglWidget = newOGLWidget;

    matImage = newOGLWidget->matImageListRGB.at(frameIndex);
    naxis1 = matImage.cols;
    naxis2 = matImage.rows;
    bscale = newOGLWidget->rMatImageList.at(0).getBscale();


    qDebug() << "RImageDock::matImage.channels()" << matImage.channels();
    // Convert to gray before getting the Max and Min

    cvtColor(matImage, matImageGray, CV_RGB2GRAY);
    dataMin = 0;
    dataMax = 0;
    cv::minMaxLoc(matImageGray, &dataMin, &dataMax);
    dataRange = dataMax - dataMin;

    qDebug() << "rImageDock::dataMin =" << dataMin;
    qDebug() << "rImageDock::dataMax =" << dataMax;


    gamma = 1;

    // String number format parameters
    if (dataRange < 0.1)
    {
        format = 'g';
        precision = 2;
    }
    else if (dataRange < 10)
    {
        format = 'f';
        precision = 3;
    }
    else
    {
        format = 'f';
        precision = 0;
    }

    newMin = dataMin;
    newMax = dataMax;


    // Set the slider steps
    // We need to differiente between scientific calibrated data values and
    // uncalibrated, unphysical values scaled only within [0-65535]
    // We know this from the bscale values.
    // We deal typically with uncalibrated 8 bits [0-256], 16 bits [0=65535]
    // or calibrated 32 bits data, whose unit will depend on bscale.

    // if bscale = 1, we stick to a 16 bits range. This includes the 8-bits case (maybe this will change)
    colorRange = 65536.0f;
    sliderMin = 1;
    sliderMax = sliderMin + colorRange -1;

    if (bscale == 1)
    {

        sliderScaleStep = 1.0f;
        qDebug() << "rImageDock:: sliderScaleStep =" << sliderScaleStep;

        // Set initial constrast stretching factors
        alpha = 1.0f / colorRange;
        beta = 0.0f;
    }
    else // Stretch the data into their physical range at 16-bits precision.
    {

        sliderScaleStep = dataRange/colorRange;

        // Set initial constrast stretching factors
        alpha = (float) (1.0f / dataRange);
        beta = (float) (-newMin / dataRange);
    }

    oglWidget->setAlpha(alpha);
    oglWidget->setBeta(beta);

    // Create the Sliders and Layout of the dock widget.

    //QLabels setup
    QLabel  *labelHigh = new QLabel("High");
    QLabel  *labelLow = new QLabel("Low");
    QLabel  *labelGamma = new QLabel("Gamma");

    //QSliders setup
    sliderHigh = new QSlider(Qt::Horizontal);
    sliderLow = new QSlider(Qt::Horizontal);
    sliderGamma = new QSlider(Qt::Horizontal);


    float gammaRange = 40;
    maxGamma = 2.1;
    minGamma = 0.1;
    sliderGammaStep = (maxGamma - minGamma)/gammaRange;

    // set sliders range
    sliderHigh->setRange((int)sliderMin, (int)sliderMax);
    sliderHigh->setSingleStep(1);
    sliderLow->setRange((int)sliderMin, (int)sliderMax);
    sliderLow->setSingleStep(1);
    sliderGamma->setRange(1, (int) gammaRange);
    sliderLow->setSingleStep(1);

    // set sliders value
    sliderHigh->setValue(sliderMax);
    sliderLow->setValue(sliderMin);
    sliderGamma->setValue(convertGammaToSlider(QString::number(gamma)));

    //QLineEdit setup
    valueHighLineEdit = new QLineEdit(QString::number(dataMax, format, precision));
    valueLowLineEdit = new QLineEdit(QString::number(dataMin, format, precision));
    valueGammaLineEdit = new QLineEdit(QString::number(gamma));

    int editMinimumWidth = 20;
    int editMaximumWidth = 60;

    valueHighLineEdit->setMinimumWidth(editMinimumWidth);
    valueHighLineEdit->setMaximumWidth(editMaximumWidth);

    valueLowLineEdit->setMinimumWidth(editMinimumWidth);
    valueLowLineEdit->setMaximumWidth(editMaximumWidth);

    valueGammaLineEdit->setMinimumWidth(editMinimumWidth);
    valueGammaLineEdit->setMaximumWidth(editMaximumWidth);

    // QGridLayout setup
    QGridLayout *sliderLayout = new QGridLayout();

    // Add the labels
    sliderLayout->addWidget(labelHigh, 0, 0);
    sliderLayout->addWidget(labelLow, 1, 0);
    sliderLayout->addWidget(labelGamma, 2, 0);
    // Add the sliders
    sliderLayout->addWidget(sliderHigh, 0, 1);
    sliderLayout->addWidget(sliderLow, 1, 1);
    sliderLayout->addWidget(sliderGamma, 2, 1);
    // Add the line edits.
    sliderLayout->addWidget(valueHighLineEdit, 0, 2);
    sliderLayout->addWidget(valueLowLineEdit, 1, 2);
    sliderLayout->addWidget(valueGammaLineEdit, 2, 2);

    // Define the minimum spacing between sliders. This may need some adjusting.
    int vSpacing  = 0;
    int hSpacing = 10;


    //QMargins margins(10, 10, 5, 5);
    //sliderLayout->setContentsMargins(margins);
    sliderLayout->setVerticalSpacing(vSpacing);
    sliderLayout->setHorizontalSpacing(hSpacing);


    // Set the minimum column widths of the layout,
    int sliderWidth = 350;
    int lineEditWidth = 20;

    sliderLayout->setColumnMinimumWidth(1, sliderWidth);
    sliderLayout->setColumnMinimumWidth(2, lineEditWidth);
    sliderLayout->setMargin(0);

    QWidget *sliderWidget = new QWidget();
    sliderWidget->setLayout(sliderLayout);
    sliderWidget->setMinimumHeight(60);


    // Calibration type
    QWidget *calibrationTypeWidget = new QWidget();
    light = new QCheckBox(QString("Light"));
    bias = new QCheckBox(QString("Bias"));
    dark = new QCheckBox(QString("Dark"));
    flat = new QCheckBox(QString("Flat"));

    // Histrogram button
    QPushButton *histButton = new QPushButton("Histogram");

    QGridLayout *grid = new QGridLayout();
    grid->addWidget(light,0,0);
    grid->addWidget(bias,0,1);
    grid->addWidget(dark,1,0);
    grid->addWidget(flat,1,1);
    grid->addWidget(histButton, 2, 0, 1, 2);
    grid->setMargin(0);
    calibrationTypeWidget->setLayout(grid);
    calibrationTypeWidget->setMinimumHeight(60);

    QHBoxLayout *hBox = new QHBoxLayout();
    hBox->addWidget(sliderWidget);
    hBox->addWidget(calibrationTypeWidget);

    // Set the above layout in this QWidget
    setLayout(hBox);

    setMinimumWidth(600);
    //setMaximumWidth(800);
    setMaximumHeight(80);
    // Connect the change of the slider position with the QLineEdit
    QObject::connect(sliderHigh, SIGNAL(valueChanged(int)), this, SLOT(updateQLineEditSlot(int)));
    QObject::connect(sliderLow, SIGNAL(valueChanged(int)), this, SLOT(updateQLineEditSlot(int)));
    QObject::connect(sliderGamma, SIGNAL(valueChanged(int)), this, SLOT(updateQLineEditSlot(int)));

    QObject::connect(valueHighLineEdit, SIGNAL( returnPressed()), this, SLOT(setSliderValueSlot()));
    QObject::connect(valueLowLineEdit, SIGNAL( returnPressed()), this, SLOT(setSliderValueSlot()));
    QObject::connect(valueGammaLineEdit, SIGNAL( returnPressed()), this, SLOT(setSliderValueSlot()));

    //Connect the slider value changed with the Image display.
    QObject::connect(sliderHigh, SIGNAL(valueChanged(int)), this, SLOT(scaleImageSlot(int)));
    QObject::connect(sliderLow, SIGNAL(valueChanged(int)), this, SLOT(scaleImageSlot(int)));
    QObject::connect(sliderGamma, SIGNAL(valueChanged(int)), this, SLOT(gammaScaleImageSlot(int)));

    QObject::connect(histButton, SIGNAL(released()), this, SLOT(drawHist()));

    // Connect mouse events with OGLWidget
    QObject::connect(newOGLWidget, SIGNAL(destroyed(QObject*)), this, SLOT(deleteLater()));

    qRegisterMetaType<QVector<int> >("QVector<int>");
    qRegisterMetaType<QVector<QString> >("QVector<QString>");

    // Get initial tatistics
    calcStats();
    autoScale();
}