Esempio n. 1
0
VideoFrame::VideoFrame(QWidget *AParent) : QFrame(AParent)
{
	setMouseTracking(true);

	FMoved = false;
	FClicked = false;
	FCursorCorner = -1;
	FCollapsed = false;
	FMoveEnabled = false;
	FResizeEnabled = false;
	FMinimumSize = QSize(50,50);
	FMaximumSize = QSize(QWIDGETSIZE_MAX,QWIDGETSIZE_MAX);
	FAlignment = Qt::AlignRight|Qt::AlignBottom;
	FDoubleClickTime = QDateTime::currentDateTime();
	FDeviceState = ISipDevice::DS_UNAVAIL;

	QIcon icon = IconStorage::staticStorage(RSR_STORAGE_MENUICONS)->getIcon(MNI_SIPPHONE_VIDEO_RESIZE);
	FResizeIcon = icon.pixmap(icon.availableSizes().value(0));

	icon = IconStorage::staticStorage(RSR_STORAGE_MENUICONS)->getIcon(MNI_SIPPHONE_VIDEO_COLLAPSED);
	FCollapsedIcon = icon.pixmap(icon.availableSizes().value(0));

	icon = IconStorage::staticStorage(RSR_STORAGE_MENUICONS)->getIcon(MNI_SIPPHONE_CAMERA_DISABLED);
	FCameraDisabledIcon = icon.pixmap(icon.availableSizes().value(0));

	FWaitMovie = new QMovie(this);
	FWaitMovie->setFileName(IconStorage::staticStorage(RSR_STORAGE_MENUICONS)->fileFullName(MNI_SIPPHONE_VIDEO_WAIT));
	connect(FWaitMovie,SIGNAL(frameChanged(int)),SLOT(onWaitMovieFrameChanged(int)));
	FWaitMovie->start();
}
Esempio n. 2
0
QIcon IndigoTabbar::rotateIcon(const QIcon &icon, TabPosition tabPos){

    QSize sz;

    for (int var = 0; var < icon.availableSizes().count(); ++var) {
        if (icon.availableSizes().at(var).width() > sz.width())
        sz = icon.availableSizes().at(var);
    }
    QPixmap pix = icon.pixmap(sz);
    QTransform trans;

    switch(this->tabPosition()){
    case QTabWidget::East:{
        switch(tabPos){
            case QTabWidget::West:{
                trans.rotate(180);
                break;
            }
            case QTabWidget::North:{
                trans.rotate(-90);
                break;
            }
            default:
                break;
        }


        break;
    }
    case QTabWidget::West:{
        switch(tabPos){

            case QTabWidget::East:{
                trans.rotate(180);
                break;
            }
            case QTabWidget::North:{
                trans.rotate(+90);
                break;
            }
            default:
                break;
        }
        break;
    }
    default:
        break;
    }

    pix = pix.transformed(trans);
    pix = pix.scaledToWidth( iconScale );
    pix = pix.scaledToHeight( iconScale );
    return QIcon(pix);
}
Esempio n. 3
0
	// reimplemented
	virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
	{
		QStyleOptionViewItemV4 opt(option);
		opt.showDecorationSelected = true;
		opt.rect.adjust(0, 0, 0, -1);

		painter->save();
		QStyle *style = opt.widget ? opt.widget->style() : QApplication::style();
		style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget);

		QIcon icon = index.data(Qt::DecorationRole).value<QIcon>();
		QSize iconSize;
#if 0
		if (icon.availableSizes().isEmpty())
			iconSize = icon.availableSizes().first();
		else
#endif
			int s = PsiIconset::instance()->system().iconSize();
			iconSize = QSize(s,s);
		QRect iconRect = opt.rect;
		iconRect.setLeft(4);
		iconRect.setWidth(iconSize.width());
		icon.paint(painter, iconRect, Qt::AlignCenter, QIcon::Normal, QIcon::On);

		QRect textRect = opt.rect;
		textRect.setLeft(iconRect.right() + 8);
		QPalette::ColorGroup cg = option.state & QStyle::State_Enabled
		                          ? QPalette::Normal : QPalette::Disabled;
		if (cg == QPalette::Normal && !(option.state & QStyle::State_Active)) {
			cg = QPalette::Inactive;
		}
		if (option.state & QStyle::State_Selected) {
			painter->setPen(option.palette.color(cg, QPalette::HighlightedText));
		}
		else {
			painter->setPen(option.palette.color(cg, QPalette::Text));
		}
		painter->drawText(textRect, index.data(Qt::DisplayRole).toString(), Qt::AlignLeft | Qt::AlignVCenter);
		drawFocus(painter, option, option.rect); // not opt, because drawFocus() expects normal rect
		painter->restore();

		painter->save();
		QPen pen(QColor(0xE0, 0xE0, 0xE0));
		QVector<qreal> dashes;
		dashes << 1.0 << 1.0;
		pen.setCapStyle(Qt::FlatCap);
		pen.setDashPattern(dashes);

		painter->setPen(pen);
		painter->drawLine(option.rect.left(), option.rect.bottom(), option.rect.right(), option.rect.bottom());
		painter->restore();
	}
Esempio n. 4
0
QIcon IndigoMenuBar::tintIcon(const QIcon &icon) {

    QSize sz;

    for (int var = 0; var < icon.availableSizes().count(); ++var) {
        if (icon.availableSizes().at(var).width() > sz.width())
            sz = icon.availableSizes().at(var);
    }

    QImage image = icon.pixmap(sz).toImage();
    image.invertPixels();

    return QIcon(QPixmap::fromImage(image));
}
Esempio n. 5
0
const QIcon& CIconProvider::iconFor(const CFileSystemObject& object)
{
	const qulonglong objectHash = hash(object);
	if (_iconForObject.count(objectHash) == 0)
	{
		const QIcon icon = _provider->iconFor(object);
		assert_r(!icon.isNull());

		const auto qimage = icon.pixmap(icon.availableSizes().front()).toImage();
		const qulonglong iconHash = fasthash64((const char*)qimage.constBits(), qimage.bytesPerLine() * qimage.height(), 0);

		if (_iconCache.size() > 300)
		{
			_iconCache.clear();
			_iconForObject.clear();
		}

		const auto iconInContainer = _iconCache.insert(std::make_pair(iconHash, icon)).first;
		_iconForObject[objectHash] = iconHash;
		
		return iconInContainer->second;
	}

	return _iconCache[_iconForObject[objectHash]];
}
Esempio n. 6
0
void QIStateStatusBarIndicator::setStateIcon(int iState, const QIcon &icon)
{
    /* Adjust size-hint: */
    m_size = m_size.expandedTo(icon.availableSizes().first());
    /* Cache passed-icon: */
    m_icons[iState] = icon;
}
Esempio n. 7
0
/************************************************
 Returns the QIcon corresponding to name in the current icon theme. If no such icon
 is found in the current theme fallback is return instead.
 ************************************************/
QIcon XdgIcon::fromTheme(const QString& iconName, const QIcon& fallback)
{
    QString name = QFileInfo(iconName).fileName();
    if (name.endsWith(".png", Qt::CaseInsensitive) ||
        name.endsWith(".svg", Qt::CaseInsensitive) ||
        name.endsWith(".xpm", Qt::CaseInsensitive))
    {
        name.truncate(name.length() - 4);
    }

    QIcon icon;

    if (qtIconCache()->contains(name)) {
        icon = *qtIconCache()->object(name);
    } else {
        QIcon *cachedIcon  = new QIcon(new QIconLoaderEngineFixed(name));
        qtIconCache()->insert(name, cachedIcon);
        icon = *cachedIcon;
    }

    // Note the qapp check is to allow lazy loading of static icons
    // Supporting fallbacks will not work for this case.
    if (qApp && icon.availableSizes().isEmpty())
    {
        return fallback;
    }
    return icon;
}
void PluginChoooserWidget::loadImpl()
{
	clear();
	Config group = Config().group("plugins/list");
	QStandardItem *parent_item = m_model->invisibleRootItem();

    QList<QWeakPointer<Plugin> > plugins = pluginsList();
	QStringList helper;
    for (int i = 0; i < plugins.size(); i++) {
        const PluginInfo &info = plugins.at(i).data()->info();
        QLatin1String class_name(plugins.at(i).data()->metaObject()->className());
        if (!m_plugin_items.contains(info.name())) {
			QIcon icon = info.icon();
			if (icon.isNull() || !icon.availableSizes().count())
				icon = Icon("applications-system");
			QString name = info.name();
			int index = qLowerBound(helper, name) - helper.constBegin();
			helper.insert(index, name);
			ServiceItem *item = new ServiceItem(icon, name);
			item->setToolTip(html(info));
			item->setCheckable(true);
			item->setData(true,ServiceItem::ExclusiveRole);
			item->setData(info.description().toString(), DescriptionRole);
			item->setCheckState((group.value(class_name, true) ? Qt::Checked : Qt::Unchecked));
			parent_item->insertRow(index, item);
			m_plugin_items.insert(class_name, item);
            m_plugins.insert(class_name, plugins.at(i).data());
		}
	}
}
Esempio n. 9
0
QPixmap IconsProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
{
    if (!QIcon::hasThemeIcon(id)) {
        *size = QSize();

        return QPixmap();
    }

    QIcon icon = QIcon::fromTheme(id);
    QList<QSize> availableSizes = icon.availableSizes();
    QSize nearestSize;

    if (requestedSize.isEmpty()) {
        nearestSize = *std::max_element(availableSizes.begin(), availableSizes.end());
    } else {
        int q = std::numeric_limits<int>::max();

        for  (QSize &size: availableSizes) {
            int diffWidth = size.width() - requestedSize.width();
            int diffHeight = size.height() - requestedSize.height();
            int k = diffWidth * diffWidth + diffHeight * diffHeight;

            if (k < q) {
                nearestSize = size;
                q = k;
            }
        }
    }

    QPixmap pixmap = icon.pixmap(nearestSize);
    *size = pixmap.size();

    return pixmap;
}
Esempio n. 10
0
void VBoxAboutDlg::prepare()
{
    /* Delete dialog on close: */
    setAttribute(Qt::WA_DeleteOnClose);

    /* Choose default image: */
    QString strPath(":/about.png");

    /* Branding: Use a custom about splash picture if set: */
    const QString strSplash = vboxGlobal().brandingGetKey("UI/AboutSplash");
    if (vboxGlobal().brandingIsActive() && !strSplash.isEmpty())
    {
        char szExecPath[1024];
        RTPathExecDir(szExecPath, 1024);
        QString strTmpPath = QString("%1/%2").arg(szExecPath).arg(strSplash);
        if (QFile::exists(strTmpPath))
            strPath = strTmpPath;
    }

    /* Load image: */
    const QIcon icon = UIIconPool::iconSet(strPath);
    m_size = icon.availableSizes().first();
    m_pixmap = icon.pixmap(m_size);

    /* Prepare main-layout: */
    prepareMainLayout();

    /* Translate: */
    retranslateUi();
}
Esempio n. 11
0
QVariant RSSModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid()) return QVariant();

    auto *item = static_cast<RSS::Item *>(getAttachedItem(index));
    Q_ASSERT(item);

    if (role == ItemPtrRole)
        return QVariant::fromValue<RSS::Item *>(item);

    if ((index.column() == 0) && (role == Qt::DecorationRole)) {
        if (qobject_cast<RSS::Folder *>(item))
            return GuiIconProvider::instance()->getIcon(QStringLiteral("inode-directory"));

        auto *feed = static_cast<RSS::Feed *>(item);
        if (feed->isLoading())
            return QIcon(QStringLiteral(":/icons/loading.png"));
        if (feed->hasError())
            return GuiIconProvider::instance()->getIcon(QStringLiteral("unavailable"));

        QIcon feedIcon = m_feedIcons.value(item);
        return ((feedIcon.availableSizes().size() == 0)
                ? GuiIconProvider::instance()->getIcon(QStringLiteral("application-rss+xml"))
                : feedIcon);
    }

    if ((index.column() == 0) && (role == Qt::DisplayRole)) {
        if (item->id() == 0)
            return QString(QStringLiteral("%1 (%2)")).arg(tr("Unread")).arg(item->unreadCount());
        return QString(QStringLiteral("%1 (%2/%3)"))
                .arg(item->name()).arg(item->unreadCount()).arg(item->articles().count());
    }

    return QVariant();
}
Esempio n. 12
0
QIcon Docset::symbolTypeIcon(const QString &symbolType) const
{
    static const QIcon unknownIcon(QStringLiteral("typeIcon:Unknown.png"));

    const QIcon icon(QStringLiteral("typeIcon:%1.png").arg(symbolType));
    return icon.availableSizes().isEmpty() ? unknownIcon : icon;
}
Esempio n. 13
0
QIcon IconFactory::appIcon(AppIconFlags flags)
{
    const bool running = flags.testFlag(AppIconRunning);
    const QString suffix = running ? "-busy" : "-normal";
    const QString sessionName = qApp->property("CopyQ_session_name").toString();

    QIcon icon;

    if (sessionName.isEmpty())
        icon = QIcon::fromTheme("copyq" + suffix);

    if (icon.isNull()) {
        const QString resourceSuffix = running ? "-running" : "";
        QPixmap pix = imageFromPrefix(suffix + ".svg", "icon" + resourceSuffix);

        if (!sessionName.isEmpty()) {
            const QColor color1(0x7f, 0xca, 0x9b);
            const QColor color2 = sessionNameToColor(sessionName);
            replaceColor(&pix, color1, color2);
        }

        icon.addPixmap(pix);
    }

    if (flags.testFlag(AppIconDisabled)) {
        QIcon disabledIcon;
        foreach (const QSize &size, icon.availableSizes())
            disabledIcon.addPixmap(icon.pixmap(size, QIcon::Disabled));
        return disabledIcon;
    }
// Read level sub-elements of "wizard"
static bool parseCustomProjectElement(QXmlStreamReader &reader,
                                      const QString &configFileFullPath,
                                      const QString &language,
                                      CustomWizardParameters *p)
{
    const QStringRef elementName = reader.name();
    if (elementName == QLatin1String(iconElementC)) {
        const QString path = reader.readElementText();
        const QIcon icon = wizardIcon(configFileFullPath, path);
        if (icon.availableSizes().isEmpty()) {
            qWarning("Invalid icon path '%s' encountered in custom project template %s.",
                     qPrintable(path), qPrintable(configFileFullPath));
        } else {
                p->icon = icon;
        }
        return true;
    }
    if (elementName == QLatin1String(descriptionElementC)) {
        assignLanguageElementText(reader, language, &p->description);
        return true;
    }
    if (elementName == QLatin1String(displayNameElementC)) {
        assignLanguageElementText(reader, language, &p->displayName);
        return true;
    }
    if (elementName == QLatin1String(displayCategoryElementC)) {
        assignLanguageElementText(reader, language, &p->displayCategory);
        return true;
    }
    if (elementName == QLatin1String(fieldPageTitleElementC)) {
        assignLanguageElementText(reader, language, &p->fieldPageTitle);
        return true;
    }
    return false;
}
Esempio n. 15
0
QIcon IconUtils::icon(const QVector<const char *> &names) {
    QIcon icon;
    for (auto name : names) {
        icon = IconUtils::icon(name);
        if (!icon.availableSizes().isEmpty()) break;
    }
    return icon;
}
Esempio n. 16
0
/* static */
QPixmap UIIconPool::pixmap(const QString &strName)
{
    /* Reuse iconSet API: */
    QIcon icon = iconSet(strName);

    /* Return pixmap of first available size: */
    return icon.pixmap(icon.availableSizes().first());
}
Esempio n. 17
0
void MainWindow::repopulate()
{
    QMap<QString,QString> images = listInstalledImages();
    ui->list->clear();
    bool haveicons = false;
    QSize currentsize = ui->list->iconSize();
    QString iconFilename;

    for (QMap<QString,QString>::const_iterator iter = images.constBegin(); iter != images.constEnd(); iter++)
    {
        if (iter.key().contains("risc", Qt::CaseInsensitive))
            iconFilename = "/mnt/images/RiscOS.png";
        else if (iter.key().contains("arch", Qt::CaseInsensitive))
            iconFilename = "/mnt/images/Archlinux.png";
        else if (iter.key().contains("pidora", Qt::CaseInsensitive))
            iconFilename = "/mnt/images/Pidora.png";
        else if (iter.key().contains("wheezy", Qt::CaseInsensitive))
            iconFilename = "/mnt/images/Raspbian.png";
        else if (iter.key().contains("OpenELEC", Qt::CaseInsensitive))
            iconFilename = "/mnt/images/OpenELEC.png";
        else if (iter.key().contains("raspbmc", Qt::CaseInsensitive))
            iconFilename = "/mnt/images/RaspBMC.png";
        else
            iconFilename = "/mnt/images/default.png";

        QIcon icon;

        haveicons = true;
        icon = QIcon(iconFilename);
        QSize iconsize = icon.availableSizes().first();

        if (iconsize.width() > currentsize.width() || iconsize.height() > currentsize.height())
        {
            /* Make all icons as large as the largest icon we have */
            currentsize = QSize(qMax(iconsize.width(), currentsize.width()),qMax(iconsize.height(), currentsize.width()));
            ui->list->setIconSize(currentsize);
        }

        QListWidgetItem *item = new QListWidgetItem(icon, iter.value(), ui->list);
        item->setData(Qt::UserRole, iter.key());
    }

    if (haveicons)
    {
        /* Giving items without icon a dummy icon to make them have equal height and text alignment */
        QPixmap dummyicon = QPixmap(currentsize.width(), currentsize.height());
        dummyicon.fill();

        for (int i=0; i< ui->list->count(); i++)
        {
            if (ui->list->item(i)->icon().isNull())
            {
                ui->list->item(i)->setIcon(dummyicon);
            }
        }
    }
}
/* static */
QPixmap UIIconPool::pixmap(const QString &strName)
{
    /* Reuse iconSet API: */
    QIcon icon = iconSet(strName);

    /* Return pixmap of first available size: */
    const int iHint = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
    return icon.pixmap(icon.availableSizes().value(0, QSize(iHint, iHint)));
}
Esempio n. 19
0
void CModListView::on_screenshotsList_clicked(const QModelIndex &index)
{
    if (index.isValid())
    {
        QIcon icon = ui->screenshotsList->item(index.row())->icon();
        auto pixmap = icon.pixmap(icon.availableSizes()[0]);
        ImageViewer::showPixmap(pixmap, this);
    }
}
Esempio n. 20
0
static inline bool isValidIcon(const QIcon &icon)
{
    if (!icon.isNull()) {
        const QList<QSize> availableSizes = icon.availableSizes();
        if (!availableSizes.empty()) {
            return !availableSizes.front().isEmpty();
        }
    }
    return false;
}
Esempio n. 21
0
QSize ViewStyleStandardPixmap::sizeImpl(const GuiContext& ctx, ID /*id*/, ViewSizeMode /*sizeMode*/) const
{
    auto style = ctx.style();
    QIcon standardIcon = style->standardIcon(m_standardPixmap, nullptr, ctx.widget);
    auto sizes = standardIcon.availableSizes();
    if (sizes.isEmpty())
        return QSize(0, 0);

    return sizes.front();
}
Esempio n. 22
0
LibraryModel::LibraryModel(LibraryBackend* backend, Application* app,
                           QObject* parent)
    : SimpleTreeModel<LibraryItem>(new LibraryItem(this), parent),
      backend_(backend),
      app_(app),
      dir_model_(new LibraryDirectoryModel(backend, this)),
      show_smart_playlists_(false),
      show_various_artists_(true),
      total_song_count_(0),
      artist_icon_(IconLoader::Load("x-clementine-artist", IconLoader::Base)),
      album_icon_(IconLoader::Load("x-clementine-album", IconLoader::Base)),
      playlists_dir_icon_(IconLoader::Load("folder-sound", IconLoader::Base)),
      playlist_icon_(IconLoader::Load("x-clementine-albums", IconLoader::Base)),
      icon_cache_(new QNetworkDiskCache(this)),
      init_task_id_(-1),
      use_pretty_covers_(false),
      show_dividers_(true) {
  root_->lazy_loaded = true;

  group_by_[0] = GroupBy_Artist;
  group_by_[1] = GroupBy_Album;
  group_by_[2] = GroupBy_None;

  cover_loader_options_.desired_height_ = kPrettyCoverSize;
  cover_loader_options_.pad_output_image_ = true;
  cover_loader_options_.scale_output_image_ = true;

  connect(app_->album_cover_loader(), SIGNAL(ImageLoaded(quint64, QImage)),
          SLOT(AlbumArtLoaded(quint64, QImage)));

  icon_cache_->setCacheDirectory(
      Utilities::GetConfigPath(Utilities::Path_CacheRoot) + "/pixmapcache");
  icon_cache_->setMaximumCacheSize(LibraryModel::kIconCacheSize);

  QIcon nocover = IconLoader::Load("nocover", IconLoader::Other);
  no_cover_icon_ = nocover.pixmap(nocover.availableSizes().last()).scaled(
                           kPrettyCoverSize, kPrettyCoverSize,
                           Qt::KeepAspectRatio,
                           Qt::SmoothTransformation);

  connect(backend_, SIGNAL(SongsDiscovered(SongList)),
          SLOT(SongsDiscovered(SongList)));
  connect(backend_, SIGNAL(SongsDeleted(SongList)),
          SLOT(SongsDeleted(SongList)));
  connect(backend_, SIGNAL(SongsStatisticsChanged(SongList)),
          SLOT(SongsSlightlyChanged(SongList)));
  connect(backend_, SIGNAL(SongsRatingChanged(SongList)),
          SLOT(SongsSlightlyChanged(SongList)));
  connect(backend_, SIGNAL(DatabaseReset()), SLOT(Reset()));
  connect(backend_, SIGNAL(TotalSongCountUpdated(int)),
          SLOT(TotalSongCountUpdatedSlot(int)));

  backend_->UpdateTotalSongCountAsync();
}
Esempio n. 23
0
QIcon PlaylistSequence::AddDesaturatedIcon(const QIcon& icon) {
  QIcon ret;
  for (const QSize& size : icon.availableSizes()) {
    QPixmap on(icon.pixmap(size));
    QPixmap off(DesaturatedPixmap(on));

    ret.addPixmap(off, QIcon::Normal, QIcon::Off);
    ret.addPixmap(on, QIcon::Normal, QIcon::On);
  }
  return ret;
}
Esempio n. 24
0
void DesignerGUIUtils::setupSamplesDocument(const Descriptor& d, const QIcon& ico, QTextDocument* doc) {
    bool hasIcon = (ico.availableSizes().size() > 0);
    QString text =
            QString(hasIcon ?
                        "<html>"
                        "<table align='center' border='0' cellpadding='3' cellspacing='3'>"
                        "<tr><td colspan='2'><h1 align='center'>%1</h1></td></tr>"
                        "<tr>"
                            "<td valign='middle' width='20%'><img src=\"%2\"/></td>"
                            "<td valign='bottom'><br>%3</td></tr>"
                        "<tr><td colspan='2' valign='top'>%4<br></td></tr>"
                        "<tr><td colspan='2' bgcolor='gainsboro' align='center'><font color='maroon' size='+2' face='Courier'><b>%5</b></font></td></tr>"
                        "</table>"
                        "</html>"
                      :
                        "<html>"
                        "<table align='center' border='0' cellpadding='3' cellspacing='3'>"
                        "<tr><td><h1 align='center'>%1</h1></td></tr>"
                        "<tr>%2"
                            "<td valign='bottom'><br>%3</td></tr>"
                        "<tr><td valign='top' halign='right'>%4<br></td></tr>"
                        "<tr><td bgcolor='gainsboro' align='center'><font color='maroon' size='+2' face='Courier'><b>%5</b></font></td></tr>"
                        "</table>"
                        "</html>"
                        );
    QString img("img://img");

    if (hasIcon) {
        doc->addResource(QTextDocument::ImageResource, QUrl(img), ico.pixmap(200));
    }
#if (QT_VERSION < 0x050000) //Qt 5
    QString body = Qt::escape(d.getDocumentation()).replace("\n", "<br>");
#else
    QString body = d.getDocumentation().toHtmlEscaped().replace("\n", "<br>");
#endif
    int brk = body.indexOf("<br><br>");
    int shift = 8;
    if (brk <= 0) {
        brk = body.indexOf("<br>");
        shift = 4;
    }
    QString body2;
    if (brk > 0) {
        body2 = body.mid(brk + shift);
        body = body.left(brk);
    }
    text = text.arg(d.getDisplayName()).arg(hasIcon ? img : "").arg(body).arg(body2)
        .arg(QObject::tr("Double click to load the sample"));
    doc->setHtml(text);
    QFont f;
    //f.setFamily("Times New Roman");
    f.setPointSizeF(12);
    doc->setDefaultFont(f);
}
Esempio n. 25
0
QSize ResourceItemDelegate::sizeHint(const QStyleOptionViewItem &/*option*/,
                                     const QModelIndex &index) const
{
    QSize result = QSize(25, 4);
    const QIcon icon(m_model->fileIcon(index));
    if (!icon.isNull()) {
        const QList<QSize> sizes = icon.availableSizes();
        if (!sizes.isEmpty())
            result += sizes.front();
    }
    return result;
}
Esempio n. 26
0
bool Notifies::doNotify(const QString &title, const QString &message, const int ms, const int iconId)
{
	QPixmap pixmap;
	if (iconId > 0)
	{
		const QIcon icon = QApplication::style()->standardIcon((QStyle::StandardPixmap)((int)QStyle::SP_MessageBoxInformation + iconId - 1));
		const QList<QSize> iconSizes = icon.availableSizes();
		if (!iconSizes.isEmpty())
			pixmap = icon.pixmap(iconSizes.last());
	}
	return doNotify(title, message, ms, pixmap, iconId);
}
Esempio n. 27
0
QIcon ManhattanStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
{
    QIcon icon = QProxyStyle::standardIcon(standardIcon, option, widget);
    if (standardIcon == QStyle::SP_ComputerIcon) {
        // Ubuntu has in some versions a 16x16 icon, see QTCREATORBUG-12832
        const QList<QSize> &sizes = icon.availableSizes();
        if (Utils::allOf(sizes, [](const QSize &size) { return size.width() < 32;})) {
            icon = QIcon(QLatin1String(":/core/images/Desktop.png"));
        }
    }
    return icon;
}
Esempio n. 28
0
void
SignalSettings::updateProperties()
{
    if (signal_)
    {
        ui->nameBox->setText(signal_->getName());
        ui->idLabel->setText(signal_->getId());
        ui->sSpinBox->setValue(signal_->getSStart());
        ui->tSpinBox->setValue(signal_->getT());
        ui->zOffsetSpinBox->setValue(signal_->getZOffset());
        ui->countryBox->setText(signal_->getCountry());

        ui->typeSpinBox->setValue(signal_->getType());
        ui->subclassLineEdit->setText(signal_->getTypeSubclass());
        ui->subtypeSpinBox->setValue(signal_->getSubtype());
		SignalContainer *signalContainer = signalManager_->getSignalContainer(signal_->getType(),signal_->getTypeSubclass(),signal_->getSubtype());
		if (signalContainer)
		{
			QIcon icon = signalContainer->getSignalIcon();
			ui->imageTextLabel->setPixmap(icon.pixmap(icon.availableSizes().first()).scaledToHeight(30));
		}
        ui->valueSpinBox->setValue(signal_->getValue());
        ui->hOffsetSpinBox->setValue(signal_->getHeading());
        ui->pitchSpinBox->setValue(signal_->getPitch());
        ui->rollSpinBox->setValue(signal_->getRoll());
        ui->dynamicCheckBox->setChecked(signal_->getDynamic());
        ui->orientationComboBox->setCurrentIndex(signal_->getOrientation());
        ui->poleCheckBox->setChecked(signal_->getPole());
        ui->sizeComboBox->setCurrentIndex(signal_->getSize() - 1);

        ui->fromLaneSpinBox->setValue(signal_->getValidFromLane());
        ui->toLaneSpinBox->setValue(signal_->getValidToLane());

		//Pedestrian Crossing has ancillary data
		//
		if ((signal_->getType() == 293) && !ui->crossingPushButton->isVisible())
		{
			enableCrossingParams(true);
		}
		else if (ui->crossingPushButton->isVisible() && (signal_->getType() != 293))
		{
			enableCrossingParams(false);
		}

		// User data //
		if (signal_->getType() == 293)
		{
			ui->crossingSpinBox->setValue(signal_->getCrossingProbability());
			ui->resetTimeSpinBox->setValue(signal_->getResetTime());
		}
    }
}
Esempio n. 29
0
	// reimplemented
	virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
	{
		QIcon icon = index.data(Qt::DecorationRole).value<QIcon>();
		QSize iconSize;
#if 0
		if (!icon.availableSizes().isEmpty())
			iconSize = icon.availableSizes().first();
		else
#endif
			iconSize = QSize(16, 16);

		int width = iconSize.width();
		width += 8;
		width += option.fontMetrics.width(index.data(Qt::DisplayRole).toString());
		width += 8;

		int height = iconSize.height();
		height = qMax(height, option.fontMetrics.height());
		height += 8;

		return QSize(width, height);
	}
VBoxAboutDlg::VBoxAboutDlg(QWidget *pParent, const QString &strVersion)
    : QIWithRetranslateUI2<QIDialog>(pParent)
    , m_strVersion(strVersion)
{
    /* Delete dialog on close: */
    setAttribute(Qt::WA_DeleteOnClose);

    /* Choose default image: */
    QString strPath(":/about.png");

    /* Branding: Use a custom about splash picture if set: */
    QString strSplash = vboxGlobal().brandingGetKey("UI/AboutSplash");
    if (vboxGlobal().brandingIsActive() && !strSplash.isEmpty())
    {
        char szExecPath[1024];
        RTPathExecDir(szExecPath, 1024);
        QString strTmpPath = QString("%1/%2").arg(szExecPath).arg(strSplash);
        if (QFile::exists(strTmpPath))
            strPath = strTmpPath;
    }

    /* Load image: */
    QIcon icon = UIIconPool::iconSet(strPath);
    m_size = icon.availableSizes().first();
    m_pixmap = icon.pixmap(m_size);

    /* Create main layout: */
    QVBoxLayout *pMainLayout = new QVBoxLayout(this);

    /* Create label for version text: */
    m_pLabel = new QLabel();
    pMainLayout->addWidget(m_pLabel);

    QPalette palette;
    /* Branding: Set a different text color (because splash also could be white),
     * otherwise use white as default color: */
    QString strColor = vboxGlobal().brandingGetKey("UI/AboutTextColor");
    if (!strColor.isEmpty())
        palette.setColor(QPalette::WindowText, QColor(strColor).name());
    else
        palette.setColor(QPalette::WindowText, Qt::black);
    m_pLabel->setPalette(palette);
    m_pLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
    m_pLabel->setFont(font());

    pMainLayout->setAlignment(m_pLabel, Qt::AlignRight | Qt::AlignBottom);

    /* Translate: */
    retranslateUi();
}