示例#1
0
    NotifyWindow()
    : QMainWindow(0, Qt::SplashScreen | Qt::WindowStaysOnTopHint) {

        QFont font = message_label.font();
        font.setBold(true);
        font.setPointSize(12);
        message_label.setFont(font);

        message_label.setWordWrap(true);
        message_label.setFrameShape(QFrame::WinPanel);
        message_label.setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
        message_label.setGeometry(0, 0, WIDTH, HEIGHT);

        setCentralWidget(&message_label);

        setStyleSheet("background-color: white;");
    }
AboutQtDialog::AboutQtDialog() : QWidget(NULL)
{
	setWindowTitle(tr("About Qt"));
	StyleStorage::staticStorage(RSR_STORAGE_STYLESHEETS)->insertAutoStyle(this, STS_PLUGINMANAGER_ABOUT_QT);

	CustomBorderContainer *border = CustomBorderStorage::staticStorage(RSR_STORAGE_CUSTOMBORDER)->addBorder(this, CBS_DIALOG);
	if (border)
	{
		border->setAttribute(Qt::WA_DeleteOnClose, true);
		border->setResizable(false);
		border->setMinimizeButtonVisible(false);
		border->setMaximizeButtonVisible(false);
	}
	else
	{
		setAttribute(Qt::WA_DeleteOnClose, true);
		setWindowFlags(Qt::Dialog | Qt::WindowTitleHint);
	}

#ifdef Q_WS_MAC
	setWindowGrowButtonEnabled(this->window(), false);
#endif

	// creating layouts and items
	// main layout
	setLayout(new QVBoxLayout(this));

	layout()->setContentsMargins(8, 18, 8, 6);
	layout()->setSpacing(14);

	// text and icon layout
	QHBoxLayout * textLayout = new QHBoxLayout;
	textLayout->setSpacing(6);
	CustomLabel * icon = new CustomLabel(this);
	IconStorage::staticStorage(RSR_STORAGE_MENUICONS)->insertAutoIcon(icon, MNI_PLUGINMANAGER_ABOUT_QT, 0, 0, "pixmap");
	icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
	icon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding);
	textLayout->addWidget(icon);
	QVBoxLayout * captLayout = new QVBoxLayout;
	captLayout->setSpacing(8);
	CustomLabel * caption = new CustomLabel(this);
	caption->setObjectName("caption");
	caption->setText(tr("About Qt"));

	CustomLabel * text = new CustomLabel(this);
	text->setTextFormat(Qt::RichText);
	text->setWordWrap(true);
	text->setMaximumWidth(350);
	text->setOpenExternalLinks(true);
	text->setObjectName("lblAboutQtText");

	GraphicsEffectsStorage::staticStorage(RSR_STORAGE_GRAPHICSEFFECTS)->installGraphicsEffect(text, GFX_LABELS);
	QString localizedText = tr("<p>This program uses Qt version %1.</p>"
				   "<p>Qt is a C++ toolkit for cross-platform application "
				   "development.</p>"
				   "<p>Qt provides single-source portability across MS&nbsp;Windows, "
				   "Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. "
				   "Qt is also available for embedded devices as Qt for Embedded Linux "
				   "and Qt for Windows CE.</p>"
				   "<p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the "
				   "development of Qt applications (proprietary or open source) provided "
				   "you can comply with the terms and conditions of the GNU LGPL version "
				   "2.1.</p>"
				   "<p>Please see <a href=\"http://qt.nokia.com/products/licensing\">qt.nokia.com/products/licensing</a> "
				   "for an overview of Qt licensing.</p>"
				   "<p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p>"
				   "<p>Qt is a Nokia product. See <a href=\"http://qt.nokia.com/\">qt.nokia.com</a> "
				   "for more information.</p>").arg(QLatin1String(QT_VERSION_STR));
	// adding shadow (it's a rich text)
	text->setText(localizedText);
	captLayout->addWidget(caption);
	captLayout->addWidget(text);
	textLayout->addItem(captLayout);

	// button layout
	QHBoxLayout * buttonLayout = new QHBoxLayout;
	buttonLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding));
	QPushButton * okButton = new QPushButton(this);
	okButton->setDefault(true);
	okButton->setAutoDefault(false);
	okButton->setText(tr("OK"));
	connect(okButton, SIGNAL(clicked()), (parentWidget() ? parentWidget() : this), SLOT(close()));
	buttonLayout->addWidget(okButton);

	layout()->addItem(textLayout);
	layout()->addItem(buttonLayout);
}
示例#3
0
Scale::Scale(bool verbose, QWidget *parent) : MyWidget(parent) {

	this->setVisibleArea(QSize(550,300));

	// Some variables
	ignoreSizeChange = false;
	this->verbose = verbose;

	// A title label
	CustomLabel *title = new CustomLabel("<center><h1>" + tr("Scale Image") + "</h1></center>");
	// A label to display the current size
	curSize = new CustomLabel("<center>" + tr("Current Size:") + "</center>");

	// Layout for the spinboxes and their labels
	QGridLayout *spinLay = new QGridLayout;

	// Width label and spinbox
	CustomLabel *widthLabel = new CustomLabel("     " + tr("New Width:"));
	widthLabel->setAlignment(Qt::AlignRight);
	widthSpin = new CustomSpinBox;
	widthSpin->setObjectName("w");
	widthSpin->setMaximum(999999);
	widthSpin->setFixedWidth(70);
	widthSpin->setBackground("white", "black");
	widthSpin->setBorder("black",1);
	widthSpin->setFontColor("black","grey");
	widthSpin->setEnabled(false);
	spinLay->addWidget(widthLabel,0,0);
	spinLay->addWidget(widthSpin,0,1);
	connect(widthSpin, SIGNAL(valueChanged(int)), this, SLOT(sizeChanged()));

	// Height label and spinbox
	CustomLabel *heightLabel = new CustomLabel("     " + tr("New Height:"));
	heightLabel->setAlignment(Qt::AlignRight);
	heightSpin = new CustomSpinBox;
	heightSpin->setObjectName("h");
	heightSpin->setMaximum(999999);
	heightSpin->setFixedWidth(70);
	heightSpin->setBackground("white", "black");
	heightSpin->setBorder("black",1);
	heightSpin->setFontColor("black","grey");
	heightSpin->setEnabled(false);
	spinLay->addWidget(heightLabel,1,0);
	spinLay->addWidget(heightSpin,1,1);
	connect(heightSpin, SIGNAL(valueChanged(int)), this, SLOT(sizeChanged()));

	// Checkbox to keep aspect ratio
	keepratio = new CustomCheckBox(tr("Aspect Ratio"));
	keepratio->setIndicatorImage(":/img/ratioKeep.png",":/img/ratioDontKeep.png",
				     ":/img/ratioKeep.png",":/img/ratioDontKeep.png");
	keepratio->setChecked(true);
	keepRatioClicked();	// Set tooltip etc.
	connect(keepratio, SIGNAL(clicked()), this, SLOT(keepRatioClicked()));
	connect(keepratio, SIGNAL(clicked()), this, SLOT(sizeChanged()));

	// Layout to put the above in horizontal order
	QHBoxLayout *spinCheckLay = new QHBoxLayout;
	spinCheckLay->addStretch();
	spinCheckLay->addLayout(spinLay);
	spinCheckLay->addWidget(keepratio);
	spinCheckLay->addStretch();


	// Set the quality of the scaling
	CustomLabel *qualityLabel = new CustomLabel(tr("Quality:"));
	CustomSpinBox *qualityValue = new CustomSpinBox;
	qualityValue->setMinimum(0);
	qualityValue->setMaximum(100);
	qualityValue->setValue(90);
	quality = new CustomSlider;
	quality->setMinimum(0);
	quality->setMaximum(100);
	quality->setFixedWidth(150);
	quality->setValue(90);
	QHBoxLayout *qualityLay = new QHBoxLayout;
	qualityLay->addStretch();
	qualityLay->addWidget(qualityLabel);
	qualityLay->addWidget(quality);
	qualityLay->addWidget(qualityValue);
	qualityLay->addStretch();
	connect(qualityValue, SIGNAL(valueChanged(int)), quality, SLOT(setValue(int)));
	connect(quality, SIGNAL(valueChanged(int)), qualityValue, SLOT(setValue(int)));


	// Pushbuttons to go ahead or cancel
	enterInPlace = new CustomPushButton(tr("Scale in place"));
	enterInPlace->setObjectName("enterInPlace");
	CustomPushButton *enterNew = new CustomPushButton(tr("Scale in new file"));
	enterNew->setObjectName("enterNew");
	CustomPushButton *cancel = new CustomPushButton(tr("Don't Scale"));
	QHBoxLayout *butLay = new QHBoxLayout;
	butLay->addStretch();
	butLay->addWidget(enterInPlace);
	butLay->addWidget(enterNew);
	butLay->addWidget(cancel);
	butLay->addStretch();
	connect(cancel, SIGNAL(clicked()), this, SLOT(disableAllSpinBoxAndClose()));
	connect(enterInPlace, SIGNAL(clicked()), this, SLOT(enterClicked()));
	connect(enterNew, SIGNAL(clicked()), this, SLOT(enterClicked()));


	// Put everything into layout and set to widget
	QVBoxLayout *lay = new QVBoxLayout;
	lay->addWidget(title);
	lay->addSpacing(15);
	lay->addWidget(curSize);
	lay->addSpacing(20);
	lay->addLayout(spinCheckLay);
	lay->addSpacing(10);
	lay->addLayout(qualityLay);
	lay->addSpacing(15);
	lay->addLayout(butLay);
	lay->addStretch();
	this->setWidgetLayout(lay);

	// We need to initialise them here, otherwise the system shortcut in mainwindow.cpp might cause a crash
	confirmNotSupported = new CustomConfirm("","");
	confirmInPlace = new CustomConfirm("","");
	confirmNew = new CustomConfirm("","");

}
示例#4
0
StartUpWidget::StartUpWidget(QWidget *parent) : MyWidget(parent) {

	this->setFullscreen(true);

	// A close button to close widget
	CustomPushButton *close = new CustomPushButton(tr("Okay, I got enough now. Lets start!"));
	close->setFontSize("12pt");
	QHBoxLayout *butLay = new QHBoxLayout;
	butLay->setMargin(8);
	butLay->addStretch();
	butLay->addWidget(close);
	butLay->addStretch();
	connect(close, SIGNAL(clicked()), this, SLOT(animate()));

	// Line above buttons
	CustomLine *line = new CustomLine;

	// Create and set the main layout
	QVBoxLayout *lay = new QVBoxLayout;
	this->setWidgetLayout(lay);
	this->addWidgetAtBottom(line);
	this->addButtonLayout(butLay);

	// The title is set depending on update or fresh install
	title = new CustomLabel;
	title->setFontSize(20);
	title->setBold(true);
	title->setAlignment(Qt::AlignCenter);
	title->setTextInteractionFlags(Qt::TextSelectableByMouse);

	// The logo
	CustomLabel *logo = new CustomLabel;
	QPixmap splash(":/img/logo.png");
	logo->setPixmap(splash);
	logo->setAlignment(Qt::AlignCenter);

	// The introduction is set depending on update or fresh install
	customIntro = new CustomLabel;
	customIntro->setFontSize(12);
	customIntro->setWordWrap(true);
	customIntro->setTextInteractionFlags(Qt::TextSelectableByMouse);

	// the description is the same in both cases
	CustomLabel *desc = new CustomLabel;
	desc->setFontSize(12);
	desc->setWordWrap(true);
	desc->setTextInteractionFlags(Qt::TextSelectableByMouse);

	QString descTxt = "<table>";

	descTxt += "<tr><td style=\"vertical-align: middle\">";
		descTxt += "<img src=\":/img/startupwidget/fileformats.png\">";
	descTxt += "</td><td style=\"vertical-align: middle\">";
		descTxt += "<span style=\"font-size: 15pt; font-weight: bold\">" + tr("Many File Formats") + "</span><br>" + tr("PhotoQt can make use of GraphicsMagick, an image library, to display many different image formats. Currently, there are up to 72 different file formats supported (exact number depends on your system)! You can find a list of it in the settings (Tab 'Other'). There you can en-/disable different ones and also add custom file endings.");
	descTxt += "</td></tr>";

	descTxt += "</table>";
	descTxt += "<table>";

	descTxt += "<tr><td style=\"vertical-align: middle\">";
		descTxt += "<span style=\"font-size: 15pt; font-weight: bold\">" + tr("Make PhotoQt your own") + "</span><br>" + tr("PhotoQt has an extensive settings area. By default you can call it with the shortcut 'e' or through the dropdown menu at the top edge towards the top right corner. You can adjust almost everything in PhotoQt, and it's certainly worth having a look there. Each setting usually comes with a little explanation text.");
	descTxt += "</td><td style=\"vertical-align: middle\">";
		descTxt += "<img src=\":/img/startupwidget/settings.png\">";
	descTxt += "</td></tr>";

	descTxt += "</table>";
	descTxt += "<table>";

	descTxt += "<tr><td style=\"vertical-align: middle\">";
		descTxt += "<img src=\":/img/startupwidget/thumbnails.png\">";
	descTxt += "</td><td style=\"vertical-align: middle\">";
		descTxt += "<span style=\"font-size: 15pt; font-weight: bold\">" + tr("Thumbnails") + "</span><br>" + tr("What would be an image viewer without thumbnails support? It would only be half as good. Whenever you load an image, PhotoQt loads the other images in the directory in the background (by default, it tries to be smart about it and only loads the ones that are needed). It lines them up in a row at the bottom edge (move your mouse there to see them). There are many settings just for the thumbnails, like, e.g., size, liftup, en-/disabled, type, filename, permanently shown/hidden, etc. PhotoQt's quite flexible with that.");
	descTxt += "</td></tr>";

	descTxt += "</table>";
	descTxt += "<table>";

	descTxt += "<tr><td style=\"vertical-align: middle\">";
		descTxt += "<span style=\"font-size: 15pt; font-weight: bold\">" + tr("Shortcuts") + "</span><br>" + tr("One of the many strengths of PhotoQt is the ability to easily set a shortcut for almost anything. Even mouse shortcuts are possible! You can choose from a huge number of internal functions, or you can run any custom script or command.");
	descTxt += "</td><td style=\"vertical-align: middle\">";
		descTxt += "<img src=\":/img/startupwidget/shortcuts.png\">";
	descTxt += "</td></tr>";

	descTxt += "</table>";
	descTxt += "<table>";

	descTxt += "<tr><td style=\"vertical-align: middle\">";
		descTxt += "<img src=\":/img/startupwidget/exif.png\">";
	descTxt += "</td><td style=\"vertical-align: middle\">";
		descTxt += "<span style=\"font-size: 15pt; font-weight: bold\">" + tr("Image Information (Exif)") + "</span><br>" + tr("Most images store some information about the image in the file. PhotoQt can read and display a good bit of that (currently, only Exif is supported). You can find this information in the slide-in window hidden behind the left edge of PhotoQt.");
	descTxt += "</td></tr>";

	descTxt += "</table>";
	descTxt += "<table>";

	descTxt += "<tr><td style=\"vertical-align: middle\">";
		descTxt += "<span style=\"font-size: 15pt; font-weight: bold\">" + tr("Slideshow") + "</span><br>" + tr("PhotoQt also brings a slideshow feature. When you start a slideshow, it starts at the currently displayed image. There are a couple settings like transition, speed, loop, and shuffle. Plus, you can set a music file that is played in the background. When the slideshow takes longer than the music file, then PhotoQt starts the music file all over from the beginning. At anytime during the slideshow, you can move the mouse cursor to the top edge of the screen to get a little bar, where you can pause/exit the slideshow and adjust the music volume.");
	descTxt += "</td><td style=\"vertical-align: middle\">";
		descTxt += "<img src=\":/img/startupwidget/slideshow.png\">";
	descTxt += "</td></tr>";

	descTxt += "</table>";
	descTxt += "<table>";

	descTxt += "<tr><td style=\"vertical-align: middle\">";
		descTxt += "<img src=\":/img/startupwidget/localisation.png\">";
	descTxt += "</td><td style=\"vertical-align: middle\">";
		descTxt += "<span style=\"font-size: 15pt; font-weight: bold\">" + tr("Localisation") + "</span><br>" + tr("PhotoQt comes with a number of translations. Many have taken some of their time to create/update one of them (Thank you!). Not all of them are complete... do you want to help?");
	descTxt += "</td></tr>";

	descTxt += "</table><br><br><br>";

	descTxt += tr("There are many many more features. Best is, you just give it a go. Don't forget to check out the settings to make PhotoQt YOUR image viewer.") + "<br><br><br>" + tr("Enjoy :-)") + "<br><br>";

	desc->setText(descTxt);

	lay->addSpacing(40);
	lay->addWidget(logo);
	lay->addSpacing(30);
	lay->addWidget(title);
	lay->addSpacing(20);
	lay->addWidget(customIntro);
	lay->addSpacing(10);
	lay->addWidget(desc);
	lay->addStretch();

}