Пример #1
0
XCursorThemeData::XCursorThemeData (const QDir &aDir) {
    mHidden = false;
  // parse configs, etc
  mPath = aDir.path();
  setName(aDir.dirName());
  if (aDir.exists("index.theme")) parseIndexFile();
  if (mDescription.isEmpty()) mDescription = "no description";
  if (mTitle.isEmpty()) mTitle = mName;
}
Пример #2
0
XCursorTheme::XCursorTheme(const QDir &themeDir)
    : CursorTheme(themeDir.dirName())
{
    // Directory information
    setName(themeDir.dirName());
    setPath(themeDir.path());
    setIsWritable(QFileInfo(themeDir.path()).isWritable()); // ### perhaps this shouldn't be cached

    if (themeDir.exists(QStringLiteral("index.theme")))
        parseIndexFile();

    QString cursorFile = path() + "/cursors/left_ptr";
    QList<int> sizeList;
    XcursorImages *images = XcursorFilenameLoadAllImages(qPrintable(cursorFile));
    if (images)
    {
        for (int i = 0; i < images->nimage; ++i)
        {
            if (!sizeList.contains(images->images[i]->size))
                sizeList.append(images->images[i]->size);
        };
        XcursorImagesDestroy(images);
        qSort(sizeList.begin(), sizeList.end());
        m_availableSizes = sizeList;
    };
    if (!sizeList.isEmpty())
    {
        QString sizeListString = QString::number(sizeList.takeFirst());
        while (!sizeList.isEmpty())
        {
            sizeListString.append(", ");
            sizeListString.append(QString::number(sizeList.takeFirst()));
        };
        QString tempString = i18nc(
            "@info The argument is the list of available sizes (in pixel). Example: "
                "'Available sizes: 24' or 'Available sizes: 24, 36, 48'",
            "(Available sizes: %1)",
            sizeListString);
        if (m_description.isEmpty())
          m_description = tempString;
        else
          m_description = m_description + ' ' + tempString;
    };
}