示例#1
0
QVariant LinuxDeviceConfigurations::data(const QModelIndex &index, int role) const
{
    if (!index.isValid() || index.row() >= rowCount() || role != Qt::DisplayRole)
        return QVariant();
    const LinuxDeviceConfiguration::ConstPtr devConf = deviceAt(index.row());
    QString name = devConf->name();
    if (devConf->isDefault()) {
        name += QLatin1Char(' ') + tr("(default for %1)")
                .arg(RemoteLinuxUtils::osTypeToString(devConf->osType()));
    }
    return name;
}
示例#2
0
MaemoRemoteProcessesDialog::MaemoRemoteProcessesDialog(const LinuxDeviceConfiguration::ConstPtr &devConfig,
    QWidget *parent):
    QDialog(parent),
    m_ui(new Ui::MaemoRemoteProcessesDialog),
    m_processList(new MaemoRemoteProcessList(devConfig, this)),
    m_proxyModel(new QSortFilterProxyModel(this))
{
    m_ui->setupUi(this);
    m_ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
    m_proxyModel->setSourceModel(m_processList);
    m_proxyModel->setDynamicSortFilter(true);
    m_proxyModel->setFilterKeyColumn(1);
    m_ui->tableView->setModel(m_proxyModel);
    connect(m_ui->processFilterLineEdit, SIGNAL(textChanged(QString)),
        m_proxyModel, SLOT(setFilterRegExp(QString)));

    // Manually gathered process information is missing the command line for
    // some system processes. Dont's show these lines by default.
    if (devConfig->osType() == LinuxDeviceConfiguration::Maemo5OsType)
        m_ui->processFilterLineEdit->setText(QLatin1String("[^ ]+"));

    connect(m_ui->tableView->selectionModel(),
        SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
        SLOT(handleSelectionChanged()));
    connect(m_ui->updateListButton, SIGNAL(clicked()),
        SLOT(updateProcessList()));
    connect(m_ui->killProcessButton, SIGNAL(clicked()), SLOT(killProcess()));
    connect(m_processList, SIGNAL(error(QString)),
        SLOT(handleRemoteError(QString)));
    connect(m_processList, SIGNAL(modelReset()),
        SLOT(handleProcessListUpdated()));
    connect(m_processList, SIGNAL(processKilled()),
        SLOT(handleProcessKilled()), Qt::QueuedConnection);
    connect(m_proxyModel, SIGNAL(layoutChanged()),
        SLOT(handleProcessListUpdated()));
    handleSelectionChanged();
    updateProcessList();
}