Example #1
0
ThemePage::ThemePage(QWidget *parent)
    : QWidget(parent)
{
    setupUi(this);
    installKnsButton->setIcon(QIcon::fromTheme(QStringLiteral("get-hot-new-stuff")));
    installButton->setIcon(QIcon::fromTheme(QStringLiteral("document-import")));
    removeButton->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));

    model = new CursorThemeModel(this);

    proxy = new SortProxyModel(this);
    proxy->setSourceModel(model);
    proxy->setFilterCaseSensitivity(Qt::CaseSensitive);
    proxy->sort(NameColumn, Qt::AscendingOrder);

    // Get the icon size for QListView
    int size = style()->pixelMetric(QStyle::PM_LargeIconSize);

    view->setModel(proxy);
    view->setItemDelegate(new ItemDelegate(this));
    view->setIconSize(QSize(size, size));
    view->setSelectionMode(QAbstractItemView::SingleSelection);

    // Make sure we find out about selection changes
    connect(view->selectionModel(),
            &QItemSelectionModel::selectionChanged,
            this, &ThemePage::selectionChanged);

    // Make sure we find out about size changes
    connect(sizeComboBox,
            SIGNAL(currentIndexChanged(int)),
            SLOT(sizeChanged()));

    // Make sure we find out about user activity
    connect(sizeComboBox,
            SIGNAL(activated(int)),
            SLOT(preferredSizeChanged()));

    // Disable the install button if we can't install new themes to ~/.icons,
    // or Xcursor isn't set up to look for cursor themes there.
    if (!model->searchPaths().contains(QDir::homePath() + "/.icons") || !iconsIsWritable()) {
            installButton->setEnabled(false);
            installKnsButton->setEnabled(false);
    }

    connect(installKnsButton, &QAbstractButton::clicked, this, &ThemePage::getNewClicked);
    connect(installButton, &QAbstractButton::clicked, this, &ThemePage::installClicked);
    connect(removeButton,  &QAbstractButton::clicked, this, &ThemePage::removeClicked);
}
Example #2
0
SelectWnd::SelectWnd(LXQt::Settings* settings, QWidget *parent) : QWidget(parent), mSettings(settings)
{
    setupUi(this);

    warningLabel->hide();

    mModel = new XCursorThemeModel(this);

    int size = style()->pixelMetric(QStyle::PM_LargeIconSize);
    lbThemes->setModel(mModel);
    lbThemes->setItemDelegate(new ItemDelegate(this));
    lbThemes->setIconSize(QSize(size, size));
    lbThemes->setSelectionMode(QAbstractItemView::SingleSelection);

    // Make sure we find out about selection changes
    connect(lbThemes->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
            SLOT(currentChanged(const QModelIndex &, const QModelIndex &)));
    // display/hide warning label
    connect(mModel, SIGNAL(modelReset()),
                    this, SLOT(handleWarning()));
    connect(mModel, SIGNAL(rowsInserted(const QModelIndex&, int, int)),
                    this, SLOT(handleWarning()));
    connect(mModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
                    this, SLOT(handleWarning()));

    connect(warningLabel, SIGNAL(showDirInfo()),
                    this, SLOT(showDirInfo()));

    // Disable the install button if we can't install new themes to ~/.icons,
    // or Xcursor isn't set up to look for cursor themes there
    btInstall->setEnabled(mModel->searchPaths().contains(HOME_ICON_DIR) && iconsIsWritable());
    // TODO/FIXME: btInstall functionality
    btInstall->hide();
    btRemove->hide();

    //QTimer::singleShot(0, this, SLOT(setCurrent()));

    handleWarning();
}
Example #3
0
SelectWnd::SelectWnd (QWidget *parent) : QWidget(parent) {
  setupUi(this);
    closeButton->setIcon(XdgIcon::fromTheme("dialog-close"));

  mModel = new XCursorThemeModel(this);

  int size = style()->pixelMetric(QStyle::PM_LargeIconSize);
  lbThemes->setModel(mModel);
  lbThemes->setItemDelegate(new ItemDelegate(this));
  lbThemes->setIconSize(QSize(size, size));
  lbThemes->setSelectionMode(QAbstractItemView::SingleSelection);

  // Make sure we find out about selection changes
  connect(lbThemes->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), SLOT(currentChanged(const QModelIndex &, const QModelIndex &)));

  // Disable the install button if we can't install new themes to ~/.icons,
  // or Xcursor isn't set up to look for cursor themes there
    btInstall->setEnabled(mModel->searchPaths().contains(HOME_ICON_DIR) && iconsIsWritable());
    // TODO/FIXME: btInstall functionality
    btInstall->hide();
    btRemove->hide();

  //QTimer::singleShot(0, this, SLOT(setCurrent()));
}