コード例 #1
0
ファイル: kdebrowser.cpp プロジェクト: walac/kde-workspace
QIcon KDEFavicon::iconFor(const QString &url)  {
    const QString iconFile = KMimeType::favIconForUrl(KUrl(url));
    if (iconFile.isEmpty()) {
        return defaultIcon();
    }
    return KIcon(iconFile);
}
コード例 #2
0
    void refresh()
    {
        mAddressee = mDocument->findByUid(mAddressee.uid());

        if(!mAddressee.isEmpty())
            setText(mAddressee.givenName() + " " + mAddressee.familyName());

        QPixmap icon;
        QPixmap defaultIcon(KGlobal::iconLoader()->loadIcon("vcard", KIcon::Desktop));
        KABC::Picture pic = mAddressee.photo();
        if(pic.data().isNull())
            pic = mAddressee.logo();

        if(pic.isIntern() && !pic.data().isNull())
        {
            QImage img = pic.data();
            if(img.width() > img.height())
                icon = img.scaleWidth(32);
            else
                icon = img.scaleHeight(32);
        }
        else
            icon = defaultIcon;

        setPixmap(icon);
    }
コード例 #3
0
void PanelButton::loadIcons()
{
    KIconLoader * ldr = KGlobal::iconLoader();
    QString nm = m_iconName;
    KIcon::States defaultState = isEnabled() ? KIcon::DefaultState :
                                               KIcon::DisabledState;
    m_icon = ldr->loadIcon(nm, KIcon::Panel, m_size, defaultState, 0L, true);

    if (m_icon.isNull())
    {
        nm = defaultIcon();
        m_icon = ldr->loadIcon(nm, KIcon::Panel, m_size, defaultState);
    }

    if (!isEnabled())
    {
        m_iconh = m_icon;
    }
    else
    {
        m_iconh = ldr->loadIcon(nm, KIcon::Panel, m_size,
                                KIcon::ActiveState, 0L, true);
    }

    m_iconz = ldr->loadIcon(nm, KIcon::Panel, KIcon::SizeHuge,
                            defaultState, 0L, true );
}
コード例 #4
0
QIcon BrowserApplication::icon(const QUrl &url) const
{
#if defined(QTWEBENGINE_ICONDATABASE)
    QIcon icon = QWebEngineSettings::iconForUrl(url);
    if (!icon.isNull())
        return icon.pixmap(16, 16);
#else
    Q_UNUSED(url);
#endif
    return defaultIcon();
}
コード例 #5
0
ファイル: gtrayicon.cpp プロジェクト: ramonelalto/gambas
void gTrayIcon::updatePicture()
{
	GdkPixbuf *pixbuf;

	if (!plug)
		return;

	if (_icon)
		pixbuf = _icon->getPixbuf();
	else
		pixbuf = defaultIcon()->getPixbuf();

	gtk_status_icon_set_from_pixbuf(plug, pixbuf);

	_iconw = gdk_pixbuf_get_width(pixbuf);
	_iconh = gdk_pixbuf_get_height(pixbuf);
}
コード例 #6
0
/*!
  \return A rectangle filled with the color of the brush ( or the pen )

  \param index Index of the legend entry 
                ( usually there is only one )
  \param size Icon size

  \sa setLegendIconSize(), legendData()
*/
QwtGraphic QwtPlotShapeItem::legendIcon( int index,
    const QSizeF &size ) const
{
    Q_UNUSED( index );

    QwtGraphic icon;
    icon.setDefaultSize( size );

    if ( size.isEmpty() )
        return icon;

    if ( d_data->legendMode == QwtPlotShapeItem::LegendShape )
    {
        const QRectF &br = d_data->boundingRect;

        QPainter painter( &icon );
        painter.setRenderHint( QPainter::Antialiasing,
            testRenderHint( QwtPlotItem::RenderAntialiased ) );

        painter.translate( -br.topLeft() );

        painter.setPen( d_data->pen );
        painter.setBrush( d_data->brush );
        painter.drawPath( d_data->shape );
    }
    else
    {
        QColor iconColor;
        if ( d_data->brush.style() != Qt::NoBrush )
            iconColor = d_data->brush.color();
        else
            iconColor = d_data->pen.color();

        icon = defaultIcon( iconColor, size );
    }

    return icon;
}
コード例 #7
0
ファイル: app.cpp プロジェクト: manhtukhang/cmplayer
App::App(int &argc, char **argv)
: QApplication(argc, argv), d(new Data(this)) {
#ifdef Q_OS_LINUX
    setlocale(LC_NUMERIC,"C");
#endif
    setOrganizationName(u"xylosper"_q);
    setOrganizationDomain(u"xylosper.net"_q);
    setApplicationName(_L(name()));
    setApplicationVersion(_L(version()));

    Record r(APP_GROUP);
    QVariant vLocale;
    r.read(vLocale, u"locale"_q);
    setLocale(Locale::fromVariant(vLocale));

    d->addOption(LineCmd::Open, u"open"_q,
                 tr("Open given %1 for file path or URL."), u"mrl"_q);
    d->addOption(LineCmd::Wake, u"wake"_q,
                 tr("Bring the application window in front."));
    d->addOption(LineCmd::Action, u"action"_q,
                 tr("Exectute %1 action or open %1 menu."), u"id"_q);
    d->addOption(LineCmd::LogLevel, u"log-level"_q,
                 tr("Maximum verbosity for log. %1 should be one of nexts:")
                 % "\n    "_a % Log::options().join(u", "_q), u"lv"_q);
    d->addOption(LineCmd::OpenGLDebug, u"opengl-debug"_q,
                 tr("Turn on OpenGL debug logger."));
    d->addOption(LineCmd::Debug, u"debug"_q,
                 tr("Turn on options for debugging."));
    d->getCommandParser(&d->cmdParser)->process(arguments());
    d->getCommandParser(&d->msgParser);
    d->execute(&d->cmdParser);

#if defined(Q_OS_MAC) && defined(CMPLAYER_RELEASE)
    static const auto path = QApplication::applicationDirPath().toLocal8Bit();
    _Debug("Set $LIBQUVI_SCRIPTSDIR=\"%%\"", path);
    if (setenv("LIBQUVI_SCRIPTSDIR", path.data(), 1) < 0)
        _Error("Cannot set $LIBQUVI_SCRIPTSDIR. "
               "Some streaming functions won't work.");
#endif

    setQuitOnLastWindowClosed(false);
#ifndef Q_OS_MAC
    setWindowIcon(defaultIcon());
#endif

    auto makeStyle = [&]() {
        auto name = r.value(u"style"_q, styleName()).toString();
        if (style()->objectName().compare(name, QCI) == 0)
            return;
        if (!d->styleNames.contains(name, QCI))
            return;
        setStyle(QStyleFactory::create(name));
    };
    d->styleNames = [this] () {
        auto names = QStyleFactory::keys();
        const auto defaultName = style()->objectName();
        for (auto it = ++names.begin(); it != names.end(); ++it) {
            if (defaultName.compare(*it, QCI) == 0) {
                const auto name = *it;
                names.erase(it);
                names.prepend(name);
                break;
            }
        }
        return names;
    }();
    makeStyle();
    connect(&d->connection, &LocalConnection::messageReceived,
             this, &App::handleMessage);
    const auto map = r.value(u"open_folders"_q).toMap();
    QMap<QString, QString> folders;
    for (auto it = map.begin(); it != map.end(); ++it)
        folders.insert(it.key(), it->toString());
    set_open_folders(folders);
}
コード例 #8
0
Image* IconDatabase::iconForPageURL(const String& /*pageURL*/, const IntSize& size)
{
    return defaultIcon(size);
}
コード例 #9
0
IconLoadStatus IconDatabase::iconForPageURL(const String& pageURLOriginal, const IntSize& size, Image** outImage)
{
    *outImage = defaultIcon(size);
    return IconNotFound;
}
コード例 #10
0
ファイル: app.cpp プロジェクト: akhilo/cmplayer
void App::setMainWindow(MainWindow *mw) {
	d->main = mw;
#ifndef Q_OS_MAC
	d->main->setWindowIcon(defaultIcon());
#endif
}
コード例 #11
0
ファイル: app.cpp プロジェクト: akhilo/cmplayer
App::App(int &argc, char **argv)
: QApplication(argc, argv), d(new Data(this)) {
#ifdef Q_OS_LINUX
	setlocale(LC_NUMERIC,"C");
#endif
	setOrganizationName("xylosper");
	setOrganizationDomain("xylosper.net");
	setApplicationName(Info::name());
	setApplicationVersion(Info::version());
	setLocale(Record(APP_GROUP).value("locale", QLocale::system()).toLocale());

	d->addOption(LineCmd::Open, "open", tr("Open given %1 for file path or URL."), "mrl");
	d->addOption(LineCmd::Wake, QStringList() << "wake", tr("Bring the application window in front."));
	d->addOption(LineCmd::Action, "action", tr("Exectute %1 action or open %1 menu."), "id");
	d->addOption(LineCmd::LogLevel, "log-level", tr("Maximum verbosity for log. %1 should be one of nexts:")
				 % "\n    " % Log::options().join(", "), "lv");
	d->addOption(LineCmd::OpenGLDebug, "opengl-debug", tr("Turn on OpenGL debug logger."));
	d->addOption(LineCmd::Debug, "debug", tr("Turn on options for debugging."));
	d->getCommandParser(&d->cmdParser)->process(arguments());
	d->getCommandParser(&d->msgParser);
	d->execute(&d->cmdParser);

#if defined(Q_OS_MAC) && defined(CMPLAYER_RELEASE)
	static const QByteArray path = QApplication::applicationDirPath().toLocal8Bit();
	_Debug("Set $LIBQUVI_SCRIPTSDIR=\"%%\"", QApplication::applicationDirPath());
	if (setenv("LIBQUVI_SCRIPTSDIR", path.data(), 1) < 0)
		_Error("Cannot set $LIBQUVI_SCRIPTSDIR. Some streaming functions won't work.");
#endif

	setQuitOnLastWindowClosed(false);
#ifndef Q_OS_MAC
	setWindowIcon(defaultIcon());
#endif
	auto makeStyleNameList = [this] () {
		auto names = QStyleFactory::keys();
		const auto defaultName = style()->objectName();
		for (auto it = ++names.begin(); it != names.end(); ++it) {
			if (defaultName.compare(*it, Qt::CaseInsensitive) == 0) {
				const auto name = *it;
				names.erase(it);
				names.prepend(name);
				break;
			}
		}
		return names;
	};
	auto makeStyle = [this]() {
		Record r(APP_GROUP);
		auto name = r.value("style", styleName()).toString();
		if (style()->objectName().compare(name, Qt::CaseInsensitive) == 0)
			return;
		if (!d->styleNames.contains(name, Qt::CaseInsensitive))
			return;
		setStyle(QStyleFactory::create(name));
	};
	d->styleNames = makeStyleNameList();
	makeStyle();
	connect(&d->connection, &LocalConnection::messageReceived, [this] (const QString &message) {
		d->msgParser.parse(message.split("[:sep:]")); d->execute(&d->msgParser);
	});
}
コード例 #12
0
ファイル: app.cpp プロジェクト: ertos12/bomi
App::App(int &argc, char **argv)
: QApplication(argc, argv), d(new Data(this)) {
    if (QFile::exists(applicationDirPath() % "/bomi.ini"_a)) {
        QSettings set(applicationDirPath() % "/bomi.ini"_a, QSettings::IniFormat);
        d->useLocalConfig = set.value(u"app/use-local-config"_q, false).toBool();
        Global::useLocalConfig = set.value(u"global/use-local-config"_q, false).toBool();
        if (d->useLocalConfig != Global::useLocalConfig) {
            const auto from = _WritablePath(Location::Config, false);
            Global::useLocalConfig = d->useLocalConfig;
            const auto to = _WritablePath(Location::Config, false);
            d->copyConfig(from, to);
            set.setValue(u"global/use-local-config"_q, Global::useLocalConfig);
        }
    }

#ifdef Q_OS_LINUX
    setlocale(LC_NUMERIC,"C");
#endif

    OS::initialize();

    _New(d->parser);
    d->parser->addOption(LineCmd::Open, u"open"_q,
                         u"Open given %1 for file path or URL."_q, u"mrl"_q);
    d->parser->addOption(LineCmd::SetSubtitle, u"set-subtitle"_q,
                         u"Set subtitle file to display."_q, u"file"_q);
//    d->parser->addOption(LineCmd::AddSubtitle, u"add-subtitle"_q,
//                         u"Add subtitle file to display."_q, u"file"_q);
    d->parser->addOption(LineCmd::Wake, u"wake"_q,
                         u"Bring the application window in front."_q);
    d->parser->addOption(LineCmd::Action, u"action"_q,
                         u"Exectute %1 action or open %1 menu."_q, u"id"_q);
    d->parser->addOption(LineCmd::LogLevel, u"log-level"_q,
                         u"Maximum verbosity for log. %1 should be one of nexts:\n    "_q
                         % Log::levelNames().join(u", "_q), u"lv"_q);
    d->parser->addOption(LineCmd::Debug, u"debug"_q,
                         u"Turn on options for debugging."_q);
    d->parser->addOption(LineCmd::DumpApiTree, u"dump-api-tree"_q,
                         u"Dump API structure tree to stdout."_q);
    d->parser->addOption(LineCmd::DumpActionList, u"dump-action-list"_q,
                         u"Dump executable action list to stdout."_q);
#ifdef Q_OS_WIN
    d->parser->addOption(LineCmd::WinAssoc, u"win-assoc"_q,
                         u"Associate given comma-separated extension list."_q, u"ext"_q);
    d->parser->addOption(LineCmd::WinUnassoc, u"win-unassoc"_q,
                         u"Unassociate all extensions."_q);
    d->parser->addOption(LineCmd::WinAssocDefault, u"win-assoc-default"_q,
                         u"Associate default extensions."_q);
#endif
    d->parser->parse(arguments());
    d->gldebug = d->parser->isSet(LineCmd::Debug);
    const auto lvStdOut = d->parser->stdoutLogLevel();

    d->import();

    d->storage.setObject(this, u"application"_q);
    d->storage.add("locale", &d->locale);
    d->storage.json("log-option", &d->logOption);
    d->storage.add("style-name", &d->styleName);
    d->storage.add("unique", &d->unique);
    d->storage.add("open-folders", open_folders, set_open_folders);
    d->storage.add("font");
    d->storage.add("fixedFont");
    d->storage.restore();

    setLocale(d->locale);

    auto logOption = d->logOption;
    if (logOption.level(LogOutput::StdOut) < lvStdOut)
        logOption.setLevel(LogOutput::StdOut, lvStdOut);
    Log::setOption(logOption);

    setQuitOnLastWindowClosed(false);
#ifndef Q_OS_MAC
    setWindowIcon(defaultIcon());
#endif

    d->styleNames = [this] () {
        auto names = QStyleFactory::keys();
        const auto defaultName = style()->objectName();
        for (auto it = ++names.begin(); it != names.end(); ++it) {
            if (defaultName.compare(*it, Qt::CaseInsensitive) == 0) {
                const auto name = *it;
                names.erase(it);
                names.prepend(name);
                break;
            }
        }
        return names;
    }();
    auto makeStyle = [&]() {
        auto name = d->styleName;
        if (style()->objectName().compare(name, Qt::CaseInsensitive) == 0)
            return;
        if (!d->styleNames.contains(name, Qt::CaseInsensitive))
            return;
        setStyle(QStyleFactory::create(name));
    };
    makeStyle();
    connect(&d->connection, &LocalConnection::messageReceived,
            this, &App::handleMessage);
}
コード例 #13
0
/*!
  \return A rectangle filled with the color of the symbol pen

  \param index Index of the legend entry
                ( usually there is only one )
  \param size Icon size

  \sa setLegendIconSize(), legendData()
*/
QwtGraphic QwtPlotTradingCurve::legendIcon( int index,
    const QSizeF &size ) const
{
    Q_UNUSED( index );
    return defaultIcon( d_data->symbolPen.color(), size );
}
コード例 #14
0
ファイル: myapp.cpp プロジェクト: yohanson/astercti
bool MyApp::OnInit()
{
#ifndef __WXMSW__
    if (wxPlatformInfo::Get().GetOperatingSystemId() & wxOS_UNIX)
    {
        wxStandardPaths::Get().SetInstallPrefix("/usr");
    }
#endif
    wxString datadir = wxStandardPaths::Get().GetDataDir() + wxFileName::GetPathSeparator();
    if (!setlocale(LC_CTYPE, ""))
    {
        fprintf(stderr, "Can't set the specified locale! "
                    "Check LANG, LC_CTYPE, LC_ALL.\n");
    return 1;
    }
    m_locale.Init();
    m_locale.AddCatalog("astercti");

    m_start_gui = ParseCmdLine();
    if (!m_start_gui) return true;

    m_config = NULL;
    m_config = new wxFileConfig(wxT("astercti"),
                                wxEmptyString,
                                wxT("astercti.ini"),
                                wxEmptyString,
                                wxCONFIG_USE_SUBDIR);
    wxFileName configfile = m_config->GetLocalFile("astercti.ini", wxCONFIG_USE_SUBDIR);
    if (!configfile.IsFileReadable())
    {
        std::ostringstream msg;
        msg << _("Error opening config file.") << std::endl
            << _("Sample config is at ") << configfile.GetFullPath() << ".default" << std::endl
            << _("Rename it to astercti.ini and edit.");
        wxLogError("%s", msg.str());
        return false;
    }

    m_chanstatuspool = new ChannelStatusPool(m_config->Read("dialplan/channel").ToStdString());
    if (m_config->HasEntry("lookup/lookup_url"))
    {
        m_lookuper = new CallerInfoLookuperURL(Cfg("lookup/lookup_url"));
    }
    else if (m_config->HasEntry("lookup/lookup_cmd"))
    {
        m_lookuper = new CallerInfoLookuperCmd(Cfg("lookup/lookup_cmd"));
    }
    else
    {
        m_lookuper = NULL;
    }
    wxPoint pos = m_config->ReadObject("autosave/position", wxDefaultPosition);
    wxSize size = m_config->ReadObject("autosave/size", wxSize(600, 400));
    asterisk = new Asterisk(m_config->Read("server/address").ToStdString(),
        5038,
        m_config->Read("server/username").ToStdString(),
        m_config->Read("server/password").ToStdString());
    bool maximized = m_config->ReadBool("autosave/maximized", false);
    m_mainframe = new MyFrame( "AsterCTI", pos, size, m_chanstatuspool, asterisk, m_lookuper, Cfg("lookup/caller_name_field"));
    if (maximized) m_mainframe->Maximize();
    m_mychanfilter = new MyChanFilter(m_config->Read("dialplan/channel").ToStdString());
    m_intmsgfilter = new InternalMessageFilter();
    m_numbershortener = new ShortenNumberModifier(m_config->Read("lookup/replace_number_prefix").ToStdString());
    asterisk->observable_descr = "asterisk";
    m_mychanfilter->observable_descr = "mychanfilter";
    m_intmsgfilter->observable_descr = "intmsgfilter";
    asterisk->broadcast(*m_mychanfilter);
    asterisk->broadcast(*m_intmsgfilter);
    asterisk->broadcast(*m_chanstatuspool);
    m_mychanfilter->broadcast(*m_numbershortener);
    m_numbershortener->broadcast(*m_mainframe);
    m_intmsgfilter->broadcast(*m_mainframe);
    notificationFrame *notifyframe = new notificationFrame(m_mainframe, m_chanstatuspool, asterisk, m_lookuper);
    Executer *executer = new Executer(m_lookuper);
    m_events = new EventGenerator(m_config->Read("dialplan/exten").ToStdString());
    m_events->broadcast(*m_mainframe);
    m_events->broadcast(*notifyframe);
    m_events->broadcast(*executer);
    m_numbershortener->broadcast(*m_events);
    m_intmsgfilter->broadcast(*m_events);
    wxIcon defaultIcon(ACTI_ICON("astercti"));
    wxIcon  missedIcon(ACTI_ICON("astercti-missed"));
    m_mainframe->SetIcon(defaultIcon);
    m_taskbaricon = new MyTaskBarIcon(defaultIcon, missedIcon, "AsterCTI: " + m_config->Read("dialplan/exten"));
    m_taskbaricon->SetMainFrame(m_mainframe);
    m_mainframe->SetTaskBarIcon(m_taskbaricon);
    m_mainframe->Show(!start_iconified);
    SetTopWindow(m_mainframe);
    SetExitOnFrameDelete(true);
    if (!m_lookuper)
    {
        m_mainframe->Log(_("Lookup URL and Lookup command are both unconfigured.\nLookup disabled."));
    }
    m_ipcServer = new IpcServer();
    if (!m_ipcServer->Create(IPC_SERVICENAME))
        wxLogMessage("Failure creating IPC Server %s", IPC_SERVICENAME);
#ifndef __WXMSW__
    wxHandleFatalExceptions();
#endif
    return true;
}