コード例 #1
0
ファイル: qnotify.cpp プロジェクト: setsid/qnotify
    void show(const char* message) {
        message_label.setText(QString::fromUtf8(message));

        // resize and move the window to the top right corner
        resize(WIDTH, HEIGHT);
        move(QDesktopWidget().screenGeometry().width() - WIDTH, 0);

        QMainWindow::show();

        startTimer(1000);
    }
コード例 #2
0
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
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();

}