int main(int argc, char **argv) { CArgs args("-file:s (Image file"); args.parse(&argc, argv); std::string filename = args.getStringArg("-file"); if (! CFile::exists(filename) || ! CFile::isRegular(filename)) { args.usage("CXRootImage"); exit(1); } CXMachineInst->openDisplay(""); CImageFileSrc src(filename); CImagePtr image = CImageMgrInst->lookupImage(src); if (! image.isValid()) { args.usage("CXRootImage"); exit(1); } setRootImage(image); return 0; }
GreeterWindow::GreeterWindow(QWidget *parent) : QDeclarativeView(parent), m_greeter(new GreeterWrapper(this)) { setResizeMode(QDeclarativeView::SizeRootObjectToView); KDeclarative kdeclarative; kdeclarative.setDeclarativeEngine(engine()); kdeclarative.initialize(); //binds things like kconfig and icons kdeclarative.setupBindings(); KConfig config(LIGHTDM_CONFIG_DIR "/lightdm-kde-greeter.conf"); KConfigGroup configGroup = config.group("greeter"); QString theme = configGroup.readEntry("theme-name", "userbar"); QStringList dirs = KGlobal::dirs()->findDirs("appdata", "themes/"); Plasma::PackageStructure::Ptr packageStructure(new LightDMPackageStructure(this)); Plasma::Package package(dirs.last() + "/" + theme, packageStructure); if (!package.isValid()) { kError() << theme << " is not a valid theme. Falling back to \"userbar\" theme."; package = Plasma::Package(dirs.last() + "/" + "userbar", packageStructure); } if (!package.isValid()) { kFatal() << "Cannot find QML file for \"userbar\" theme. Something is wrong with this installation. Aborting."; } KGlobal::locale()->insertCatalog("lightdm_theme_" + theme); rootContext()->setContextProperty("config", new ConfigWrapper(package.filePath("configfile"), this)); rootContext()->setContextProperty("greeter", m_greeter); setSource(package.filePath("mainscript")); // Prevent screen flickering when the greeter starts up. This really needs to be sorted out in QML/Qt... setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_NoSystemBackground); // Shortcut to take a screenshot of the screen. Handy because it is not // possible to take a screenshot of the greeter in test mode without // including the cursor. QShortcut* cut = new QShortcut(this); cut->setKey(Qt::CTRL + Qt::ALT + Qt::Key_S); connect(cut, SIGNAL(activated()), SLOT(screenshot())); connect(m_greeter, SIGNAL(aboutToLogin()), SLOT(setRootImage())); QRect screen = QApplication::desktop()->rect(); setGeometry(screen); new PowerManagement(this); }