MainWindowPlugin::MainWindowPlugin() { FPluginManager = NULL; FOptionsManager = NULL; FTrayManager = NULL; FNotifications = NULL; FSystemIntegration = NULL; FOpenAction = NULL; FMinimizeNotifyId = 0; FActivationChanged = QTime::currentTime(); #ifdef Q_WS_WIN FMainWindow = new MainWindow(NULL, Qt::Window|Qt::CustomizeWindowHint|Qt::WindowTitleHint|Qt::WindowCloseButtonHint); #elif defined(Q_WS_MAC) FMainWindow = new MainWindow(NULL, Qt::Window); setWindowGrowButtonEnabled(FMainWindow, false); //setWindowFullScreenEnabled(FMainWindow, true); #else FMainWindow = new MainWindow(NULL, Qt::Window|Qt::CustomizeWindowHint|Qt::WindowTitleHint|Qt::WindowCloseButtonHint); #endif FMainWindow->setObjectName("mainWindow"); FMainWindowBorder = CustomBorderStorage::widgetBorder(FMainWindow); if (FMainWindowBorder) { FMainWindowBorder->installEventFilter(this); connect(FMainWindowBorder, SIGNAL(closed()), SLOT(onMainWindowClosed())); } else { FMainWindow->installEventFilter(this); connect(FMainWindow, SIGNAL(closed()),SLOT(onMainWindowClosed())); } }
MainWindowPlugin::MainWindowPlugin() { FPluginManager = NULL; FOptionsManager = NULL; FTrayManager = NULL; FOpenAction = NULL; FActivationChanged = QTime::currentTime(); #ifdef Q_WS_WIN FMainWindow = new MainWindow(NULL, Qt::Window|Qt::CustomizeWindowHint|Qt::WindowTitleHint|Qt::WindowCloseButtonHint); #elif defined(Q_WS_MAC) FMainWindow = new MainWindow(NULL, Qt::Window); setWindowGrowButtonEnabled(FMainWindow, false); #else FMainWindow = new MainWindow(NULL, Qt::Window|Qt::CustomizeWindowHint|Qt::WindowTitleHint|Qt::WindowCloseButtonHint); #endif FMainWindow->setObjectName("mainWindow"); FMainWindowBorder = CustomBorderStorage::staticStorage(RSR_STORAGE_CUSTOMBORDER)->addBorder(FMainWindow, CBS_ROSTER); if (FMainWindowBorder) { FMainWindowBorder->setMaximizeButtonVisible(false); FMainWindowBorder->setMinimizeButtonVisible(false); FMainWindowBorder->setDockingEnabled(true); } #ifdef Q_WS_WIN // if (QSysInfo::windowsVersion() == QSysInfo::WV_WINDOWS7) // connect(FMainWindowBorder ? (QObject*)FMainWindowBorder : (QObject*)FMainWindow, SIGNAL(closed()), SLOT(onMainWindowClosed())); #endif FMainWindow->installEventFilter(this); }
AboutBox::AboutBox(IPluginManager *APluginManager, QWidget *AParent) : QDialog(AParent) { ui.setupUi(this); setAttribute(Qt::WA_DeleteOnClose,true); #ifdef Q_WS_MAC ui.buttonsLayout->setSpacing(16); //ui.buttonsLayout->addWidget(ui.pbtSendComment); setWindowGrowButtonEnabled(this->window(), false); #endif QString styleBegin = "<html><style>a { color: #acacac; }</style><body><font color=#acacac>"; QString styleEnd = "</font></body></html>"; //ui.lblName->setText(tr("Contacts")); IconStorage::staticStorage(RSR_STORAGE_MENUICONS)->insertAutoIcon(ui.lblName, MNI_OPTIONS_LOGIN_LOGO, 0, 0, "pixmap"); ui.lblVersion->setText(styleBegin + tr("Version: %1.%2 %3").arg(APluginManager->version()).arg(APluginManager->revision()).arg(CLIENT_VERSION_SUFIX).trimmed() + styleEnd); ui.lblHomePage->setText(styleBegin + tr("Site: %1").arg("<a href='http://contacts.rambler.ru'>contacts.rambler.ru</a>") + "</font>"); ui.lblCopyright->setText(styleBegin + tr("© 2011, \"Rambler Internet Holding LLC\".<br>%1").arg(QString("<a href='http://help.rambler.ru/legal/?s=44761'>%1</a>").arg(tr("Terms of Use"))) + styleEnd); ui.lblFontInfo->setText(styleBegin + tr("The program uses the Segoe UI font on the license granted Monotype Imaging Inc. %1").arg("<a href=\'http://www.fonts.com\'>www.fonts.com</a>") + styleEnd); ui.lblAboutQt->setText(styleBegin + tr("The program is developed with %1.").arg("<a href=\'about:qt\'>Qt</a>") + styleEnd); connect(ui.lblAboutQt, SIGNAL(linkActivated(const QString &)), SLOT(onLabelLinkActivated(const QString &))); connect(ui.lblHomePage,SIGNAL(linkActivated(const QString &)),SLOT(onLabelLinkActivated(const QString &))); connect(ui.lblCopyright,SIGNAL(linkActivated(const QString &)),SLOT(onLabelLinkActivated(const QString &))); connect(ui.pbtSendComment, SIGNAL(clicked()), APluginManager->instance(), SLOT(onShowCommentsDialog())); border = CustomBorderStorage::staticStorage(RSR_STORAGE_CUSTOMBORDER)->addBorder(this, CBS_DIALOG); if (border) { border->setResizable(false); border->setMinimizeButtonVisible(false); border->setMaximizeButtonVisible(false); border->setAttribute(Qt::WA_DeleteOnClose, true); connect(border, SIGNAL(closeClicked()), SLOT(reject())); connect(this, SIGNAL(accepted()), border, SLOT(closeWidget())); connect(this, SIGNAL(rejected()), border, SLOT(closeWidget())); } StyleStorage::staticStorage(RSR_STORAGE_STYLESHEETS)->insertAutoStyle(this, STS_PLUGINMANAGER_ABOUTBOX); GraphicsEffectsStorage::staticStorage(RSR_STORAGE_GRAPHICSEFFECTS)->installGraphicsEffect(this, GFX_LABELS); }
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 Windows, " "Mac OS 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); }
MergeContactsDialog::MergeContactsDialog(IMetaContacts *AMetaContacts, IMetaRoster *AMetaRoster, const QList<QString> AMetaIds, QWidget *AParent) : QDialog(AParent) { ui.setupUi(this); StyleStorage::staticStorage(RSR_STORAGE_STYLESHEETS)->insertAutoStyle(this,STS_METACONTACTS_MERGECONTACTSDIALOG); GraphicsEffectsStorage::staticStorage(RSR_STORAGE_GRAPHICSEFFECTS)->installGraphicsEffect(this, GFX_LABELS); FBorder = CustomBorderStorage::staticStorage(RSR_STORAGE_CUSTOMBORDER)->addBorder(this, CBS_DIALOG); if (FBorder) { FBorder->setResizable(false); FBorder->setMinimizeButtonVisible(false); FBorder->setMaximizeButtonVisible(false); FBorder->setAttribute(Qt::WA_DeleteOnClose,true); FBorder->setWindowTitle(ui.lblCaption->text()); connect(this, SIGNAL(accepted()), FBorder, SLOT(closeWidget())); connect(this, SIGNAL(rejected()), FBorder, SLOT(closeWidget())); connect(FBorder, SIGNAL(closeClicked()), SLOT(reject())); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); } else { ui.lblCaption->setVisible(false); setAttribute(Qt::WA_DeleteOnClose,true); } #ifdef Q_WS_MAC ui.buttonsLayout->setSpacing(16); ui.buttonsLayout->addWidget(ui.pbtMerge); setWindowGrowButtonEnabled(this->window(), false); #endif ui.lneName->setAttribute(Qt::WA_MacShowFocusRect, false); FMetaRoster = AMetaRoster; FMetaContacts = AMetaContacts; FMetaIds = AMetaIds; ui.lblNotice->setText(tr("These %n contacts will be merged into one:","",AMetaIds.count())); QString name; int nameCapCount = 0; QRegExp nameRegExp(tr("([a-z])","From first letter to last of alphabet"),Qt::CaseInsensitive); QSet<Jid> items; ui.ltContacts->addStretch(); foreach(QString metaId, FMetaIds) { IMetaContact contact = FMetaRoster->metaContact(metaId); items += contact.items; QImage avatar = FMetaRoster->metaAvatarImage(metaId,false,false).scaled(24, 24, Qt::KeepAspectRatio,Qt::SmoothTransformation); QString itemName = FMetaContacts->metaContactName(contact); int pos = 0; int itemNameCapCount = 0; while ((pos = nameRegExp.indexIn(itemName, pos)) != -1) { itemNameCapCount++; pos += nameRegExp.matchedLength(); } if (nameCapCount < itemNameCapCount) { name = itemName; nameCapCount = itemNameCapCount; } else if (name.isEmpty()) { name = itemName.trimmed(); } QHBoxLayout *itemLayout = new QHBoxLayout(); itemLayout->setContentsMargins(0, 0, 0, 0); itemLayout->setSpacing(8); QLabel *avatarLabel = new QLabel(this); avatarLabel->setFixedSize(24, 24); avatarLabel->setPixmap(QPixmap::fromImage(avatar)); avatarLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); itemLayout->addWidget(avatarLabel); QLabel *nameLabel = new QLabel(this); nameLabel->setText(itemName); itemLayout->addWidget(nameLabel); ui.ltContacts->addItem(itemLayout); }