예제 #1
0
QWidget* CombatWindow::initOffenseWidget()
{
	QWidget *pWidget = new QWidget(m_tab);

	m_layout_offense = new QVBoxLayout(pWidget);

	QGroupBox *listGBox = new QVGroupBox(pWidget);
	m_layout_offense->addWidget(listGBox);

	m_listview_offense = new SEQListView(preferenceName(), listGBox);
	m_listview_offense->addColumn("Type");
	m_listview_offense->setColumnAlignment(0, Qt::AlignRight);
	m_listview_offense->addColumn("Hit");
	m_listview_offense->setColumnAlignment(1, Qt::AlignRight);
	m_listview_offense->addColumn("Miss");
	m_listview_offense->setColumnAlignment(2, Qt::AlignRight);
	m_listview_offense->addColumn("Ratio");
	m_listview_offense->setColumnAlignment(3, Qt::AlignRight);
	m_listview_offense->addColumn("Avg");
	m_listview_offense->setColumnAlignment(4, Qt::AlignRight);
	m_listview_offense->addColumn("Min");
	m_listview_offense->setColumnAlignment(5, Qt::AlignRight);
	m_listview_offense->addColumn("Max");
	m_listview_offense->setColumnAlignment(6, Qt::AlignRight);
	m_listview_offense->addColumn("Total");
	m_listview_offense->setColumnAlignment(7, Qt::AlignRight);

	m_listview_offense->restoreColumns();

	m_listview_offense->setMinimumSize(m_listview_offense->sizeHint().width(), 200);

	QGroupBox *summaryGBox = new QVGroupBox("Summary", pWidget);
	m_layout_offense->addWidget(summaryGBox);

	QGrid *summaryGrid = new QGrid(4, summaryGBox);

	new QLabel("Total Damage:", summaryGrid);
	m_label_offense_totaldamage = new QLabel(summaryGrid);

	new QLabel("Avg Melee:", summaryGrid);
	m_label_offense_avgmelee = new QLabel(summaryGrid);

	new QLabel("% from Special:", summaryGrid);
	m_label_offense_percentspecial = new QLabel(summaryGrid);

	new QLabel("Avg Special:", summaryGrid);
	m_label_offense_avgspecial = new QLabel(summaryGrid);

	new QLabel("% from NonMelee:", summaryGrid);
	m_label_offense_percentnonmelee = new QLabel(summaryGrid);

	new QLabel("Avg NonMelee:", summaryGrid);
	m_label_offense_avgnonmelee = new QLabel(summaryGrid);

	((QGridLayout *)summaryGrid->layout())->setColStretch(1, 1);
	((QGridLayout *)summaryGrid->layout())->setColStretch(3, 1);
	summaryGrid->layout()->setSpacing(5);

	return pWidget;
}
예제 #2
0
void ApplicationWindow::addTabs()
{
	struct v4l2_queryctrl qctrl;
	unsigned ctrl_class;
	unsigned i;
	int id;

	memset(&qctrl, 0, sizeof(qctrl));
	qctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;
	while (::ioctl(fd, VIDIOC_QUERYCTRL, &qctrl) == 0) {
		if ((qctrl.flags & V4L2_CTRL_FLAG_DISABLED) == 0) {
			ctrlMap[qctrl.id] = qctrl;
			if (qctrl.type != V4L2_CTRL_TYPE_CTRL_CLASS)
				classMap[V4L2_CTRL_ID2CLASS(qctrl.id)].push_back(qctrl.id);
		}
		qctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;
	}
	if (qctrl.id == V4L2_CTRL_FLAG_NEXT_CTRL) {
		strcpy((char *)qctrl.name, "User Controls");
		qctrl.id = V4L2_CTRL_CLASS_USER | 1;
		qctrl.type = V4L2_CTRL_TYPE_CTRL_CLASS;
		ctrlMap[qctrl.id] = qctrl;
		for (id = V4L2_CID_USER_BASE; id < V4L2_CID_LASTP1; id++) {
			qctrl.id = id;
			if (::ioctl(fd, VIDIOC_QUERYCTRL, &qctrl))
				continue;
			if (qctrl.flags & V4L2_CTRL_FLAG_DISABLED)
				continue;
			ctrlMap[qctrl.id] = qctrl;
			classMap[V4L2_CTRL_CLASS_USER].push_back(qctrl.id);
		}
		for (qctrl.id = V4L2_CID_PRIVATE_BASE;
				::ioctl(fd, VIDIOC_QUERYCTRL, &qctrl) == 0; qctrl.id++) {
			if (qctrl.flags & V4L2_CTRL_FLAG_DISABLED)
				continue;
			ctrlMap[qctrl.id] = qctrl;
			classMap[V4L2_CTRL_CLASS_USER].push_back(qctrl.id);
		}
	}

	for (ClassMap::iterator iter = classMap.begin(); iter != classMap.end(); ++iter) {
		ctrl_class = V4L2_CTRL_ID2CLASS(iter->second[0]);
		id = ctrl_class | 1;
		const struct v4l2_queryctrl &qctrl = ctrlMap[id];
		QVBox *vbox = new QVBox(tabs);
		QGrid *grid = new QGrid(4, vbox);
		grid->setSpacing(3);
		tabs->addTab(vbox, (char *)qctrl.name);
		for (i = 0; i < iter->second.size(); i++) {
			if (i & 1)
				id = iter->second[(1+iter->second.size()) / 2 + i / 2];
			else
				id = iter->second[i / 2];
			addCtrl(grid, ctrlMap[id]);
		}
		finishGrid(vbox, grid, ctrl_class, i & 1);
	}
}
예제 #3
0
int main( int argc, char **argv )
{
    QApplication app( argc, argv );

    QFile xmlFile( argc == 2 ? argv[1] : "fnord.xml" );
    QXmlInputSource source( &xmlFile );

    QXmlSimpleReader reader;

    QGrid * container = new QGrid( 3 );

    QListView * nameSpace = new QListView( container, "table_namespace" );
    StructureParser * handler = new StructureParser( nameSpace );
    reader.setContentHandler( handler );
    reader.parse( source );

    QListView * namespacePrefix = new QListView( container,
                                                 "table_namespace_prefix" );
    handler->setListView( namespacePrefix );
    reader.setFeature( "http://xml.org/sax/features/namespace-prefixes",
                       TRUE );
    source.reset();
    reader.parse( source );

    QListView * prefix = new QListView( container, "table_prefix");
    handler->setListView( prefix );
    reader.setFeature( "http://xml.org/sax/features/namespaces", FALSE );
    source.reset();
    reader.parse( source );

    // namespace label
    (void) new QLabel(
             "Default:\n"
             "http://xml.org/sax/features/namespaces: TRUE\n"
             "http://xml.org/sax/features/namespace-prefixes: FALSE\n",
             container );

    // namespace prefix label
    (void) new QLabel(
             "\n"
             "http://xml.org/sax/features/namespaces: TRUE\n"
             "http://xml.org/sax/features/namespace-prefixes: TRUE\n",
             container );

    // prefix label
    (void) new QLabel(
             "\n"
             "http://xml.org/sax/features/namespaces: FALSE\n"
             "http://xml.org/sax/features/namespace-prefixes: TRUE\n",
             container );


    app.setMainWidget( container );
    container->show();
    return app.exec();
}
예제 #4
0
QWidget* CombatWindow::initMobWidget()
{
	QWidget *pWidget = new QWidget(m_tab);

	m_layout_mob = new QVBoxLayout(pWidget);

	QGroupBox *listGBox = new QVGroupBox(pWidget);
	m_layout_mob->addWidget(listGBox);

	m_listview_mob = new SEQListView(preferenceName(), listGBox);
	m_listview_mob->addColumn("Time");
	m_listview_mob->setColumnAlignment(0, Qt::AlignRight);
	m_listview_mob->addColumn("Name");
	m_listview_mob->setColumnAlignment(1, Qt::AlignRight);
	m_listview_mob->addColumn("ID");
	m_listview_mob->setColumnAlignment(2, Qt::AlignRight);
	m_listview_mob->addColumn("Duration");
	m_listview_mob->setColumnAlignment(3, Qt::AlignRight);
	m_listview_mob->addColumn("Damage Given");
	m_listview_mob->setColumnAlignment(4, Qt::AlignRight);
	m_listview_mob->addColumn("DPS");
	m_listview_mob->setColumnAlignment(5, Qt::AlignRight);
	m_listview_mob->addColumn("Damage Taken");
	m_listview_mob->setColumnAlignment(6, Qt::AlignRight);
	m_listview_mob->addColumn("MOB DPS");
	m_listview_mob->setColumnAlignment(7, Qt::AlignRight);

	m_listview_mob->restoreColumns();

	m_listview_mob->setMinimumSize(m_listview_mob->sizeHint().width(), 200);

	QGroupBox *summaryGBox = new QVGroupBox("Summary", pWidget);
	m_layout_mob->addWidget(summaryGBox);

	QGrid *summaryGrid = new QGrid(4, summaryGBox);

	new QLabel("Total Mobs", summaryGrid);
	m_label_mob_totalmobs = new QLabel(summaryGrid);

	new QLabel("Avg DPS:", summaryGrid);
	m_label_mob_avgdps = new QLabel(summaryGrid);

	new QLabel("Current DPS:", summaryGrid);
	m_label_mob_currentdps = new QLabel(summaryGrid);

	new QLabel("Last DPS:", summaryGrid);
	m_label_mob_lastdps = new QLabel(summaryGrid);

	((QGridLayout *)summaryGrid->layout())->setColStretch(1, 1);
	((QGridLayout *)summaryGrid->layout())->setColStretch(3, 1);
	summaryGrid->layout()->setSpacing(5);


	return pWidget;
}
예제 #5
0
//--------------------------------------------------------------------------------
RepeatRangeWindow::RepeatRangeWindow( QWidget* parent, const char* name )
  : QVBox( parent, name ? name : "RepeatRangeWindow" )
{
  setSpacing( 6 );

  _group = new QVButtonGroup( i18n("Times to Match"), this, "groupbox" );

  // Any number of times
  QRadioButton* radioBut = new QRadioButton(i18n("Any number of times (including zero times)"),
                                            _group,
                                            "RepeatRangeWindow::choice any times");

  _group->insert(radioBut, ANY);

  QWidget* container = new QWidget( _group );
  QHBoxLayout* lay = new QHBoxLayout( container );
  QGrid* grid = new QGrid( 3, container );
  grid->setSpacing( 5 );

  lay->addWidget( grid );
  lay->addStretch( 1 );

  createLine( grid, i18n( "At least" ), &_leastTimes, ATLEAST );
  createLine( grid, i18n( "At most" ), &_mostTimes, ATMOST );
  createLine( grid, i18n( "Exactly" ), &_exactlyTimes, EXACTLY );

  // from ___ to ___ times
  radioBut = new QRadioButton(i18n( "From" ), grid, "RepeatRangeWindow::from");
  _group->insert( radioBut, MINMAX );

  _rangeFrom = new QSpinBox( 1, 999, 1, grid);

  QHBox* box = new QHBox( grid );
  box->setSpacing( 5 );

  (void) new QLabel(i18n( "to" ), box);
  _rangeTo = new QSpinBox( 1, 999, 1, box );
  (void) new QLabel( i18n( "time(s)" ), box );

  connect( _rangeFrom, SIGNAL( valueChanged( int ) ), this, SLOT( slotUpdateMaxVal( int ) ) );
  connect( _rangeTo, SIGNAL( valueChanged( int ) ), this, SLOT( slotUpdateMinVal( int ) ) );

  // set a default button.
  _group->setButton(ANY);
  slotItemChange( ANY );


  connect( _group, SIGNAL( clicked( int ) ), this, SLOT( slotItemChange( int ) ) );
}
ImageTextEditor::ImageTextEditor( QImage& i, QWidget *parent, const char *name, WFlags f ) :
    QDialog(parent,name,TRUE,f),
    image(i)
{
    QVBoxLayout* vbox = new QVBoxLayout(this,8);
    vbox->setAutoAdd(TRUE);

    QGrid* controls = new QGrid(3,QGrid::Horizontal,this);
    controls->setSpacing(8);
    QLabel* l;
    l=new QLabel("Language",controls); l->setAlignment(AlignCenter);
    l=new QLabel("Key",controls); l->setAlignment(AlignCenter);
    (void)new QLabel("",controls); // dummy
    languages = new QComboBox(controls);
    keys = new QComboBox(controls);
    QPushButton* remove = new QPushButton("Remove",controls);

    newlang = new QLineEdit(controls);
    newkey = new QLineEdit(controls);
    QPushButton* add = new QPushButton("Add",controls);

    text = new QMultiLineEdit(this);

    QHBox* hbox = new QHBox(this);
    QPushButton* cancel = new QPushButton("Cancel",hbox);
    QPushButton* ok = new QPushButton("OK",hbox);

    connect(add,SIGNAL(clicked()),
	this,SLOT(addText()));

    connect(remove,SIGNAL(clicked()),
	this,SLOT(removeText()));

    connect(ok,SIGNAL(clicked()),
	this,SLOT(accept()));

    connect(cancel,SIGNAL(clicked()),
	this,SLOT(reject()));

    connect(languages,SIGNAL(activated(int)),
	this,SLOT(updateText()));

    connect(keys,SIGNAL(activated(int)),
	this,SLOT(updateText()));

    imageChanged();
}
예제 #7
0
AppearanceConfig::AppearanceConfig()
    : QWidget(0, "appearance_config_widget")
{
    QVBoxLayout *top = new QVBoxLayout(this, KDialog::spacingHint());

    QHBoxLayout *hbox = new QHBoxLayout(top);
    QGrid *grid = new QGrid(2, this);
    grid->setSpacing(KDialog::spacingHint());
    hbox->addWidget(grid);
    for (uint i=0; i<Settings::EnumType::COUNT; i++) {
        (void)new QLabel(i18n(COLOR_LABELS[i]), grid);
        KColorButton *cb = new KColorButton(grid, COLOR_CONFIG_NAMES[i]);
        cb->setFixedWidth(100);
    }
    for (uint i=0; i<NB_N_COLORS; i++) {
        (void)new QLabel(i18n("%n mine color:", "%n mines color:", i+1), grid);
        KColorButton *cb = new KColorButton(grid, N_COLOR_CONFIG_NAMES[i]);
        cb->setFixedWidth(100);
    }
    hbox->addStretch(1);

    top->addStretch(1);
}
예제 #8
0
GameConfig::GameConfig()
    : QWidget(0, "game_config_widget"), _magicDialogEnabled(false)
{
    QVBoxLayout *top = new QVBoxLayout(this, KDialog::spacingHint());

    QCheckBox *cb = new QCheckBox(i18n("Enable ? mark"), this, "kcfg_UncertainMark");
    top->addWidget(cb);

    cb = new QCheckBox(i18n("Enable keyboard"), this, "kcfg_KeyboardGame");
    top->addWidget(cb);

    cb = new QCheckBox(i18n("Pause if window loses focus"), this, "kcfg_PauseFocus");
    top->addWidget(cb);

    cb = new QCheckBox(i18n("\"Magic\" reveal"), this, "kcfg_MagicReveal");
    QWhatsThis::add(cb, i18n("Set flags and reveal squares where they are trivial."));
    connect(cb, SIGNAL(toggled(bool)), SLOT(magicModified(bool)));
    top->addWidget(cb);

    top->addSpacing(2 * KDialog::spacingHint());

    QHBoxLayout *hbox = new QHBoxLayout(top);
    QVGroupBox *gb = new QVGroupBox(i18n("Mouse Bindings"), this);
    hbox->addWidget(gb);
    QGrid *grid = new QGrid(2, gb);
    grid->setSpacing(KDialog::spacingHint());
    for (uint i=0; i< Settings::EnumButton::COUNT; i++) {
        (void)new QLabel(i18n(MOUSE_BUTTON_LABELS[i]), grid);
        QComboBox *cb = new QComboBox(false, grid, MOUSE_CONFIG_NAMES[i]);
        for (uint k=0; k< (Settings::EnumMouseAction::COUNT-1); k++)
            cb->insertItem(i18n(MOUSE_ACTION_LABELS[k]));
        cb->setCurrentItem(i);
    }
    hbox->addStretch(1);

    top->addStretch(1);
}
예제 #9
0
파일: main.cpp 프로젝트: xufango/contrib_bk
    MainWindow(ResourceFinder *rf)
    {

        //if (VERBOSE) fprintf(stderr, "Passing RF by address ...");
        resFind = rf;
        //if (VERBOSE) fprintf(stderr, "done \n");

        Property options;
        options.fromString(resFind->toString());

        Value &robot  = options.find("robot");
        Value &part   = options.find("part");
        Value &rows   = options.find("rows");
        Value &cols   = options.find("cols");

        if (!options.check("robot"))
            printf("Missing --robot option. Using icub.\n");
        if (!options.check("part"))
            printf("Missing --part option. Using head.\n");    
        if (!options.check("local"))
            printf("Missing --name option. Using /portScope/vector:i.\n");
        if (!options.check("remote"))
            printf("Missing --remote option. Will wait for the connection...\n");
        if (!options.check("rows"))
            printf("Missing --rows option. Disabling subplotting.\n");

        //if (VERBOSE) fprintf(stderr, "Start plotting the GUI\n");
        QToolBar *toolBar = new QToolBar(this);
        toolBar->setFixedHeight(80);
    
#if QT_VERSION < 0x040000
        setDockEnabled(TornOff, true);
        setRightJustification(true);
#else
        toolBar->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
#endif
        QWidget *hBox = new QWidget(toolBar);
        QLabel *label = new QLabel("Timer Interval", hBox);
        QwtCounter *counter = new QwtCounter(hBox);

        QLabel *labelActions = new QLabel("Actions", hBox);
        QPushButton *toggleAcquireButton = new QPushButton("stop", hBox, "stop");
        counter->setRange(-1.0, 1000.0, 1.0);
    
        QHBoxLayout *layout = new QHBoxLayout(hBox);
        layout->addWidget(label);
        layout->addWidget(counter);
        layout->addWidget(labelActions);
        layout->addWidget(toggleAcquireButton);
        layout->addWidget(new QWidget(hBox), 10); // spacer);
    
#if QT_VERSION >= 0x040000
        toolBar->addWidget(hBox);
#endif
        addToolBar(toolBar);
    
        if (options.check("rows"))
            nRows = rows.asInt();
        else
            nRows = 1;

        if (options.check("cols"))
            nCols = cols.asInt();
        else
            nCols = nRows;

        nPlots  = nRows*nCols;
        nPortInputsInPlots = new int[nPlots];
        QGrid *grid = new QGrid( nRows, Qt::Vertical,  this );
        
        plot = new DataPlot*[nPlots];
        setCentralWidget(grid);

        for( int r = 0 ; r < nRows ; r++ )
            {
                for( int c = 0 ; c < nCols ; c++ )
                    {	  
                        char rcS[256];
                        sprintf(rcS, "%d%d", r, c);
                        ConstString rS(rcS);
                        ConstString local;
                        local = resFind->find("local").toString();
                        //local port name
                        local = local + rcS;

                        //dataPlot creation
                        plot[r+nRows*c] = new DataPlot(grid);
	    
                        //dataPlot set plot to read from
                        setInputPort(resFind, r+nRows*c, local);

                        //dataPlot set indeces of ports to plot
                        setIndexMask(resFind, r+nRows*c, nPortInputsInPlots[r+nRows*c]);

                    }
            }
	   
        for( int r = 0 ; r < nRows ; r++ )
            {
                for( int c = 0 ; c < nCols ; c++ )
                    { 
                        //stop acquisition button
                        connect( toggleAcquireButton, SIGNAL(clicked()), plot[r+nRows*c], SLOT(toggleAcquire()) );
                        plot[r+nRows*c]->initSignalDimensions();
                        //counter button
                        connect(counter, SIGNAL(valueChanged(double)),
                                plot[r+nRows*c], SLOT(setTimerInterval(double)) );
	  
                        counter->setValue(50.0);
	 
                        QSizePolicy sizePolicy2(QSizePolicy::Maximum, QSizePolicy::Maximum);
                        grid->setSizePolicy(sizePolicy2);

                        QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
                        sizePolicy.setHeightForWidth(plot[r+nRows*c]->sizePolicy().hasHeightForWidth());
                        plot[r+nRows*c]->setSizePolicy(sizePolicy);

                        //QSize gridSize= grid->sizeHint();
                        //gridSize.setWidth(500);
                        //gridSize.setHeight(500);
                        plot[r+nRows*c]->setMinimumWidth(10);
                        plot[r+nRows*c]->setMaximumWidth(800);
                        plot[r+nRows*c]->setMinimumHeight(10);
                        plot[r+nRows*c]->setMaximumHeight(800);
                        //if (VERBOSE) fprintf(stderr, "Grid max is: hInt=%d, vInt=%d\n", grid->maximumHeight(), grid->maximumWidth()); 
                        //if (VERBOSE) fprintf(stderr, "Plot max is: hInt=%d, vInt=%d\n", plot[r+nRows*c]->maximumHeight(), plot[r+nRows*c]->maximumWidth()); 
                        //QSize plotSize= plot[r+nRows*c]->sizeHint();
                        //if (VERBOSE) fprintf(stderr, "Plot Hint is: hInt=%d, vInt=%d\n", plotSize.height(), plotSize.width()); 
                    }
            }
    }
예제 #10
0
int main (int argc, char ** argv)
{
    KApplication::disableAutoDcopRegistration();
    KCmdLineArgs::init(argc,argv,"kobordertest", 0, 0, 0, 0);
    KApplication app;

    KoZoomHandler* zh = new KoZoomHandler();

    QGrid* grid = new QGrid(2, Qt::Horizontal, 0L); // 2 columns
    {
        // First square
        MyWidget* w = new MyWidget(zh, grid);
        w->m_leftBorder.setPenWidth( 6 );
        w->m_leftBorder.color = Qt::red;
        w->m_rightBorder.setPenWidth( 9 );
        w->m_rightBorder.color = Qt::red;
        w->m_topBorder.setPenWidth( 11 );
        w->m_topBorder.color = Qt::blue;
        w->m_bottomBorder.setPenWidth( 13 );
        w->m_bottomBorder.color = Qt::green;
    }
    {
        // Second square, with opposite (odd/even-wise) widths
        MyWidget* w = new MyWidget(zh, grid);
        w->m_leftBorder.setPenWidth( 7 );
        w->m_leftBorder.color = Qt::red;
        w->m_rightBorder.setPenWidth( 8 );
        w->m_rightBorder.color = Qt::red;
        w->m_topBorder.setPenWidth( 10 );
        w->m_topBorder.color = Qt::blue;
        w->m_bottomBorder.setPenWidth( 12 );
        w->m_bottomBorder.color = Qt::green;
    }
    {
        // Third square, with double borders
        MyWidget* w2 = new MyWidget(zh, grid);
        w2->m_leftBorder.setPenWidth( 2 );
        w2->m_leftBorder.setStyle( KoBorder::DOUBLE_LINE );
        w2->m_rightBorder.setPenWidth( 6 );
        w2->m_rightBorder.color = Qt::red;
        w2->m_rightBorder.setStyle( KoBorder::DOUBLE_LINE );
        w2->m_topBorder.setPenWidth( 4 );
        w2->m_topBorder.color = Qt::blue;
        w2->m_topBorder.setStyle( KoBorder::DOUBLE_LINE );
        w2->m_bottomBorder.setPenWidth( 6 );
        w2->m_bottomBorder.color = Qt::green;
        w2->m_bottomBorder.setStyle( KoBorder::DOUBLE_LINE );
    }
    {
        // Fourth square, with double borders
        MyWidget* w2 = new MyWidget(zh, grid);
        w2->m_leftBorder.setPenWidth( 1 );
        w2->m_leftBorder.setStyle( KoBorder::DOUBLE_LINE );
        w2->m_rightBorder.setPenWidth( 5 );
        w2->m_rightBorder.color = Qt::red;
        w2->m_rightBorder.setStyle( KoBorder::DOUBLE_LINE );
        w2->m_topBorder.setPenWidth( 3 );
        w2->m_topBorder.color = Qt::blue;
        w2->m_topBorder.setStyle( KoBorder::DOUBLE_LINE );
        w2->m_bottomBorder.setPenWidth( 5 );
        w2->m_bottomBorder.color = Qt::green;
        w2->m_bottomBorder.setStyle( KoBorder::DOUBLE_LINE );
    }
    grid->show();
    return app.exec();
}
예제 #11
0
KURLBarItemDialog::KURLBarItemDialog(bool allowGlobal, const KURL &url, const QString &description, QString icon, bool appLocal, int iconSize,
                                     QWidget *parent, const char *name)
    : KDialogBase(parent, name, true, i18n("Edit Quick Access Entry"), Ok | Cancel, Ok, true)
{
    QVBox *box = new QVBox(this);
    QString text = i18n("<qt><b>Please provide a description, URL and icon for this Quick Access entry.</b></br></qt>");
    QLabel *label = new QLabel(text, box);
    box->setSpacing(spacingHint());

    QGrid *grid = new QGrid(2, box);
    grid->setSpacing(spacingHint());

    QString whatsThisText = i18n(
        "<qt>This is the text that will appear in the Quick Access panel.<p>"
        "The description should consist of one or two words "
        "that will help you remember what this entry refers to.</qt>");
    label = new QLabel(i18n("&Description:"), grid);
    m_edit = new KLineEdit(grid, "description edit");
    m_edit->setText(description.isEmpty() ? url.fileName() : description);
    label->setBuddy(m_edit);
    QWhatsThis::add(label, whatsThisText);
    QWhatsThis::add(m_edit, whatsThisText);

    whatsThisText = i18n(
                        "<qt>This is the location associated with the entry. Any valid URL may be used. For example:<p>"
                        "%1<br>http://www.kde.org<br>ftp://ftp.kde.org/pub/kde/stable<p>"
                        "By clicking on the button next to the text edit box you can browse to an "
                        "appropriate URL.</qt>")
                        .arg(QDir::homeDirPath());
    label = new QLabel(i18n("&URL:"), grid);
    m_urlEdit = new KURLRequester(url.prettyURL(), grid);
    m_urlEdit->setMode(KFile::Directory);
    label->setBuddy(m_urlEdit);
    QWhatsThis::add(label, whatsThisText);
    QWhatsThis::add(m_urlEdit, whatsThisText);

    whatsThisText = i18n(
        "<qt>This is the icon that will appear in the Quick Access panel.<p>"
        "Click on the button to select a different icon.</qt>");
    label = new QLabel(i18n("Choose an &icon:"), grid);
    m_iconButton = new KIconButton(grid, "icon button");
    m_iconButton->setIconSize(iconSize);
    if(icon.isEmpty())
        icon = KMimeType::iconForURL(url);
    m_iconButton->setIcon(icon);
    label->setBuddy(m_iconButton);
    QWhatsThis::add(label, whatsThisText);
    QWhatsThis::add(m_iconButton, whatsThisText);

    if(allowGlobal)
    {
        QString appName;
        if(KGlobal::instance()->aboutData())
            appName = KGlobal::instance()->aboutData()->programName();
        if(appName.isEmpty())
            appName = QString::fromLatin1(KGlobal::instance()->instanceName());
        m_appLocal = new QCheckBox(i18n("&Only show when using this application (%1)").arg(appName), box);
        m_appLocal->setChecked(appLocal);
        QWhatsThis::add(m_appLocal, i18n("<qt>Select this setting if you want this "
                                         "entry to show only when using the current application (%1).<p>"
                                         "If this setting is not selected, the entry will be available in all "
                                         "applications.</qt>")
                                        .arg(appName));
    }
    else
        m_appLocal = 0L;
    connect(m_urlEdit->lineEdit(), SIGNAL(textChanged(const QString &)), this, SLOT(urlChanged(const QString &)));
    m_edit->setFocus();
    setMainWidget(box);
}
예제 #12
0
SettingsDialog::SettingsDialog(StateSpecVector * st, ColorSpecVector * co,
			       bool nodefault, bool unchanged, QString title)
    : QTabDialog(0, title, TRUE),
      states(st), colors(co), first_visible_page(0),
      several(unchanged), did_apply(FALSE) {
  setCaption((title.isEmpty()) ? TR("Diagram Drawing Settings dialog") : title);
  
  QString s_diagram = TR("diagram");
  QGrid * grid = 0;
  QString tabname;
  unsigned i;
  unsigned n;
  
  if (states != 0) {
    n = states->size();
    cbstates = new QVector<ComboStates>(n);
    
    for (i = 0; i != n; i += 1) {
      StateSpec & st = states->at(i);
      QString s = st.name;
      int index = s.find('#');
      QString tbn;
      
      if (index != -1) {
	tbn = s.left(index);
	s = s.mid(index + 1);
      }
      else
	tbn = s_diagram;
      
      if ((grid == 0) || (tabname != tbn)) {
	if (grid != 0) {
	  addTab(grid, tabname);
	  grid->setName(tabname);
	  if (tabname == previous_active_tab)
	    first_visible_page = grid;
	}
	grid = new QGrid(5, this);
	grid->setMargin(2);
	grid->setSpacing(2);
	tabname = tbn;
      }
      
      new QLabel("", grid);
      new QLabel(s + " : ", grid);
      QHBox * hb = new QHBox(grid);
            
      switch (st.who) {
      case StateSpec::is3states:
	cbstates->insert(i, new ComboStates(hb, *((Uml3States *) st.state),
					    nodefault, unchanged));
	break;
      case StateSpec::isClassDrawingMode:
	cbstates->insert(i, new ComboStates(hb, *((ClassDrawingMode *) st.state),
					    nodefault, unchanged));
	break;
      case StateSpec::isDrawingLanguage:
	cbstates->insert(i, new ComboStates(hb, *((DrawingLanguage *) st.state),
					    nodefault, unchanged));
	break;
      case StateSpec::isShowContextMode:
	cbstates->insert(i, new ComboStates(hb, *((ShowContextMode *) st.state),
					    nodefault, unchanged));
	break;
      default:
	cbstates->insert(i, new ComboStates(hb, *((char *) st.state),
					    nodefault, unchanged));
      }
      new QLabel("", hb);
      new QLabel("", grid);
      new QLabel("", grid);
    }
    
    addTab(grid, tabname);
    grid->setName(tabname);
    if (tabname == previous_active_tab)
      first_visible_page = grid;
  }
  
  if (colors != 0) {
    QString lbl = TR("color");
    QString s_default = TR("default ");
    
    n = colors->size();
    cbcolors = new QVector<ComboColor>(n);
    grid = new QGrid(5, this);
    grid->setMargin(2);
    grid->setSpacing(2);
    
    for (i = 0; i != n; i += 1) {
      if (i == 11) {
	lbl = TR("color [1]");
	addTab(grid, lbl);
	grid->setName(lbl);
	if (previous_active_tab == lbl)
	  first_visible_page = grid;
	lbl = TR("color [2]");
	grid = new QGrid(5, this);
	grid->setMargin(2);
	grid->setSpacing(2);
      }
      new QLabel("", grid);
      
      QString s = colors->at(i).name;
      
      s += " : ";
      new QLabel(s, grid);
      cbcolors->insert(i, new ComboColor(grid, *(colors->at(i).color),
					 nodefault, unchanged));
      new QLabel("", grid);
      new QLabel("", grid);
    }
    
    addTab(grid, lbl);
    grid->setName(lbl);
    if (previous_active_tab == lbl)
      first_visible_page = grid;
  }
  
  // use help rather than apply because when the OK button is clicked,
  // the applyButtonPressed() signal is emitted
  setOkButton(TR("OK"));
  setHelpButton(TR("Apply"));
  setCancelButton(TR("Cancel"));
  
  connect(this, SIGNAL(helpButtonPressed()),
	  this, SLOT(apply()));
}
예제 #13
0
MainWindow::MainWindow(QWidget *parent, const char* name, WFlags /*fl*/) : 
	KMainWindow(parent, name, WStyle_NoBorder)
{
	m_clickcount = 0;
	
	contrdirs[Cell::U] = Cell::D;
	contrdirs[Cell::R] = Cell::L;
	contrdirs[Cell::D] = Cell::U;
	contrdirs[Cell::L] = Cell::R;

	KNotifyClient::startDaemon();
	
	KStdGameAction::gameNew(this, SLOT(slotNewGame()), actionCollection());
	
	KStdGameAction::highscores(this, SLOT(showHighscores()), actionCollection());
	KStdGameAction::quit(this, SLOT(close()), actionCollection());
	KStdGameAction::configureHighscores(this, SLOT(configureHighscores()), actionCollection());

	m_levels = KStdGameAction::chooseGameType(0, 0, actionCollection());
	QStringList lst;
	lst += i18n("Novice");
	lst += i18n("Normal");
	lst += i18n("Expert");
	lst += i18n("Master");
	m_levels->setItems(lst);

	setFixedSize(minimumSizeHint());

	statusBar()->insertItem("abcdefghijklmnopqrst: 0  ",1);
	setAutoSaveSettings();
	createGUI();
	connect(m_levels, SIGNAL(activated(int)), this, SLOT(newGame(int)));
	

	QWhatsThis::add(this, i18n("<h3>Rules of the Game</h3>"
			"<p>You are the system administrator and your goal"
			" is to connect each computer to the central server."
			"<p>Click the right mouse button to turn the cable"
			" in a clockwise direction, and the left mouse button"
			" to turn it in a counter-clockwise direction."
			"<p>Start the LAN with as few turns as possible!"));
	
	//const int cellsize = KGlobal::iconLoader()->loadIcon("knetwalk/background.png", KIcon::User, 32).width();
	const int cellsize = 32;
	const int gridsize = cellsize * MasterBoardSize + 2;

	QGrid* grid = new QGrid(MasterBoardSize, this);
	grid->setFrameStyle(QFrame::Panel | QFrame::Sunken);
	grid->setFixedSize(gridsize, gridsize);
	setCentralWidget(grid);

	Cell::initPixmaps();
	for(int i = 0; i < MasterBoardSize * MasterBoardSize; i++)
	{
		board[i] = new Cell(grid, i);
		board[i]->setFixedSize(cellsize, cellsize);
		connect(board[i], SIGNAL(lClicked(int)), SLOT(lClicked(int)));
		connect(board[i], SIGNAL(rClicked(int)), SLOT(rClicked(int)));
		connect(board[i], SIGNAL(mClicked(int)), SLOT(mClicked(int)));
	}
	srand(time(0));

	slotNewGame();
}
예제 #14
0
QWidget* CombatWindow::initDefenseWidget()
{
	QWidget *pWidget = new QWidget(m_tab);
	m_layout_defense = new QVBoxLayout(pWidget);

	QGroupBox *avoidanceGBox = new QVGroupBox("Avoidance", pWidget);
	m_layout_defense->addWidget(avoidanceGBox);

	QGrid *avoidanceGrid = new QGrid(6, avoidanceGBox);

	new QLabel("Misses:", avoidanceGrid);
	m_label_defense_avoid_misses = new QLabel(avoidanceGrid);

	new QLabel("Blocks:", avoidanceGrid);
	m_label_defense_avoid_block = new QLabel(avoidanceGrid);

	new QLabel("Parries:", avoidanceGrid);
	m_label_defense_avoid_parry = new QLabel(avoidanceGrid);

	new QLabel("Ripostes:", avoidanceGrid);
	m_label_defense_avoid_riposte = new QLabel(avoidanceGrid);

	new QLabel("Dodges", avoidanceGrid);
	m_label_defense_avoid_dodge = new QLabel(avoidanceGrid);

	new QLabel("Total:", avoidanceGrid);
	m_label_defense_avoid_total = new QLabel(avoidanceGrid);

	((QGridLayout *)avoidanceGrid->layout())->setColStretch(1, 1);
	((QGridLayout *)avoidanceGrid->layout())->setColStretch(3, 1);
	((QGridLayout *)avoidanceGrid->layout())->setColStretch(5, 1);
	avoidanceGrid->layout()->setSpacing(5);

	QGroupBox *mitigationGBox = new QVGroupBox("Mitigation", pWidget);
	m_layout_defense->addWidget(mitigationGBox);

	QGrid *mitigationGrid = new QGrid(6, mitigationGBox);

	new QLabel("Avg. Hit:", mitigationGrid);
	m_label_defense_mitigate_avghit = new QLabel(mitigationGrid);

	new QLabel("Min:", mitigationGrid);
	m_label_defense_mitigate_minhit = new QLabel(mitigationGrid);

	new QLabel("Max:", mitigationGrid);
	m_label_defense_mitigate_maxhit = new QLabel(mitigationGrid);

	((QGridLayout *)mitigationGrid->layout())->setColStretch(1, 1);
	((QGridLayout *)mitigationGrid->layout())->setColStretch(3, 1);
	((QGridLayout *)mitigationGrid->layout())->setColStretch(5, 1);
	mitigationGrid->layout()->setSpacing(5);

	QGroupBox *summaryGBox = new QVGroupBox("Summary", pWidget);
	m_layout_defense->addWidget(summaryGBox);

	QGrid *summaryGrid = new QGrid(6, summaryGBox);

	new QLabel("Mob Attacks:", summaryGrid);
	m_label_defense_summary_mobattacks = new QLabel(summaryGrid);

	new QLabel("% Avoided:", summaryGrid);
	m_label_defense_summary_percentavoided = new QLabel(summaryGrid);

	new QLabel("Total Damage:", summaryGrid);
	m_label_defense_summary_totaldamage = new QLabel(summaryGrid);

	((QGridLayout *)summaryGrid->layout())->setColStretch(1, 1);
	((QGridLayout *)summaryGrid->layout())->setColStretch(3, 1);
	((QGridLayout *)summaryGrid->layout())->setColStretch(5, 1);
	summaryGrid->layout()->setSpacing(5);

	return pWidget;
}
예제 #15
0
MrmlPart::MrmlPart( QWidget *parentWidget, const char * /* widgetName */,
                    QObject *parent, const char *name,
                    const QStringList& /* args */ )
    : KParts::ReadOnlyPart( parent, name ),
      m_job( 0L ),
      m_status( NeedCollection )
{
    m_sessionId = QString::number( s_sessionId++ ).prepend("kmrml_");

    setName( "MRML Part" );
    m_browser = new Browser( this, "mrml browserextension");
    setInstance( PartFactory::instance(), true ); // do load plugins :)
    KConfig *config = PartFactory::instance()->config();
    config->setGroup("MRML Settings");

    QVBox *box = new QVBox( parentWidget, "main mrml box" );
    m_view = new MrmlView( box, "MrmlView" );
    connect( m_view, SIGNAL( activated( const KURL&, ButtonState )),
             this, SLOT( slotActivated( const KURL&, ButtonState )));
    connect( m_view, SIGNAL( onItem( const KURL& )),
             this, SLOT( slotSetStatusBar( const KURL& )));

    m_panel = new QHGroupBox( box, "buttons box" );

    QGrid *comboGrid = new QGrid( 2, m_panel, "combo grid" );
    comboGrid->setSpacing( KDialog::spacingHint() );

    (void) new QLabel( i18n("Server to query:"), comboGrid );

    m_hostCombo = new KComboBox( false, comboGrid, "host combo" );
    initHostCombo();
    connect( m_hostCombo, SIGNAL( activated( const QString& ) ),
             SLOT( slotHostComboActivated( const QString& )));

    (void) new QLabel( i18n("Search in collection:"), comboGrid );
    m_collectionCombo = new CollectionCombo( comboGrid, "collection-combo" );
    // will be re-set in initCollections(), but we need to set it here to
    // prevent crashes when the connection to the server fails
    m_collectionCombo->setCollections( &m_collections );

    m_algoButton = new QPushButton( QString::null, m_panel );
    m_algoButton->setPixmap( SmallIcon("configure") );
    m_algoButton->setFixedSize( m_algoButton->sizeHint() );
    connect( m_algoButton, SIGNAL( clicked() ),
             SLOT( slotConfigureAlgorithm() ));
    QToolTip::add( m_algoButton, i18n("Configure algorithm") );

    QWidget *spacer = new QWidget( m_panel );
    spacer->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding,
                                        QSizePolicy::Minimum ) );

    int resultSize = config->readNumEntry( "Result-size", 20 );
    m_resultSizeInput = new KIntNumInput( resultSize, m_panel );
    m_resultSizeInput->setRange( 1, 100 );
    m_resultSizeInput->setLabel( i18n("Maximum result images:") );

    QVBox *tmp = new QVBox( m_panel );
    m_random = new QCheckBox( i18n("Random search"), tmp );

    m_startButton = new QPushButton( QString::null, tmp );
    connect( m_startButton, SIGNAL( clicked() ), SLOT( slotStartClicked() ));
    setStatus( NeedCollection );

    setWidget( box );

    // setXMLFile( "mrml_part.rc" );

    slotSetStatusBar( QString::null );

    enableServerDependentWidgets( false );
}
예제 #16
0
ExperienceWindow::ExperienceWindow(const DataLocationMgr* dataLocMgr, 
				   Player* player, GroupMgr* groupMgr,
				   ZoneMgr* zoneMgr,
				   QWidget* parent, const char* name) 
  : SEQWindow("Experience", "ShowEQ - Experience", parent, name),
    m_dataLocMgr(dataLocMgr),
    m_player(player),
    m_group(groupMgr),
    m_zoneMgr(zoneMgr)
{
  /* Hopefully this is only called once to set up the window,
     so this is a good place to initialize some things which
     otherwise won't be. */

   m_ratio = 1;
   m_timeframe = 0;
   m_calcZEM=0;
   m_ZEMviewtype = 0;

   m_view_menu = new QPopupMenu( this );
   m_view_menu->insertItem( "&All Mobs", this, SLOT(viewAll()) );
   m_view_menu->insertItem( "Previous &15 Minutes", this, SLOT(view15Minutes()) );
   m_view_menu->insertItem( "Previous &30 Minutes", this, SLOT(view30Minutes()) );
   m_view_menu->insertItem( "Previous &60 Minutes", this, SLOT(view60Minutes()) );
   m_view_menu->setItemChecked( m_view_menu->idAt(0), true );

   m_view_menu->insertSeparator();
   m_exp_rate_menu = new QPopupMenu( this );
   m_exp_rate_menu->insertItem( "per &minute", this, SLOT(viewRatePerMinute()) );
   m_exp_rate_menu->insertItem( "per &hour", this, SLOT(viewRatePerHour()) );
   m_exp_rate_menu->setItemChecked( m_exp_rate_menu->idAt(0), true );
   m_view_menu->insertItem( "Experience &Rate", m_exp_rate_menu );

   m_view_menu->insertSeparator();
   m_view_menu->insertItem( "Clear Kills", this, SLOT(viewClear()) );

   m_view_menu->insertSeparator();
   m_ZEM_menu = new QPopupMenu( this );
   m_ZEM_menu->insertItem( "Calculated Value", this, SLOT(viewZEMcalculated()) );
   m_ZEM_menu->insertItem( "Raw Value", this, SLOT(viewZEMraw()) );
   m_ZEM_menu->insertItem( "Percent Bonus", this, SLOT(viewZEMpercent()) );
   m_ZEM_menu->setItemChecked( m_ZEM_menu->idAt(0), true );
   m_view_menu->insertItem( "ZEM View Options", m_ZEM_menu );
   m_view_menu->insertItem( "Calculate ZEM on next kill", this, SLOT(calcZEMNextKill()) );

   m_layout = new QVBoxLayout(boxLayout());

   m_menu_bar = new QMenuBar( this );
   m_menu_bar->insertItem( "&View", m_view_menu );
   //m_layout->addSpacing( m_menu_bar->height() + 5 );
   m_layout->addWidget(m_menu_bar);

   QGroupBox *listGBox = new QVGroupBox( "Experience Log", this );
   m_layout->addWidget( listGBox );

   m_exp_listview = new SEQListView(preferenceName(), listGBox);
   m_exp_listview->addColumn("Time");
   m_exp_listview->addColumn("Mob");
   m_exp_listview->addColumn("Level");
   m_exp_listview->addColumn("Base Exp");
   m_exp_listview->addColumn("ZEM total");
   m_exp_listview->addColumn("Class total");
   m_exp_listview->addColumn("Group total");
   m_exp_listview->addColumn("Experience Gained");
   
   m_exp_listview->restoreColumns();

   m_exp_listview->setMinimumSize( m_exp_listview->sizeHint().width(),
      200 );

   QGroupBox *statsGBox = new QVGroupBox( "Statistics", this );
   m_layout->addWidget( statsGBox );
   
   QGrid *statsGrid = new QGrid( 4, statsGBox );

   new QLabel( "Total Experience Received:",
      statsGrid );
   m_total_received = new QLabel( statsGrid );

   new QLabel( "Play Time:", statsGrid );
   m_play_time = new QLabel( statsGrid );

   new QLabel( "Total Mobs Killed:", statsGrid );
   m_mob_count = new QLabel( statsGrid );

   m_experience_rate_label = new QLabel( "Experience Rate (per minute):", statsGrid );
   m_experience_rate = new QLabel( statsGrid );

   new QLabel( "Average Experience per Mob:",
      statsGrid );
   m_average_per_mob = new QLabel( statsGrid );

   new QLabel( "Estimated Kills To Level:",
      statsGrid );
   m_kills_to_level = new QLabel( statsGrid );

   new QLabel( "Experience Remaining:",
      statsGrid );
   m_experience_remaining = new QLabel( statsGrid );

   new QLabel( "Estimated Time To Level:",
      statsGrid );
   m_time_to_level = new QLabel( statsGrid );

   // ewww, why can't we just get it from QGrid? :(
   ((QGridLayout *)statsGrid->layout())->setColStretch( 1, 1 );
   ((QGridLayout *)statsGrid->layout())->setColStretch( 3, 1 );
   statsGrid->layout()->setSpacing( 5 );

   updateAverage( );

   // timer to update the average xp
   QTimer *timer = new QTimer( this );
   connect( timer, SIGNAL(timeout()), SLOT(updateAverage()));
   timer->start(15*1000); // calculate every 15 seconds

   QFileInfo fileInfo = m_dataLocMgr->findWriteFile("logs", "exp.log");

   m_log = fopen(fileInfo.absFilePath(), "a");
   if (m_log == 0)
   {
      m_log_exp = 0;
      seqWarn("Error opening exp.log, no exp will be logged this session");
   }

   fileInfo = m_dataLocMgr->findWriteFile("logs", "newexp.log");

   m_newExpLogFile = fileInfo.absFilePath();
}
예제 #17
0
QWidget* MyFracWindow::createParamsDock(QWidget* parent)
{
	QVBox* wrapper = new QVBox(parent);
	wrapper->setSpacing(0);

	QGrid* propParams = new QGrid(2, wrapper);
	propParams->setMargin(7);
	propParams->setSpacing(5);

	new QLabel(i18n("X coordinate:"), propParams);
	_editPosX = new QLineEdit(propParams);
	_editPosX->setValidator(new QDoubleValidator(-4.0, 4.0, 15, _editPosX));
	connect(_editPosX, SIGNAL(returnPressed()), SLOT(readPosition()));
	connect(_editPosX, SIGNAL(lostFocus()), SLOT(readPosition()));
	QToolTip::add(_editPosX, i18n("X coordinate of the center of the view"));

	new QLabel(i18n("Y coordinate:"), propParams);
	_editPosY = new QLineEdit(propParams);
	_editPosY->setValidator(new QDoubleValidator(-4.0, 4.0, 15, _editPosY));
	connect(_editPosY, SIGNAL(returnPressed()), SLOT(readPosition()));
	connect(_editPosY, SIGNAL(lostFocus()), SLOT(readPosition()));
	QToolTip::add(_editPosY, i18n("Y coordinate of the center of the view"));

	new QLabel(i18n("Zoom magnitude:"), propParams);
	_editZoom = new QLineEdit(propParams);
	_editZoom->setValidator(new QDoubleValidator(-1.0, 14.0, 15, _editZoom));
	connect(_editZoom, SIGNAL(returnPressed()), SLOT(readPosition()));
	connect(_editZoom, SIGNAL(lostFocus()), SLOT(readPosition()));
	QToolTip::add(_editZoom, i18n("Zoom order of maginitude"));

	new QLabel(i18n("Rotation angle:"), propParams);
	_editAngle = new QLineEdit(propParams);
	_editAngle->setValidator(new QDoubleValidator(-360.0, 360.0, 15, _editAngle));
	connect(_editAngle, SIGNAL(returnPressed()), SLOT(readPosition()));
	connect(_editAngle, SIGNAL(lostFocus()), SLOT(readPosition()));
	QToolTip::add(_editAngle, i18n("View rotation angle in degrees"));

	new QLabel(i18n("Julia X param.:"), propParams);
	_editJuliaX = new QLineEdit(propParams);
	connect(_editJuliaX, SIGNAL(returnPressed()), SLOT(readJulia()));
	connect(_editJuliaX, SIGNAL(lostFocus()), SLOT(readJulia()));
	QToolTip::add(_editJuliaX, i18n("X coordinate of the Julia parameter"));

	new QLabel(i18n("Julia Y param.:"), propParams);
	_editJuliaY = new QLineEdit(propParams);
	connect(_editJuliaY, SIGNAL(returnPressed()), SLOT(readJulia()));
	connect(_editJuliaY, SIGNAL(lostFocus()), SLOT(readJulia()));
	QToolTip::add(_editJuliaY, i18n("Y coordinate of the Julia parameter"));

	new QLabel(i18n("Iterations limit:"), propParams);
	_sliderIterations = new QSlider(QSlider::Horizontal, propParams);
	_sliderIterations->setRange(0, 20);
	connect(_sliderIterations, SIGNAL(valueChanged(int)), SLOT(setMaxIterations(int)));
	QToolTip::add(_sliderIterations, i18n("Maximum number of iterations to calculate"));

	new QLabel(i18n("Detail level:"), propParams);
	_sliderQuality = new QSlider(QSlider::Horizontal, propParams);
	_sliderQuality->setRange(0, 10);
	connect(_sliderQuality, SIGNAL(valueChanged(int)), SLOT(setQuality(int)));
	QToolTip::add(_sliderQuality, i18n("Amount of details to calculate"));

	wrapper->setStretchFactor(new QWidget(wrapper), 1);

	return wrapper;
}
예제 #18
0
StateDialog::StateDialog(StateData * d)
    : QTabDialog(0, 0, FALSE, WDestructiveClose), state(d) {
  d->browser_node->edit_start();
  
  if (d->browser_node->is_writable()) {
    setOkButton(TR("OK"));
    setCancelButton(TR("Cancel"));
  }
  else {
    setOkButton(QString::null);
    setCancelButton(TR("Close"));
  }

  setCaption(TR("State dialog"));
  visit = !hasOkButton();  

  BrowserNode * bn = state->browser_node;
  QGrid * grid;
  
  //
  // general tab
  //
  
  grid = new QGrid(2, this);
  umltab = grid;
  grid->setMargin(5);
  grid->setSpacing(5);
  
  new QLabel(TR("name : "), grid);
  edname = new LineEdit(bn->get_name(), grid);
  edname->setReadOnly(visit);
    
  new QLabel(TR("stereotype : "), grid);
  edstereotype = new QComboBox(!visit, grid);
  edstereotype->insertItem(toUnicode(state->get_stereotype()));
  if (!visit) {
    edstereotype->insertStringList(BrowserState::default_stereotypes());
    edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlState));
    edstereotype->setAutoCompletion(completion());
  }
  edstereotype->setCurrentItem(0);
  QSizePolicy sp = edstereotype->sizePolicy();
  sp.setHorData(QSizePolicy::Expanding);
  edstereotype->setSizePolicy(sp);
    
  connect(new SmallPushButton(TR("specification :"), grid), SIGNAL(clicked()),
	  this, SLOT(menu_specification()));    
  edspecification = new QComboBox(FALSE, grid);
  edspecification->setSizePolicy(sp);
  if (visit) {
    if (state->get_specification() == 0)
      edspecification->insertItem("");
    else
      edspecification->insertItem(state->get_specification()->full_name(TRUE));
  }
  else {
    edspecification->insertItem("");
    edspecification->setAutoCompletion(completion());
    BrowserOperation::instances(opers);
    opers.full_names(speclist);
    edspecification->insertStringList(speclist);
    edspecification->setCurrentItem((state->get_specification() == 0)
				    ? 0
				    : opers.findRef(state->get_specification()) + 1);
  }
  
  switch (((BrowserNode *) bn->parent())->get_type()) {
  case UmlState:
  case UmlRegion:
    if ((state->get_reference() != 0) || (bn->firstChild() == 0)) {
      connect(new SmallPushButton(TR("reference :"), grid), SIGNAL(clicked()),
	      this, SLOT(menu_reference()));    
      edreference = new QComboBox(FALSE, grid);
      edreference->setSizePolicy(sp);
      if (visit) {
	if (state->get_reference() == 0)
	  edreference->insertItem("");
	else
	  edreference->insertItem(state->get_reference()->full_name(TRUE));
      }
      else {
	edreference->insertItem("");
	edreference->setAutoCompletion(completion());
	if (((BrowserState *) bn)->can_reference()) {
	  BrowserState::instances(states, TRUE);
	  
	  BrowserNode * st = states.first();
	  
	  while (st != 0) {
	    if (!((BrowserState *) bn)->can_reference((BrowserState *) st) ||
		((BrowserState *) st)->is_ref()) {
	      states.remove();
	      st = states.current();
	    }
	    else
	      st = states.next();
	  }
	}
	else
	  states.append(state->get_reference());
	states.full_names(reflist);
	edreference->insertStringList(reflist);
	edreference->setCurrentItem((state->get_reference() == 0)
				    ? 0
				    : states.findRef(state->get_reference()) + 1);
	
	connect(edreference, SIGNAL(activated(int)), this, SLOT(ed_ref_activated(int)));
      }
      break;
    }
    // no break
  default:
    edreference = 0;
  }
예제 #19
0
QWidget* MyFracWindow::createDisplayDock(QWidget* parent)
{
	QVBox* wrapper = new QVBox(parent);
	wrapper->setSpacing(0);

	QGrid* propDisplay = new QGrid(2, wrapper);
	propDisplay->setMargin(7);
	propDisplay->setSpacing(5);

	new QLabel(i18n("Color gradient:"), propDisplay);
	GradientButton* gradButton = new GradientButton(propDisplay);
	connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), gradButton, SLOT(setGradient(const QRgb*, double, double)));
	connect(gradButton, SIGNAL(clicked()), this, SLOT(onGradientEdit()));
	QToolTip::add(gradButton, i18n("Gradient used to display the fractal"));

	new QLabel(i18n("Color scale:"), propDisplay);
	_sliderScale = new QSlider(QSlider::Horizontal, propDisplay);
	_sliderScale->setRange(0, 100);
	connect(_sliderScale, SIGNAL(valueChanged(int)), SLOT(setGradientScale(int)));
	QToolTip::add(_sliderScale, i18n("Scale of the color gradient"));

	new QLabel(i18n("Color offset:"), propDisplay);
	_sliderOffset = new QSlider(QSlider::Horizontal, propDisplay);
	_sliderOffset->setRange(0, 100);
	connect(_sliderOffset, SIGNAL(valueChanged(int)), SLOT(setGradientOffset(int)));
	QToolTip::add(_sliderOffset, i18n("Offset of the color gradient"));

	new QLabel(i18n("Scroll colors:"), propDisplay);
	QHBox* box = new QHBox(propDisplay);
	box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	box->setSpacing(5);
	QComboBox* combo = new QComboBox(box);
	combo->insertItem(i18n("scroll direction", "Off"));
	combo->insertItem(i18n("scroll direction", "Left"));
	combo->insertItem(i18n("scroll direction", "Right"));
	connect(combo, SIGNAL(activated(int)), SLOT(setScrollMode(int)));
	_sliderScroll = new QSlider(QSlider::Horizontal, box);
	_sliderScroll->setRange(0, 100);
	_sliderScroll->setEnabled(false);
	connect(_sliderScroll, SIGNAL(valueChanged(int)), SLOT(setScrollSpeed(int)));
	QToolTip::add(combo, i18n("Scrolling direction"));
	QToolTip::add(_sliderScroll, i18n("Scrolling speed"));

	new QLabel(i18n("Background:"), propDisplay);
	_colorButton = new KColorButton(_backgroundColor, propDisplay);
	connect(_colorButton, SIGNAL(changed(const QColor&)), SLOT(selectBackground(const QColor&)));
	QToolTip::add(_colorButton, i18n("Color of the background area"));

	new QLabel(i18n("3D grid size:"), propDisplay);
	_comboGrid = new QComboBox(propDisplay);
	for (int i = 64; i <= 1024; i *= 2)
		_comboGrid->insertItem(i18n("%1 x %2").arg(i).arg(i));
	_comboGrid->setEnabled(false);
	connect(_comboGrid, SIGNAL(activated(int)), SLOT(setGridSize(int)));
	QToolTip::add(_comboGrid, i18n("Resolution of the 3D mesh"));

	new QLabel(i18n("Height scale:"), propDisplay);
	_sliderHeight = new QSlider(QSlider::Horizontal, propDisplay);
	_sliderHeight->setRange(0, 100);
	_sliderHeight->setEnabled(false);
	connect(_sliderHeight, SIGNAL(valueChanged(int)), SLOT(setHeightScale(int)));
	QToolTip::add(_sliderHeight, i18n("Height scale of the 3D mesh"));

	wrapper->setStretchFactor(new QWidget(wrapper), 1);

	return wrapper;
}
예제 #20
0
UseCaseDialog::UseCaseDialog(UseCaseData * u)
    : QTabDialog(0, 0, FALSE, WDestructiveClose), uc(u) {
  BrowserNode * bn = u->browser_node;
  
  bn->edit_start();
  
  if (bn->is_writable()) {
    setOkButton(TR("OK"));
    setCancelButton(TR("Cancel"));
  }
  else {
    setOkButton(QString::null);
    setCancelButton(TR("Close"));
  }

  setCaption(TR("Use Case dialog"));
  
  bool visit = !hasOkButton();
  
  // general tab
  
  QGrid * grid = new QGrid(2, this);
  grid->setMargin(5);
  grid->setSpacing(5);

  new QLabel(TR("name : "), grid);
  edname = new LineEdit(bn->get_name(), grid);
  edname->setReadOnly(visit);

  new QLabel(TR("stereotype : "), grid);
  edstereotype = new QComboBox(!visit, grid);
  edstereotype->insertItem(toUnicode(uc->get_stereotype()));
  if (! visit) {
    edstereotype->insertStringList(BrowserUseCase::default_stereotypes());
    edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlUseCase));
    edstereotype->setAutoCompletion(completion());
  }
  edstereotype->setCurrentItem(0);
  QSizePolicy sp = edstereotype->sizePolicy();
  sp.setHorData(QSizePolicy::Expanding);
  edstereotype->setSizePolicy(sp);
  
  new QLabel(TR("extension \npoints : "), grid);
  extension_points = new MultiLineEdit(grid);
  extension_points->setReadOnly(visit);
  extension_points->setText(uc->get_extension_points());
  QFont font = extension_points->font();
  if (! hasCodec())
    font.setFamily("Courier");
  font.setFixedPitch(TRUE);
  extension_points->setFont(font);

  QVBox * vtab = new QVBox(grid);
  new QLabel(TR("description :"), vtab);
  if (! visit)
    connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()),
	    this, SLOT(edit_description()));
  comment = new MultiLineEdit(grid);
  comment->setReadOnly(visit);
  comment->setText(bn->get_comment());
  comment->setFont(font);
  
  addTab(grid, "Uml");
  
  // USER : list key - value
  
  grid = new QGrid(2, this);
  grid->setMargin(5);
  grid->setSpacing(5);
  
  kvtable = new KeyValuesTable(bn, grid, visit);
  addTab(grid, TR("Properties"));
  
  open_dialog(this);
}
예제 #21
0
SimpleRelationDialog::SimpleRelationDialog(SimpleRelationData * r)
    : QTabDialog(0, 0, FALSE, WDestructiveClose), rel(r) {  
  r->browser_node->edit_start();
  
  if (r->browser_node->is_writable()) {
    setOkButton(TR("OK"));
    setCancelButton(TR("Cancel"));
  }
  else {
    setOkButton(QString::null);
    setCancelButton(TR("Close"));
  }

  bool visit = !hasOkButton();
  
  // general tab
  
  BrowserNode * bn = rel->get_browser_node();
  QGrid * grid = new QGrid(2, this);
  grid->setMargin(5);
  grid->setSpacing(5);

  switch (rel->get_type()) {
  case UmlInherit:
    setCaption(TR("Generalisation dialog"));
    break;
  case UmlDependOn:
    setCaption(TR("Dependency dialog"));
    break;
  default:
    setCaption(TR("unknown relation dialog"));
    break;
  }
  
  new QLabel(TR("from : "), grid);
  new QLabel(rel->get_start_node()->full_name(TRUE), grid);
  new QLabel(TR("to : "), grid);
  new QLabel(rel->get_end_node()->full_name(TRUE), grid);
  
  new QLabel(TR("stereotype : "), grid);
  edstereotype = new QComboBox(!visit, grid);
  edstereotype->insertItem(toUnicode(rel->get_stereotype()));
  if (! visit) {
    edstereotype->insertStringList(rel->get_start_node()
				   ->default_stereotypes(rel->get_type(),
							 rel->get_end_node()));
    edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlRelations));
    edstereotype->setAutoCompletion(completion());
  }
  edstereotype->setCurrentItem(0);
  QSizePolicy sp = edstereotype->sizePolicy();
  sp.setHorData(QSizePolicy::Expanding);
  edstereotype->setSizePolicy(sp);
  
  QVBox * vtab = new QVBox(grid);
  new QLabel(TR("description :"), vtab);
  if (! visit)
    connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()),
	    this, SLOT(edit_description()));
  comment = new MultiLineEdit(grid);
  comment->setReadOnly(visit);
  comment->setText(bn->get_comment());
  QFont font = comment->font();
  if (! hasCodec())
    font.setFamily("Courier");
  font.setFixedPitch(TRUE);
  comment->setFont(font);
  
  addTab(grid, "Uml");
  
  // USER : list key - value
  
  grid = new QGrid(2, this);
  grid->setMargin(5);
  grid->setSpacing(5);
  
  kvtable = new KeyValuesTable(bn, grid, visit);
  addTab(grid, TR("Properties"));
  
  open_dialog(this);
}
예제 #22
0
EnvDialog::EnvDialog(bool conv, bool noid)
    : QDialog(0, "Environment dialog", TRUE), conversion(conv) {
  setCaption(TR("Environment dialog"));
  
  QVBoxLayout * vbox = new QVBoxLayout(this);
  QHBox * htab;
  QGrid * grid = new QGrid(2, this);
  QPushButton * button;
  QString s;
  
  vbox->addWidget(grid);
  grid->setMargin(5);
  grid->setSpacing(5);
  
  new QLabel(grid);  
  new QLabel(TR("MANDATORY, choose a value between 2 and 127 not used by an other person working at the same time on a project with you.\n"
	     "To be safe, if possible choose a value not used by an other person even not working on a given project with you"),
	     grid);
  
  new QLabel(TR("Own identifier "), grid);
  htab = new QHBox(grid);
  if (conv)
    s = getenv("BOUML_ID");	// yes !
  else if (! noid)
    s.setNum(user_id());
  ed_id = new QLineEdit(s, htab);
  if (BrowserView::get_project() != 0) {
    ed_id->setEnabled(FALSE);
    new QLabel(TR("   The identifier can't be modified while a project is load"), htab);
  }

  //
  
  new QLabel(grid);  
  new QLabel(TR("\nOptional, to indicate where are the HTML pages of the reference manual. Used by the help (called by the F1 key) to show the\n"
	     "chapter corresponding to the kind of the element selected in the browser"),
	     grid);

  new QLabel(TR("Manual path"), grid);
  htab = new QHBox(grid);
  ed_doc = new QLineEdit(htab);
  if (!conv)
    ed_doc->setText(manual_dir());











  new QLabel(" ", htab);
  button = new QPushButton(TR("Browse"), htab);
  connect(button, SIGNAL(clicked ()), this, SLOT(doc_browse()));

  //
  
  new QLabel(grid);  
  new QLabel(TR("\nOptional, to indicate a web navigator program. If it is not defined the reference manual will be shown with an internal simple viewer"),
	     grid);
  new QLabel(TR("Navigator"), grid);
  htab = new QHBox(grid);
  ed_navigator = new QLineEdit(htab);
  if (!conv)
    ed_navigator->setText(navigator_path());
  new QLabel(" ", htab);
  button = new QPushButton(TR("Browse"), htab);
  connect(button, SIGNAL(clicked ()), this, SLOT(navigator_browse()));

  //
  
  new QLabel(grid);  
  new QLabel(TR("\nOptional, to indicate a template project. This allows to create new projects getting all the template project settings"),
	     grid);
  new QLabel("Template project", grid);
  htab = new QHBox(grid);
  if (conv)
    s = getenv("BOUML_TEMPLATE");	// yes !
  else
    s = template_project();
  ed_template = new QLineEdit(s, htab);
  new QLabel(" ", htab);
  button = new QPushButton(TR("Browse"), htab);
  connect(button, SIGNAL(clicked ()), this, SLOT(template_browse()));

  //
  
  new QLabel(grid);  
  new QLabel(TR("\nOptional, to indicate a text editor (it must creates an own window). Else Bouml will use an internal editor"),
	     grid);
  new QLabel(TR("Editor path "), grid);
  htab = new QHBox(grid);
  if (conv)
    s = getenv("BOUML_EDITOR");	// yes !
  else
    s = editor();
  ed_editor = new QLineEdit(s, htab);
  new QLabel(" ", htab);
  button = new QPushButton(TR("Browse"), htab);
  connect(button, SIGNAL(clicked ()), this, SLOT(editor_browse()));

  //
  
  new QLabel(grid);  
  new QLabel(TR("\nOptional, to choose a language for menus and dialogs (default is English). You may have to select a corresponding character set"),
	     grid);
  new QLabel(TR("Translation file path "), grid);
  htab = new QHBox(grid);
  ed_lang = new QLineEdit(current_lang(), htab);
  new QLabel(" ", htab);
  button = new QPushButton(TR("Browse"), htab);
  connect(button, SIGNAL(clicked ()), this, SLOT(lang_browse()));

  //
  
  new QLabel(grid);  




  new QLabel(TR("\nOptional, to indicate a character set in case you use non ISO_8859-1/latin1 characters. For instance KOI8-R or KOI8-RU for Cyrillic"),
	     grid);

  new QLabel(TR("Character set "), grid);
  cb_charset = new QComboBox(FALSE, grid);
  cb_charset->setAutoCompletion(completion());
  
  QStringList l;
  QTextCodec * co;
  int i = 0;
  
  l.append("");
  while ((co = QTextCodec::codecForIndex(i++)) != 0) {
    QString na = co->name();
    int pos = 0;  
    
    while ((pos = na.find(' ', pos)) != -1)
      na.replace(pos, 1, "_");
    
    if (QTextCodec::codecForName(na) == co)
      l.append(na);
  }
  
  l.sort();
  cb_charset->insertStringList(l);
  if (conv)
    s = getenv("BOUML_CHARSET");	// yes !
  else
    s = codec();
  
  if (!s.isEmpty() && ((i = l.findIndex(s)) != -1))
    cb_charset->setCurrentItem(i);

  //
  
  new QLabel(grid);  
  new QLabel(TR("\nIn case you have a multiple screens configuration the best for you is to ask Bouml to place by default the dialogs in one of these\n"
	     "screens giving the area, else the dialogs will be shown on the center of the virtual screen."),
	     grid);
  new QLabel(TR("Default screen "), grid);
  
  QString x0, y0, x1, y1;
  int top, left, bottom, right;
  
  if (conv) {
    const char * limits = getenv("BOUML_LIMIT_DESKTOP"); // yes !
    
    if ((limits != 0) && 
	(sscanf(limits, "%d,%d,%d,%d", &left, &top, &right, &bottom) == 4)) {
      x0.setNum(left);
      y0.setNum(top);
      x1.setNum(right);
      y1.setNum(bottom);
    }
  }
  else {
    int top, left, bottom, right;
    
    UmlDesktop::limits(left, top, right, bottom);
    x0.setNum(left);
    y0.setNum(top);
    x1.setNum(right);
    y1.setNum(bottom);
  }
  
  htab = new QHBox(grid);
  new QLabel(TR("left: "), htab);
  ed_xmin = new QLineEdit(x0, htab);
  new QLabel(TR("      top: "), htab);
  ed_ymin = new QLineEdit(y0, htab);
  new QLabel(TR("      right: "), htab);
  ed_xmax = new QLineEdit(x1, htab);
  new QLabel(TR("      bottom: "), htab);
  ed_ymax = new QLineEdit(y1, htab);
  
  //
  
  new QLabel(grid);
  htab = new QHBox(grid);
  new QLabel(htab);
  connect(new QPushButton(TR("OK"), htab), SIGNAL(clicked()), this, SLOT(accept()));
  new QLabel(htab);
  if (! conv) {
    connect(new QPushButton(TR("Cancel"), htab), SIGNAL(clicked()), this, SLOT(reject()));
    new QLabel(htab);
  }
}
예제 #23
0
void KOCRBase::introduceImage( KookaImage* img)
{
    if( ! (img && img->isFileBound()) ) return;
    KFileMetaInfo info = img->fileMetaInfo();
    QStringList groups;
    if ( info.isValid() )
         groups = info.preferredGroups();

    delete m_metaBox;
    m_metaBox = new QVBox( m_imgHBox );

    /* Start to create a preview job for the thumb */
    KURL::List li(img->url());
    KIO::Job *m_job = KIO::filePreview(li, m_previewSize.width(),
                                       m_previewSize.height());

    if( m_job )
    {
        connect( m_job, SIGNAL( result( KIO::Job * )),
                 this, SLOT( slPreviewResult( KIO::Job * )));
        connect( m_job, SIGNAL( gotPreview( const KFileItem*, const QPixmap& )),
                 SLOT( slGotPreview( const KFileItem*, const QPixmap& ) ));
         /* KIO::Jo result is called in any way: Success, Failed, Error,
          * thus connecting the failed is not really necessary.
          */
    }

    for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it )
    {
        QString theGroup(*it);

        kdDebug(29000) << "handling the group " << theGroup << endl;

        QStringList keys = info.group(theGroup).supportedKeys();

        if( keys.count() > 0 )
        {
            // info.groupInfo( theGroup )->translatedName()
            // FIXME: howto get the translated group name?
            QLabel *lGroup = new QLabel( theGroup, m_metaBox );
            lGroup->setBackgroundColor( QColor(gray));
            lGroup->setMargin( KDialog::spacingHint());

            QGrid *nGrid = new QGrid( 2,  m_metaBox );
            nGrid->setSpacing( KDialog::spacingHint());
            for ( QStringList::Iterator keyIt = keys.begin(); keyIt != keys.end(); ++keyIt )
            {
                KFileMetaInfoItem item = info.item(*keyIt);
                QString itKey = item.translatedKey();
                if( itKey.isEmpty() )
                    itKey = item.key();
                if( ! itKey.isEmpty() )
                {
                    (void) new QLabel( item.translatedKey() + ": ", nGrid );
                    (void) new QLabel( item.string(), nGrid );
                    kdDebug(29000) << "hasKey " << *keyIt << endl;
                }
            }
        }
    }
    QWidget *spaceEater = new QWidget( m_metaBox );
    spaceEater->setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored ));
    m_metaBox->show();
}