Esempio n. 1
0
InsertGraphics::InsertGraphics(QWidget *parent, InsertGraphicsConfig *conf)
		: QDialog(parent) {
	setWindowTitle(tr("Insert Graphic"));
	setModal(true);
	ui.setupUi(this);
	ui.fileSelectButton->setIcon(getRealIcon("fileopen"));
	ui.pbSaveDefault->setIcon(getRealIcon("filesave"));

	connect(ui.leFile, SIGNAL(textChanged(const QString &)), this, SIGNAL(fileNameChanged(const QString &)));
	connect(ui.fileSelectButton, SIGNAL(clicked()), this, SLOT(chooseFile()));
	connect(ui.rbWidthHeight, SIGNAL(toggled(bool)), this, SLOT(includeOptionChanged()));
	connect(ui.rbUser, SIGNAL(toggled(bool)), this, SLOT(includeOptionChanged()));
	connect(ui.cbWidth, SIGNAL(toggled(bool)), this, SLOT(includeOptionChanged()));
	connect(ui.cbHeight, SIGNAL(toggled(bool)), this, SLOT(includeOptionChanged()));
	connect(ui.leWidth, SIGNAL(textChanged(QString)), this, SLOT(includeOptionChanged()));
	connect(ui.leHeight, SIGNAL(textChanged(QString)), this, SLOT(includeOptionChanged()));
	connect(ui.cbWidthUnit, SIGNAL(currentIndexChanged(QString)), this, SLOT(includeOptionChanged()));
	connect(ui.cbHeightUnit, SIGNAL(currentIndexChanged(QString)), this, SLOT(includeOptionChanged()));
        connect(ui.upButton, SIGNAL(clicked()), this, SLOT(posMoveItemUp()));
        connect(ui.downButton, SIGNAL(clicked()), this, SLOT(posMoveItemDown()));
        connect(ui.leLabel, SIGNAL(textChanged(QString)), this, SLOT(labelChanged(QString)));
	connect(ui.pbSaveDefault, SIGNAL(clicked()), this, SLOT(saveDefault()));
	connect(this, SIGNAL(fileNameChanged(const QString &)), this, SLOT(updateLabel(const QString &)));
        setWindowTitle(tr("Insert Graphics","Wizard"));

        // adjust listPlacement size
	ui.listPlacement->addItem(new QListWidgetItem(tr("Here"), ui.listPlacement, InsertGraphics::PlaceHere));
	ui.listPlacement->addItem(new QListWidgetItem(tr("Top"), ui.listPlacement, InsertGraphics::PlaceTop));
	ui.listPlacement->addItem(new QListWidgetItem(tr("Bottom"), ui.listPlacement, InsertGraphics::PlaceBottom));
	ui.listPlacement->addItem(new QListWidgetItem(tr("Page"), ui.listPlacement, InsertGraphics::PlacePage));

	int rows = ui.listPlacement->count();
        int rowSize = ui.listPlacement->sizeHintForRow(0);
        int height = rows * rowSize;
        int frameWidth = ui.listPlacement->frameWidth();
        ui.listPlacement->setFixedHeight(height + frameWidth * 2);

	includeOptionChanged();
        filter = "Images (*.eps *.jpg *.png *.pdf)";

	ui.cbWidthUnit->insertItems(0, widthUnits);
	ui.cbHeightUnit->insertItems(0, heightUnits);
        autoLabel = true;

	defaultConfig = conf;
	setConfig(*conf);
}
PrioritySwitcher::PrioritySwitcher(int pid, bool useFifoScheduling) : pid((pid_t) pid), defaultPriority(-1), fifoScheduling(useFifoScheduling)
{
	saveDefault();
}