当前位置: 首页>>代码示例>>C++>>正文


C++ KUniqueApplication::setWindowIcon方法代码示例

本文整理汇总了C++中KUniqueApplication::setWindowIcon方法的典型用法代码示例。如果您正苦于以下问题:C++ KUniqueApplication::setWindowIcon方法的具体用法?C++ KUniqueApplication::setWindowIcon怎么用?C++ KUniqueApplication::setWindowIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KUniqueApplication的用法示例。


在下文中一共展示了KUniqueApplication::setWindowIcon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
    KAboutData aboutData("installer", 0, ki18n("Installer"),
    TRIBE_VERSION, ki18n("Graphical Installer for KaOS, forked from the Chakra-Project"), KAboutData::License_GPL,
                        ki18n("(c) 2008 - 2012 the Chakra Development Team"), ki18n("[email protected]"), "http://chakra-project.org");
    aboutData.addAuthor(ki18n("Manuel Tortosa"), ki18n("Maintainer"), "[email protected]", "http://chakra-project.org"); 
    aboutData.addAuthor(ki18n("Dario Freddi"), ki18n("Developer"), "[email protected]", "http://drfav.wordpress.com");
    aboutData.addAuthor(ki18n("Lukas Appelhans"), ki18n("Developer"), "[email protected]", "http://boom1992.wordpress.com");
    aboutData.addAuthor(ki18n("Jan Mette"), ki18n("PostInstall Backend and Artwork"), "", "");
    aboutData.addAuthor(ki18n("Phil Miller"), ki18n("PostInstall Backend"), "[email protected]", "http://chakra-project.org");
    aboutData.addAuthor(ki18n("Drake Justice"), ki18n("Developer"), "[email protected]", "");
    aboutData.addAuthor(ki18n("Georg Grabler"), ki18n("Developer"), "[email protected]", "");
    aboutData.addAuthor(ki18n("Daniele Cocca"), ki18n("Developer"), "[email protected]", "");
    aboutData.setBugAddress("http://kaosx.us/phpBB3/");

    KCmdLineArgs::init(argc, argv, &aboutData);

    if (!KUniqueApplication::start()) {
        qWarning("Installer is already running!\n");
        return 0;
    }

    // TODO: Port to KDBusService with FrameWorks5
    KUniqueApplication app;

    app.setWindowIcon(KIcon("tribe"));
    
    // Check the available memory before starting
    QFile memfile;
    memfile.setFileName("/proc/meminfo");
    if (memfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QTextStream in(&memfile);
        QString totalmem = in.readLine();
        memfile.close();               

        totalmem.remove(QRegExp("[^\\d]"));
        uint ram = (totalmem.toUInt() / 1024);

        qDebug() << ":: Starting Installer, RAM available for this install: " << ram << " Mbytes";
    
        if (ram < MIN_MEMORY) {
            int m = KMessageBox::warningContinueCancel(0, i18n("Your system does not meet the minimal memory needed\n"
                    "for installing KaOS with Installer (1gb), total available memory: %1 mbytes\n\n"
                    "Continue at your own risk", ram));
            if (m == KMessageBox::Cancel)
                return 0;
        }
    }
    
    // Check if we have a battery and if the power addaptop is plugged
    bool pu = false;

    foreach(const Solid::Device &device, Solid::Device::listFromType(Solid::DeviceInterface::Battery, QString())) {
        const Solid::Battery *b = qobject_cast<const Solid::Battery*> (device.asDeviceInterface(Solid::DeviceInterface::Battery));
        if(b->type() == Solid::Battery::PrimaryBattery || b->type() == Solid::Battery::UpsBattery) {
            qDebug() << ":: A battery or UPS has been detected";
            if (b->chargeState() == Solid::Battery::Discharging)
                pu = true;
            break;
        }
    }

    if (pu) {
        int r = KMessageBox::warningContinueCancel(0, i18n("It looks like your power adaptar is unplugged. "
                "Installation is a delicate and lenghty process, hence it is strongly advised to have your "
                "PC connected to AC to minimize possible risks."));
        if (r == KMessageBox::Cancel) {
            return 0;
        }
        qDebug() << ":: The power adapter is unplugged";
    }

    // Load the styleSheet
    QFile file(STYLESHEET_INSTALL_PATH);
    file.open(QFile::ReadOnly);
    QString styleSheet = QLatin1String(file.readAll());

    qApp->setStyleSheet(styleSheet);

    MainWindow mw;

    mw.show();

    return app.exec();
}
开发者ID:KdeOs,项目名称:Tribe,代码行数:85,代码来源:main.cpp


注:本文中的KUniqueApplication::setWindowIcon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。