Beispiel #1
0
void BGDialog::slotIdentifyScreens()
{
    // Taken from PositionTab::showIdentify in kdebase/kcontrol/kicker/positiontab_impl.cpp
    for (unsigned s = 0; s < m_numScreens; s++) {
        QLabel *screenLabel = new QLabel(0, Qt::X11BypassWindowManagerHint);
        screenLabel->setObjectName("Screen Identify");

        QFont identifyFont(KGlobalSettings::generalFont());
        identifyFont.setPixelSize(100);
        screenLabel->setFont(identifyFont);

        screenLabel->setFrameStyle(QFrame::Panel);
        screenLabel->setFrameShadow(QFrame::Plain);

        screenLabel->setAlignment(Qt::AlignCenter);
        screenLabel->setNum(int(s + 1));
        // BUGLET: we should not allow the identification to be entered again
        //         until the timer fires.
        QTimer::singleShot(1500, screenLabel, SLOT(deleteLater()));

        QPoint screenCenter(QApplication::desktop()->screenGeometry(s).center());
        QRect targetGeometry(QPoint(0, 0), screenLabel->sizeHint());
        targetGeometry.moveCenter(screenCenter);

        screenLabel->setGeometry(targetGeometry);

        screenLabel->show();
    }
}
Beispiel #2
0
void KPrWebPresentationWizard::setupPage3()
{
    page3 = new QHBox( this );
    QWhatsThis::add( page3, i18n("This page allows you to specify the colors for "
                                 "your presentation display. Select individual "
                                 "items for more help on what they do.") );

    page3->setSpacing( KDialog::spacingHint() );
    page3->setMargin( KDialog::marginHint() );

    QLabel* sidebar = new QLabel( page3 );
    sidebar->setMinimumSize( 106, 318 );
    sidebar->setMaximumSize( 106, 318 );
    sidebar->setFrameShape( QFrame::Panel );
    sidebar->setFrameShadow( QFrame::Sunken );
    sidebar->setPixmap(locate("data", "kpresenter/pics/webslideshow-sidebar.png"));

    QWidget* canvas = new QWidget( page3 );
    QGridLayout *layout = new QGridLayout( canvas, 6, 2,
                                           KDialog::marginHint(), KDialog::spacingHint() );

    QLabel *helptext = new QLabel( canvas );
    helptext->setAlignment( Qt::WordBreak | Qt::AlignVCenter| Qt::AlignLeft );
    helptext->setText( i18n( "Now you can customize the colors of the web pages." ) );
    layout->addMultiCellWidget( helptext, 0, 0, 0, 1 );

    layout->addMultiCell( new QSpacerItem( 1, 50 ), 1, 1, 0, 1 );

    QLabel *label1 = new QLabel( i18n("Text color:"), canvas );
    label1->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    layout->addWidget( label1, 2, 0 );

    QLabel *label2 = new QLabel( i18n("Title color:"), canvas );
    label2->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    layout->addWidget( label2, 3, 0 );

    QLabel *label3 = new QLabel( i18n("Background color:"), canvas );
    label3->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    layout->addWidget( label3, 4, 0 );

    textColor = new KColorButton( webPres.getTextColor(), canvas );
    layout->addWidget( textColor, 2, 1 );

    titleColor = new KColorButton( webPres.getTitleColor(), canvas );
    layout->addWidget( titleColor, 3, 1 );

    backColor = new KColorButton( webPres.getBackColor(), canvas );
    layout->addWidget( backColor, 4, 1 );

    QSpacerItem* spacer = new QSpacerItem( 1, 10,
                                           QSizePolicy::Minimum, QSizePolicy::Expanding );
    layout->addMultiCell( spacer, 5, 5, 0, 1 );

    addPage( page3, i18n( "Step 3: Customize Colors" ) );

    setHelpEnabled(page3, false);  //doesn't do anything currently
}
Beispiel #3
0
void ModelPanel::addLabel(QGridLayout * gridLayout, QString text, int col, bool minimize)
{
  QLabel *label = new QLabel(this);
  label->setFrameShape(QFrame::Panel);
  label->setFrameShadow(QFrame::Raised);
  label->setMidLineWidth(0);
  label->setAlignment(Qt::AlignCenter);
  label->setMargin(5);
  label->setText(text);
  if (!minimize)
    label->setMinimumWidth(100);
  gridLayout->addWidget(label, 0, col, 1, 1);
}
Beispiel #4
0
TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings, FirmwareInterface * firmware):
    ModelPanel(parent, model, generalSettings, firmware),
    ui(new Ui::TelemetryCustomScreen),
    screen(screen)
{
    ui->setupUi(this);

    for (int l=0; l<4; l++) {
        for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
            fieldsCB[l][c] = new QComboBox(this);
            fieldsCB[l][c]->setProperty("index", c + (l<<8));
            ui->screenNumsLayout->addWidget(fieldsCB[l][c], l, c, 1, 1);
            connect(fieldsCB[l][c], SIGNAL(currentIndexChanged(int)), this, SLOT(customFieldChanged(int)));
        }
    }

    for (int l=0; l<4; l++) {
        barsCB[l] = new QComboBox(this);
        barsCB[l]->setProperty("index", l);
        connect(barsCB[l], SIGNAL(currentIndexChanged(int)), this, SLOT(barSourceChanged(int)));
        ui->screenBarsLayout->addWidget(barsCB[l], l, 0, 1, 1);

        minSB[l] = new QDoubleSpinBox(this);
        minSB[l]->setProperty("index", l);
        connect(minSB[l], SIGNAL(valueChanged(double)), this, SLOT(barMinChanged(double)));
        ui->screenBarsLayout->addWidget(minSB[l], l, 1, 1, 1);

        QLabel * label = new QLabel(this);
        label->setAutoFillBackground(false);
        label->setStyleSheet(QString::fromUtf8("Background:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 128, 255), stop:0.339795 rgba(0, 0, 128, 255), stop:0.339799 rgba(255, 255, 255, 255), stop:0.662444 rgba(255, 255, 255, 255),)\n"""));
        label->setFrameShape(QFrame::Panel);
        label->setFrameShadow(QFrame::Raised);
        label->setAlignment(Qt::AlignCenter);
        ui->screenBarsLayout->addWidget(label, l, 2, 1, 1);

        maxSB[l] = new QDoubleSpinBox(this);
        maxSB[l]->setProperty("index", l);
        connect(maxSB[l], SIGNAL(valueChanged(double)), this, SLOT(barMaxChanged(double)));
        ui->screenBarsLayout->addWidget(maxSB[l], l, 3, 1, 1);
    }

    disableMouseScrolling();

    update();
}
/// continue the creation of the widgets once the pieces XML was loaded.
/// this is where all the work of creating the family tabs and their content is performed.
void PicsSelectWidget::continueCreate()
{
	const PicBucket& bucket = PicBucket::instance();

	m_tabs = new QTabWidget(this);
	connect(m_tabs, SIGNAL(currentChanged(int)), this, SLOT(updateSetsSpinBox(int)));
	m_layout->addWidget(m_tabs);
	m_groups.resize(bucket.grps.size());

	for (int f = 0; f < bucket.families.size(); ++f)
	{
		const PicFamily &fam = bucket.families[f];

		SizedWidget *tab = new SizedWidget(QSize(6 * BOT_TOTAL_X + BOT_OFFS_X + FRAME_OFFS_SPACE_RIGHT - 5, NUM_DEFS * BOT_TOTAL_Y + FRAME_OFFS_Y), nullptr);
		//QWidget *tab = new QWidget();
		//tab->resize(QSize(6 * BOT_TOTAL_X + BOT_OFFS_X + FRAME_OFFS_SPACE_RIGHT, NUM_DEFS * BOT_TOTAL_Y + FRAME_OFFS_Y));

		QScrollArea *scroll = new QScrollArea();
		scroll->setWidget(tab);
		// the following is the voodoo needed to make the scroll area the same color as the tab
		// if this wasn't here, the scroll area would have gotten the default window color
		// this is significant in Windows XP with new apperance style where the tab color is 
		// different from the default window color
		scroll->viewport()->setAutoFillBackground(false);
		tab->setAutoFillBackground(false);
		// scroll area has a frame by default. get rid of it.
		scroll->setFrameShape(QFrame::NoFrame);

		m_tabs->addTab(scroll, fam.name.c_str());


		for (int g = fam.startIndex; g < fam.startIndex + fam.numGroups; ++g)
		{
			const PicGroupDef *grp = &(bucket.grps[g]);
			GroupCtrl &grpctrl = m_groups[g];
			int normg = (g - fam.startIndex); // normalized g with start of family

			QGroupBox *groupbox = new QGroupBox(grp->name.c_str(), tab);
			groupbox->move(BOT_OFFS_X-FRAME_OFFS_SPACE_LEFT, FRAME_OFFS_Y + normg*BOT_TOTAL_Y - 30);
			groupbox->resize(FRAME_OFFS_SPACE_RIGHT + grp->numPics() * BOT_TOTAL_X, BOT_Y + 55);

			grpctrl.num = new DataSpinBox(g, tab);
			grpctrl.num->move(grp->numPics() * BOT_TOTAL_X + BOT_OFFS_X + FRAME_OFFS_SPACE_RIGHT - 65, BOT_OFFS_Y + normg*BOT_TOTAL_Y + 40);
			grpctrl.num->resize(45, 23);
			grpctrl.num->setButtonSymbols(QAbstractSpinBox::PlusMinus);
			grpctrl.num->setRange(-1, MAX_IDENTICAL_PIECES); 
			grpctrl.num->setSpecialValueText("X");

			connect(grpctrl.num, SIGNAL(dvalueChanged(int, int)), this, SLOT(changedGrpBox(int, int)));


			for (int p = 0; p < bucket.grps[g].numPics(); ++p)
			{
				const PicDef* pic = &(grp->getPic(p));
				PicCtrl picctrl;
				int data = (g << 16) | p;

				DataPushButton *button = new DataPushButton(data, QIcon(pic->pixmap), QString(), tab);
				picctrl.bot = button;
				button->setCheckable(true);
				button->move(BOT_OFFS_X + p*BOT_TOTAL_X, BOT_OFFS_Y + normg * BOT_TOTAL_Y); // g normalized to start of family
				button->resize(BOT_X, BOT_Y);
				button->setIconSize(pic->pixmap.size()); // +1 because it's the texture + line, from Pieces.h
				connect(button, SIGNAL(pclicked(int, bool)), this, SLOT(pressedPicButton(int, bool)));

				DataSpinBox *spinbox = new DataSpinBox(data, tab);
				picctrl.num = spinbox;
				spinbox->setRange(0, MAX_IDENTICAL_PIECES);
				spinbox->move(BOT_OFFS_X + p*BOT_TOTAL_X + (BOT_X/5*2 + 2), BOT_OFFS_Y + normg*BOT_TOTAL_Y + BOT_Y + 5);
				spinbox->resize(BOT_X/5*3 - 4, EDIT_THICK + 1);
				spinbox->setButtonSymbols(QAbstractSpinBox::PlusMinus);
				
				connect(spinbox, SIGNAL(dvalueChanged(int, int)), this, SLOT(changedNumBox(int, int)));

				QLabel *solnum = new QLabel("0", tab);
				picctrl.snum = solnum;
				solnum->move(BOT_OFFS_X + p*BOT_TOTAL_X + 2, BOT_OFFS_Y + normg*BOT_TOTAL_Y + BOT_Y + 6);
				solnum->resize(BOT_X/5*2 - 4, EDIT_THICK); 
				solnum->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
				solnum->setFrameShadow(QFrame::Sunken);
				solnum->setFrameShape(QFrame::Panel);
				
				solnum->setPalette(*m_slvPalette);
				solnum->setVisible(false);


				grpctrl.pics.push_back(picctrl);
			}

		}

	}

	setBuildTilesCount(m_doc->getBuild().tilesCount());
	// prevent the build Help sidebar to get notifications. it might not be there yet.
	// eventually the sidebar will take care of itself.
	blockSignals(true); 
	changeToResetValues();
	blockSignals(false);

	m_bFinishedCreate = true;
}
void MainWindow::showRoomGrid()
{
    if(0!=Grid || 0!=scroll || 0!=layout)
    {
        delete Grid;
        delete scroll;
        delete layout;
    }
    layout = new QVBoxLayout();
    scroll = new QScrollArea(this);
    Grid = new QGridLayout(this);

    Grid->setHorizontalSpacing(6);
    Grid->setVerticalSpacing(6);
    scroll->setLayout(Grid);
    layout->addWidget(scroll);

    ui->Tabs2->widget(0)->setLayout(layout);
    vector<Room> Room;
    QString RoomNumTitle,RoomFloor;

    Room = RM.fetchAllRooms();

    int RoomSize=Room.size();
    int i=0,j=0;
    int num=0,RoomNum=0;

    while(num!=RoomSize)
    {
        QLabel * RoomLabel = new QLabel(this);
        RoomLabel->setGeometry(0,0,310,180);
        RoomLabel->setFrameShape(QFrame::Box);
        RoomLabel->setFrameShadow(QFrame::Sunken);
        RoomLabel->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
        RoomLabel->setFont(QFont( "Comic Sans MS", 8, QFont::Bold ));
        //-----------------------------------------------------------
        RoomNumTitle.setNum(Room[RoomNum].getRoomNumber());
        RoomFloor.setNum(Room[RoomNum].getRoomFloor());
        RoomLabel->setObjectName(RoomNumTitle);
        RoomLabel->setText("Num:"+RoomNumTitle+"\n Floor:"+RoomFloor);
        //-----------------------------------------------------------
        if(RM.getStatus(Room[RoomNum].getRoomNumber(),QDate::currentDate(),QDate::currentDate())==false)
            RoomLabel->setStyleSheet("color: white; background-color:green;");
        else
            RoomLabel->setStyleSheet("color: white; background-color:red;");
        //-----------------------------------------------------------
        RoomLabel->installEventFilter(this);
        Grid->addWidget(RoomLabel,i,j);
        num++;
        if(j<5)
        {
            j++;
        }
        else
        {
            j=0;
            i++;
        }
        RoomNum++;
    }
}
Beispiel #7
0
StaticFrameGui::StaticFrameGui(QWidget* parent): FrameGui(parent)
{

    setTitle("Static Frame");

    group = new QButtonGroup (this);
    grid = new QGridLayout (this);

    dewellSwitch = new QRadioButton (this);
    dewellSwitch->setText("Dewell (ms)");
    dewellSwitch->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
    repeatSwitch = new QRadioButton (this);
    repeatSwitch->setText("Repeat (frames)");
    repeatSwitch->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);

    group->addButton(dewellSwitch,1);
    group->addButton(repeatSwitch,2);

    grid->addWidget(dewellSwitch,2,0,1,1);
    grid->addWidget(repeatSwitch,3,0,1,1);

    QLabel * pointsLabel = new QLabel ("Points",this);
    pointsLabel->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
    pointsDisplay = new QLabel ("0",this);
    pointsDisplay->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
    grid->addWidget(pointsLabel,1,0,1,1);
    grid->addWidget(pointsDisplay,1,1,1,1);

    dewellEntry = new QSpinBox (this);
    dewellEntry->setMinimum (40);
    dewellEntry->setMaximum (600000);

    repeatEntry = new QSpinBox (this);
    repeatEntry->setMinimum (1);
    repeatEntry->setMaximum (1000);

    grid->addWidget(dewellEntry,2,1,1,1);
    grid->addWidget(repeatEntry,3,1,1,1);
    QLabel *l = new QLabel (this);
    l->setText("ArcBall");
    l->setFrameShape(QFrame::Panel);
    l->setFrameShadow(QFrame::Raised);
    l->setAlignment(Qt::AlignHCenter);
    arcball = new ArcBall(this);
    connect (arcball,SIGNAL(angleChanged(QQuaternion)),this,SLOT(angleChangedData(QQuaternion)));
    connect (arcball,SIGNAL(mouseDown()),this,SLOT(arcballDown()));
    connect (arcball,SIGNAL(mouseUp()),this,SLOT(arcballUp()));
    grid->addWidget(l,4,0);
    grid->addWidget(arcball,5,0);
    l = new QLabel (this);
    l->setText ("Size");
    l->setFrameShape(QFrame::Panel);
    l->setFrameShadow(QFrame::Raised);
    l->setAlignment(Qt::AlignHCenter);
    grid->addWidget(l,4,1);
    size = new QSlider(Qt::Vertical,this);
    size->setRange(-200,100);
    size->setSliderPosition(0);
    grid->addWidget(size,5,1);
    setLayout(grid);
}
QWidget *DynamicConnectionPageWindow::createDynamicWidget(WidgetType widgetType, DynamicWidgetInfo *widgetInfo) const
{
    QWidget *widget = 0;
    QString value = getValue(widgetInfo->attributes.value("value"));

    switch(widgetType){
    case Label:
    {
        QLabel *label = new QLabel(value);
        label->setFrameShape(QFrame::StyledPanel);
        label->setFrameShadow(QFrame::Sunken);
        label->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);
        widget = label;
        break;
    }
    case CheckBox:
    {
        QCheckBox *checkBox = new QCheckBox();
        checkBox->setChecked(value == "true");
        widget = checkBox;
        break;
    }
    case ComboBox:
    {
        QComboBox *comboBox = new QComboBox();
        QDomNodeList childNodes = widgetInfo->childNodes;
        for(int i=0; i<childNodes.size(); ++i){
            QDomNode e = childNodes.at(i);
            Q_ASSERT(e.nodeName() == "option");
            comboBox->addItem(e.attributes().namedItem("text").toAttr().value());
        }
        if(!value.isEmpty()){
            comboBox->setCurrentIndex(value.toInt());
        }

        widget = comboBox;
        break;
    }
    case RadioButton:
    {
        RadioButtonGroup *radioButtonGroup = new RadioButtonGroup(widgetInfo->attributes.value("caption").isEmpty() ? Qt::Horizontal : Qt::Vertical);
        QDomNodeList childNodes = widgetInfo->childNodes;
        for(int i=0; i<childNodes.size(); ++i){
            QDomNode e = childNodes.at(i);
            Q_ASSERT(e.nodeName() == "option");
            QString text = e.attributes().namedItem("text").toAttr().value();
            QRadioButton *radio = new QRadioButton(text);
            radioButtonGroup->addRadioButton(radio);
        }

        if(!value.isEmpty()){
            radioButtonGroup->checkRadio(value.toInt());
        }

        widget = radioButtonGroup;
        break;
    }
    default:
        Q_ASSERT(false);
        return 0;
        break;
    }

    QString widgetName = widgetInfo->attributes.value("name");
    widget->setObjectName(widgetName);

    return widget;
}
Beispiel #9
0
bool RotateDlg::rotate(Rotation & map)
{
	Dimension dim = map.size();
    assert( dim == int(d_labels.size()) );
	d_buttons.resize( Extension( dim, dim ) );
	const int ncol = 2;
    const int nrow = (d_editAtomType)?3:2;
	d_cbs.assign( dim, 0 );

	QVBoxLayout* top = new QVBoxLayout(this);
	top->setMargin( 10 );
	QGridLayout* contents = new QGridLayout();
	QHBoxLayout* buttons = new QHBoxLayout();

    QLabel* l = new QLabel( d_colLabel.data(), this );
	l->setAlignment( Qt::AlignCenter | Qt::AlignVCenter );
	l->setFrameStyle( QFrame::Panel );
	l->setFrameShadow( QFrame::Sunken );
	contents->addWidget( l, 0, 2, 1, dim + 1 - 2 + 1 );

    l = new QLabel( d_rowLabel.data(), this );
	l->setAlignment( Qt::AlignCenter | Qt::AlignVCenter );
	l->setFrameStyle( QFrame::Panel );
	l->setFrameShadow( QFrame::Sunken );
	contents->addWidget( l, nrow, 0, dim, 1 );

	Dimension row;
	for( row = 0; row < dim; row++ )
	{
		QString str;

        // Set row headers
        if( !d_labels[ row ].first.isEmpty() )
            str.sprintf( "Dim. %s: %s", (d_dimLetter)?getDimLetter(row):getDimSymbol(row), d_labels[ row ].first.data() );
        else
            str.sprintf( "Dim. %s", (d_dimLetter)?getDimLetter(row):getDimSymbol(row) );
		l = new QLabel( str, this );
		l->setAlignment( Qt::AlignCenter | Qt::AlignVCenter );
		l->setFrameStyle( QFrame::Panel );
		l->setFrameShadow( QFrame::Sunken );
		contents->addWidget( l, 1, row + ncol ); 

        // Set column headers
        if( !d_labels[ row ].second.isEmpty() )
            str.sprintf( "Dim. %s: %s", (d_dimLetter)?getDimLetter(row):getDimSymbol(row), d_labels[ row ].second.data() );
        else
            str.sprintf( "Dim. %s", (d_dimLetter)?getDimLetter(row):getDimSymbol(row) );
        l = new QLabel( str, this );
		l->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
		l->setFrameStyle( QFrame::Panel );
		l->setFrameShadow( QFrame::Sunken );
		contents->addWidget( l, row + nrow, 1 );

        if( d_editAtomType )
		{
			d_cbs[ row ] = new QComboBox( this );
			for( int i = AtomType::None; i <= AtomType::Lr; i++ )
				d_cbs[ row ]->addItem( AtomType::s_labels[ i ] );
			d_cbs[ row ]->setCurrentIndex( d_clr[ row ].getIsoType() );
			contents->addWidget( d_cbs[ row ], nrow - 1, row + ncol );
		}
		
		for( Dimension col = 0; col < dim; col++ )
		{
			QRadioButton* b = new QRadioButton( this );
			b->setAutoExclusive( false );
			//b->setToggleButton( true );
			contents->addWidget( b, row + nrow, col + ncol, Qt::AlignHCenter ); 
			d_buttons.setAt( row, col, b );
			connect( b, SIGNAL( toggled(bool) ), this, SLOT( toggled(bool) ) );
		}
	}
	// Toggle erst zuletzt, da vorher noch nicht alle Buttons existieren.
	for( row = 0; row < dim; row++ )
		for( Dimension col = 0; col < dim; col++ )
		{
			if( map[ row ] == col )
				d_buttons.getAt( row, col )->setChecked( true );
		}

	QPushButton* ok = new QPushButton( "&OK", this );
	connect( ok, SIGNAL( clicked() ), SLOT( accept() ) );
	buttons->addWidget( ok );
	ok->setDefault( true );

	QPushButton* cancel = new QPushButton( "&Cancel", this );
	connect( cancel, SIGNAL( clicked() ), SLOT( reject() ) );
	buttons->addWidget( cancel );

	top->addLayout( contents );
	top->addLayout( buttons );

	while( true )
	{
		if( exec() == QDialog::Accepted )
		{
			Rotation map2 = map;
			bool clrOk = true;
			for( int row = 0; row < dim; row++ )
			{
				for( int col = 0; col < dim; col++ )
				{
					if( d_buttons.getAt( row, col )->isChecked() )
					{
						map2[ row ] = col;
					}
				}
                if( d_editAtomType )
				{
					d_clr[ row ] = AtomType::Isotope( d_cbs[ row ]->currentIndex() );
					if( d_clr[ row ].isNone() )
						clrOk = false;
				}
			}
			if( !map2.isValid() )
			{
				QMessageBox::critical( this, "Rotate dimensions", 
					"Dimension assignments have to be unique!" );
			}else if( !clrOk )
			{
				QMessageBox::critical( this, "Rotate dimensions", 
					"Atom types must not be empty!" );
			}else
			{
				map = map2;
				return true;
			}
		}else
			return false;
	}
}
WidgetImage::WidgetImage(QWidget *parent) : QWidget(parent), toolbar(0),
  statusbar(0), paintWnd(0), scrollArea(0), zoomBox(0) {
  toolbar = new QToolBar(tr("Image"),this);
  statusbar = new QStatusBar(this);
  paintWnd = new PaintWidget();
  scrollArea = new QScrollArea(this);
  scrollArea->setWidget(paintWnd);
  scrollArea->setWidgetResizable(true);

  QAction* action = new QAction(QIcon(":/icons/resources/save.png"),tr("Save Image"),toolbar);
  connect(action,SIGNAL(triggered()),paintWnd,SLOT(saveImage()));
  toolbar->addAction(action);
  toolbar->addSeparator();
  action = new QAction(QIcon(":/icons/resources/arrow_in.png"),tr("Fit to Window"),toolbar);
  action->setCheckable(true);
  action->setChecked(true);
  connect(action,SIGNAL(triggered(bool)),this,SLOT(toggleFitToWindow(bool)));
  connect(action,SIGNAL(triggered(bool)),paintWnd,SLOT(toggleFitToWindow(bool)));
  toolbar->addAction(action);
  action = new QAction(QIcon(":/icons/resources/zoom_100.png"),tr("Zoom 100%"),toolbar);
  action->setEnabled(false);
  connect(action,SIGNAL(triggered()),paintWnd,SLOT(zoomImage100()));
  toolbar->addAction(action);
  zoomBox = new QSpinBox(toolbar);
  zoomBox->setToolTip(tr("Zoom Image"));
  zoomBox->setRange(0,999);
  zoomBox->setSingleStep(10);
  zoomBox->setSuffix("%");
  zoomBox->setButtonSymbols(QAbstractSpinBox::PlusMinus);
  zoomBox->setEnabled(false);
  connect(zoomBox,SIGNAL(valueChanged(int)),paintWnd,SLOT(zoomImage(int)));
  connect(paintWnd,SIGNAL(setZoom(int)),zoomBox,SLOT(setValue(int)));
  toolbar->addWidget(zoomBox);

  QLabel* typeLabel = new QLabel(statusbar);
  typeLabel->setTextFormat(Qt::PlainText);
  typeLabel->setTextInteractionFlags(Qt::NoTextInteraction);
  typeLabel->setFrameShadow(QFrame::Sunken);
  statusbar->addPermanentWidget(typeLabel);
  QLabel* sizeLabel = new QLabel(statusbar);
  sizeLabel->setTextFormat(Qt::PlainText);
  sizeLabel->setTextInteractionFlags(Qt::NoTextInteraction);
  sizeLabel->setFrameShadow(QFrame::Sunken);
  statusbar->addPermanentWidget(sizeLabel);
  QLabel* posLabel = new QLabel(statusbar);
  posLabel->setTextFormat(Qt::PlainText);
  posLabel->setTextInteractionFlags(Qt::NoTextInteraction);
  posLabel->setFrameShape(QFrame::NoFrame);
  statusbar->addWidget(posLabel,1);
  connect(paintWnd,SIGNAL(setStatusMsg(QString,int)),statusbar,SLOT(showMessage(QString,int)),Qt::QueuedConnection);
  connect(paintWnd,SIGNAL(printImageSize(QString)),sizeLabel,SLOT(setText(QString)),Qt::QueuedConnection);
  connect(paintWnd,SIGNAL(printImageType(QString)),typeLabel,SLOT(setText(QString)),Qt::QueuedConnection);
  connect(paintWnd,SIGNAL(printImagePos(QString)),posLabel,SLOT(setText(QString)),Qt::QueuedConnection);

  QVBoxLayout* layout = new QVBoxLayout();
  layout->addWidget(toolbar);
  layout->addWidget(scrollArea,1);
  layout->addWidget(statusbar);
  layout->setSpacing(0);
  layout->setContentsMargins(0,0,0,0);
  setLayout(layout);
}
Beispiel #11
0
void KPrWebPresentationWizard::setupPage5()
{
    page5 = new QHBox( this );
    QWhatsThis::add( page5, i18n("This page allows you to specify some options for "
                                 "presentations which run unattended, such as time "
                                 "elapsed before advancing to the next slide, looping "
                                 "and the presence of headers. If you do not want "
                                 "an unattended presentation, just leave defaults unchanged.") );
    page5->setSpacing( KDialog::spacingHint() );
    page5->setMargin( KDialog::marginHint() );

    QLabel* sidebar = new QLabel( page5 );
    sidebar->setMinimumSize( 106, 318 );
    sidebar->setMaximumSize( 106, 318 );
    sidebar->setFrameShape( QFrame::Panel );
    sidebar->setFrameShadow( QFrame::Sunken );
    sidebar->setPixmap(locate("data", "kpresenter/pics/webslideshow-sidebar.png"));

    QWidget* canvas = new QWidget( page5 );
    QGridLayout *layout = new QGridLayout( canvas, 6, 2,
                                           KDialog::marginHint(), KDialog::spacingHint() );

    QLabel *helptext = new QLabel( canvas );
    helptext->setAlignment( Qt::WordBreak | Qt::AlignVCenter| Qt::AlignLeft );
    QString help = i18n("Here you can configure some options for unattended "
                        "presentations, such as time elapsed before automatically advance to "
                        "the next slide, looping and the presence of headers.");
    helptext->setText(help);

    layout->addMultiCellWidget( helptext, 0, 0, 0, 1 );

    layout->addMultiCell( new QSpacerItem( 1, 50 ), 1, 1, 0, 1 );

    QLabel *label1 = new QLabel( i18n("Advance after:"), canvas );
    label1->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    QWhatsThis::add( label1, i18n( "This selection allows you to specify "
                                   "the time between slides." ) );
    layout->addWidget( label1, 2, 0 );

    timeBetweenSlides = new KIntNumInput( webPres.getTimeBetweenSlides(), canvas );
    timeBetweenSlides->setSpecialValueText(i18n( "Disabled" ));
    QWhatsThis::add( timeBetweenSlides, i18n( "This selection allows you to specify "
                                 "the time between slides." ) );
    layout->addWidget( timeBetweenSlides, 2, 1 );
    timeBetweenSlides->setSuffix( " seconds" );
    timeBetweenSlides->setRange( 0, 900, 1 );

    layout->addMultiCell( new QSpacerItem( 1, 10 ), 1, 1, 0, 1 );

    writeHeader=new QCheckBox( i18n("Write header to the slides"), canvas);
    QWhatsThis::add( writeHeader, i18n( "This checkbox allows you to specify if you "
                                       "want to write the navigation buttons on top "
                                       "of the slide." ) );
    writeHeader->setChecked( webPres.wantHeader() );
    layout->addWidget( writeHeader, 3, 1);

    writeFooter=new QCheckBox( i18n("Write footer to the slides"), canvas);
    QWhatsThis::add( writeFooter, i18n( "This checkbox allows you to specify if you "
                                       "want to write an imprint consisting on the author "
                                       "and the software used to create these slides." ) );
    writeFooter->setChecked( webPres.wantFooter() );
    layout->addWidget( writeFooter, 4, 1);

    loopSlides=new QCheckBox( i18n("Loop presentation"), canvas);
    QWhatsThis::add( loopSlides, i18n( "This checkbox allows you to specify if you "
                                       "want the presentation to start again once "
                                       "the latest slide is reached." ) );
    loopSlides->setChecked( webPres.wantLoopSlides() );
    layout->addWidget( loopSlides, 5, 1);

    QSpacerItem* spacer = new QSpacerItem( 1, 10,
                                           QSizePolicy::Minimum, QSizePolicy::Expanding );
    layout->addMultiCell( spacer, 5, 5, 0, 1 );

    addPage( page5, i18n( "Step 5: Options for Unattended Presentations" ) );

    setHelpEnabled(page5, false);  //doesn't do anything currently

    setFinish( page5, true );
}
Beispiel #12
0
void KPrWebPresentationWizard::setupPage4()
{
    page4 = new QHBox( this );
    QWhatsThis::add( page4, i18n("This page allows you to modify the titles of "
                                 "each slide, if required. You normally do not need "
                                 "to do this, but it is available if required.") );
    page4->setSpacing( KDialog::spacingHint() );
    page4->setMargin( KDialog::marginHint() );

    QLabel* sidebar = new QLabel( page4 );
    sidebar->setMinimumSize( 106, 318 );
    sidebar->setMaximumSize( 106, 318 );
    sidebar->setFrameShape( QFrame::Panel );
    sidebar->setFrameShadow( QFrame::Sunken );
    sidebar->setPixmap(locate("data", "kpresenter/pics/webslideshow-sidebar.png"));

    QWidget* canvas = new QWidget( page4 );
    QGridLayout *layout = new QGridLayout( canvas, 3, 2,
                                           KDialog::marginHint(), KDialog::spacingHint() );

    QLabel *helptext = new QLabel( canvas );
    helptext->setAlignment( Qt::WordBreak | Qt::AlignVCenter| Qt::AlignLeft );
    helptext->setText( i18n( "Here you can specify titles for "
                             "each slide. Click on a slide in "
                             "the list and then enter the title "
                             "in the textbox below. If you "
                             "click on a title, KPresenter "
                             "mainview will display the slide.") );

    layout->addMultiCellWidget( helptext, 0, 0, 0, 1 );

    QLabel *label = new QLabel( i18n( "Slide title:" ), canvas );
    label->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    layout->addWidget( label, 1, 0 );

    slideTitle = new KLineEdit( canvas );
    layout->addWidget( slideTitle, 1, 1 );
    connect( slideTitle, SIGNAL( textChanged( const QString & ) ), this,
             SLOT( slideTitleChanged( const QString & ) ) );

    slideTitles = new KListView( canvas );
    layout->addMultiCellWidget( slideTitles, 2, 2, 0, 1 );
    slideTitles->addColumn( i18n( "No." ) );
    slideTitles->addColumn( i18n( "Slide Title" ) );
    connect( slideTitles, SIGNAL( selectionChanged( QListViewItem * ) ), this,
             SLOT( slideTitleChanged( QListViewItem * ) ) );
    slideTitles->setSorting( -1 );
    slideTitles->setAllColumnsShowFocus( true );
    slideTitles->setResizeMode( QListView::LastColumn );
    slideTitles->header()->setMovingEnabled( false );

    QValueList<KPrWebPresentation::SlideInfo> infos = webPres.getSlideInfos();
    for ( int i = infos.count() - 1; i >= 0; --i ) {
        KListViewItem *item = new KListViewItem( slideTitles );
        item->setText( 0, QString::number( i + 1 ) );
        //kdDebug(33001) << "KPrWebPresentationWizard::setupPage3 " << infos[ i ].slideTitle << endl;
        item->setText( 1, infos[ i ].slideTitle );
    }

    slideTitles->setSelected( slideTitles->firstChild(), true );

    addPage( page4, i18n( "Step 4: Customize Slide Titles" ) );

    setHelpEnabled(page4, false);  //doesn't do anything currently
}
Beispiel #13
0
void KPrWebPresentationWizard::setupPage2()
{
    page2 = new QHBox( this );
    QWhatsThis::add( page2, i18n("This page allows you to specify how the HTML "
                                 "for your presentation will be displayed. Select "
                                 "individual items for more help on what they do.") );
    page2->setSpacing( KDialog::spacingHint() );
    page2->setMargin( KDialog::marginHint() );

    QLabel* sidebar = new QLabel( page2 );
    sidebar->setMinimumSize( 106, 318 );
    sidebar->setMaximumSize( 106, 318 );
    sidebar->setFrameShape( QFrame::Panel );
    sidebar->setFrameShadow( QFrame::Sunken );
    sidebar->setPixmap(locate("data", "kpresenter/pics/webslideshow-sidebar.png"));

    QWidget* canvas = new QWidget( page2 );
    QGridLayout *layout = new QGridLayout( canvas, 6, 2,
                                           KDialog::marginHint(), KDialog::spacingHint() );

    QLabel *helptext = new QLabel( canvas );
    helptext->setAlignment( Qt::WordBreak | Qt::AlignVCenter| Qt::AlignLeft );
    QString help = i18n("Here you can configure the style of the web pages.");
    help += i18n( "You can also specify the zoom for the slides." );
    helptext->setText(help);

    layout->addMultiCellWidget( helptext, 0, 0, 0, 1 );

    layout->addMultiCell( new QSpacerItem( 1, 50 ), 1, 1, 0, 1 );

    QLabel *label1 = new QLabel( i18n("Zoom:"), canvas );
    label1->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    QWhatsThis::add( label1, i18n( "This selection allows you to specify "
                                   "the size of the slide image." ) );
    layout->addWidget( label1, 2, 0 );

    QLabel *label2 = new QLabel( i18n( "Encoding:" ), canvas );
    label2->setAlignment( Qt::AlignVCenter | Qt::AlignRight );

    layout->addWidget( label2, 3, 0 );

    QLabel *label3 = new QLabel( i18n( "Document type:" ), canvas );
    label3->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    layout->addWidget( label3, 4, 0 );

    zoom = new KIntNumInput( webPres.getZoom(), canvas );
    QWhatsThis::add( zoom, i18n( "This selection allows you to specify "
                                 "the size of the slide image." ) );
    layout->addWidget( zoom, 2, 1 );
    zoom->setSuffix( " %" );
    zoom->setRange( 25, 1000, 5 );

    encoding = new KComboBox( false, canvas );
    layout->addWidget( encoding, 3, 1 );

    // Fill encoding combo
    // Stolen from kdelibs/kate/part/katedialogs.cpp
    QStringList encodings(KGlobal::charsets()->descriptiveEncodingNames());
    int idx = 0;
    for (uint i = 0; i < encodings.count(); i++)
    {
      bool found = false;
      QTextCodec *codecForEnc = KGlobal::charsets()->codecForName(KGlobal::charsets()->encodingForName(encodings[i]), found);
      if (found)
      {
        encoding->insertItem(encodings[i]);

        if ( codecForEnc->name() == webPres.getEncoding() )
          encoding->setCurrentItem(idx);
        idx++;
      }
    }

    doctype = new KComboBox( false, canvas );
    layout->addWidget( doctype, 4, 1 );
    doctype->insertItem( "HTML 4.01", -1 );
    doctype->insertItem( "XHTML 1.0", -1 );

    doctype->setCurrentItem( webPres.isXML() ? 1 : 0 );

    QSpacerItem* spacer = new QSpacerItem( 1, 10,
                                           QSizePolicy::Minimum, QSizePolicy::Expanding );
    layout->addMultiCell( spacer, 5, 5, 0, 1 );

    addPage( page2, i18n( "Step 2: Configure HTML" ) );

    setHelpEnabled(page2, false);  //doesn't do anything currently
}
Beispiel #14
0
void KPrWebPresentationWizard::setupPage1()
{
    page1 = new QHBox( this );
    QWhatsThis::add( page1, i18n("This page allows you to specify some of the key"
                                 " values for how your presentation will be shown"
                                 " in HTML. Select individual items for more help"
                                 " on what they do.") );
    page1->setSpacing( KDialog::spacingHint() );
    page1->setMargin( KDialog::marginHint() );

    QLabel* sidebar = new QLabel( page1 );
    sidebar->setMinimumSize( 106, 318 );
    sidebar->setMaximumSize( 106, 318 );
    sidebar->setFrameShape( QFrame::Panel );
    sidebar->setFrameShadow( QFrame::Sunken );
    sidebar->setPixmap(locate("data", "kpresenter/pics/webslideshow-sidebar.png"));

    QWidget* canvas = new QWidget( page1 );
    QGridLayout *layout = new QGridLayout( canvas, 7, 2,
                                           KDialog::marginHint(), KDialog::spacingHint() );

    QLabel *helptext = new QLabel( canvas );
    helptext->setAlignment( Qt::WordBreak | Qt::AlignTop| Qt::AlignLeft );
    helptext->setText( i18n( "Enter your name, email address and "
                             "the title of the web presentation. "
                             "Also enter the output directory where the "
                             "web presentation should be saved. " ) );
    layout->addMultiCellWidget( helptext, 0, 0, 0, 1 );

    layout->addMultiCell( new QSpacerItem( 1, 50 ), 1, 1, 0, 1 );

    QLabel *label1 = new QLabel( i18n("Author:"), canvas );
    label1->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    QWhatsThis::add( label1, i18n("This is where you enter the name of the person or "
                                  "organization that should be named as the author of "
                                  "the presentation.") );
    layout->addWidget( label1, 2, 0 );

    QLabel *label2 = new QLabel( i18n("Title:"), canvas );
    label2->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    QWhatsThis::add( label2, i18n("This is where you enter the title of the overall "
                                  "presentation." ) );
    layout->addWidget( label2, 3, 0 );

    QLabel *label3 = new QLabel( i18n("Email address:"), canvas );
    label3->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    QWhatsThis::add( label3, i18n("This is where you enter the email address of the "
                                  "person or organization that is responsible for "
                                  "the presentation.") );
    layout->addWidget( label3, 4, 0 );

    QLabel *label4 = new QLabel( i18n("Path:"), canvas );
    label4->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
    QWhatsThis::add( label4, i18n("The value entered for the path is the directory "
                                  "where the presentation will be saved. If it does "
                                  "not exist, you'll be asked if you want to create "
                                  "the directory or abort the creation.") );
    layout->addWidget( label4, 5, 0 );

    author = new KLineEdit( webPres.getAuthor(), canvas );
    QWhatsThis::add( author, i18n("This is where you enter the name of the person or "
                                  "organization that should be named as the author of "
                                  "the presentation.") );
    layout->addWidget( author, 2, 1 );

    title = new KLineEdit( webPres.getTitle(), canvas );
    QWhatsThis::add( title, i18n("This is where you enter the title of the overall "
                                 "presentation." ) );
    layout->addWidget( title, 3, 1 );

    email = new KLineEdit( webPres.getEmail(), canvas );
    QWhatsThis::add( email, i18n("This is where you enter the email address of the "
                                 "person or organization that is responsible for "
                                 "the presentation.") );
    layout->addWidget( email, 4, 1 );

    path=new KURLRequester( canvas );
    path->setMode( KFile::Directory);
    path->lineEdit()->setText(webPres.getPath());
    QWhatsThis::add( path, i18n("The value entered for the path is the directory "
                                "where the presentation will be saved. If it does "
                                "not exist, you'll be asked if you want to create "
                                "the directory or abort the creation.") );
    layout->addWidget( path, 5, 1 );

    QSpacerItem* spacer = new QSpacerItem( 1, 10,
                                           QSizePolicy::Minimum, QSizePolicy::Expanding );
    layout->addMultiCell( spacer, 6, 6, 0, 1 );

    connect(path, SIGNAL(textChanged(const QString&)),
            this,SLOT(slotChoosePath(const QString&)));
    connect(path, SIGNAL(urlSelected( const QString& )),
            this,SLOT(slotChoosePath(const QString&)));

    addPage( page1, i18n( "Step 1: General Information" ) );

    setHelpEnabled(page1, false);  //doesn't do anything currently
}