Пример #1
0
FlowsWidget::FlowsWidget(QWidget *parent) : QWidget(parent)
{
    qDebug() << __FUNCTION__;

    QStringList columnNames;
    columnNames << "ID"
                << "Название потока"
                << "Список групп"
                << "Примечание";

    flowsTableModel = EkonTables::createTableModel(this, "VIEW_FLOWS", columnNames);
    filterProxyModel = new CheckableSortFilterProxyModel(this);
    filterProxyModel->setSourceModel(flowsTableModel);
    flowsTableView = EkonTables::createTableView(this, filterProxyModel);
    flowsTableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    flowsTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);

    controlWidget = new ControlWidget(this);

    QGridLayout *layout = new QGridLayout(this);
    layout->addWidget(flowsTableView);
    layout->addWidget(controlWidget);

    this->setLayout(layout);

    connect(controlWidget, SIGNAL(addRow()), this, SLOT(addRow()));
    connect(controlWidget, SIGNAL(removeRow()), this, SLOT(deleteRow()));
    connect(flowsTableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(editRow(QModelIndex)));
    connect(controlWidget, SIGNAL(filter(QString)), filterProxyModel, SLOT(setFilterFixedString(QString)));
    connect(controlWidget, SIGNAL(search(QString)), filterProxyModel, SLOT(setColorFilterString(QString)));
}
CookieExceptionsDialog::CookieExceptionsDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::CookieExceptionsDialog),
    m_cookieJar(0)
{
    ui->setupUi(this);
    setWindowFlags(Qt::Sheet);
    connect(ui->removeButton, SIGNAL(clicked()), this, SLOT(remove()));
    connect(ui->removeAllButton, SIGNAL(clicked()), this, SLOT(removeAll()));
    m_exceptionsModel = new CookieExceptionsModel(this);
    m_proxyModel = new QSortFilterProxyModel(this);
    m_proxyModel->setSourceModel(m_exceptionsModel);
    connect(ui->search, SIGNAL(textChanged(QString)),
            m_proxyModel, SLOT(setFilterFixedString(QString)));
    ui->exceptionTable->setModel(m_proxyModel);

    CookieModel *cookieModel = new CookieModel(this);
    ui->domainLineEdit->setCompleter(new QCompleter(cookieModel, ui->domainLineEdit));

    connect(ui->domainLineEdit, SIGNAL(textChanged(QString)),
            this, SLOT(textChanged(QString)));
    connect(ui->blockButton, SIGNAL(clicked()), this, SLOT(block()));
    connect(ui->allowButton, SIGNAL(clicked()), this, SLOT(allow()));
    connect(ui->allowForSessionButton, SIGNAL(clicked()), this, SLOT(allowForSession()));

    adjustColumns();
}
NickNameDialog::NickNameDialog(QStandardItemModel *model, QWidget *parent) :
        QDialog(parent),
        m_ui(new Ui::NickNameDialog),
        m_model(model),
        m_filterModel(new QSortFilterProxyModel(this))
{
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    m_ui->setupUi(this);
    okButton()->setEnabled(false);

    // Populate model and grow tree to accommodate it
    m_filterModel->setSourceModel(model);
    m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
    m_ui->filterTreeView->setModel(m_filterModel);
    const int columnCount = m_filterModel->columnCount();
    int treeWidth = 0;
    for (int c = 0; c < columnCount; c++) {
        m_ui->filterTreeView->resizeColumnToContents(c);
        treeWidth += m_ui->filterTreeView->columnWidth(c);
    }
    m_ui->filterTreeView->setMinimumWidth(treeWidth + 20);
    connect(m_ui->filterTreeView, SIGNAL(doubleClicked(QModelIndex)), this,
            SLOT(slotDoubleClicked(QModelIndex)));
    connect(m_ui->filterTreeView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
            this, SLOT(slotCurrentItemChanged(QModelIndex)));
    connect(m_ui->filterLineEdit, SIGNAL(filterChanged(QString)),
            m_filterModel, SLOT(setFilterFixedString(QString)));
}
Пример #4
0
DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false),
	currentHeaderClicked(-1), searchBox(new QLineEdit(this))
{
	setUniformRowHeights(true);
	setItemDelegateForColumn(TreeItemDT::RATING, new StarWidgetsDelegate());
	QSortFilterProxyModel *model = new QSortFilterProxyModel(this);
	model->setSortRole(TreeItemDT::SORT_ROLE);
	model->setFilterKeyColumn(-1); // filter all columns
	setModel(model);
	connect(model, SIGNAL(layoutChanged()), this, SLOT(fixMessyQtModelBehaviour()));

	setSortingEnabled(false);
	setContextMenuPolicy(Qt::DefaultContextMenu);
	header()->setContextMenuPolicy(Qt::ActionsContextMenu);
	QAction *showSearchBox = new QAction(tr("Show Search Box"), this);
	showSearchBox->setShortcut( Qt::CTRL + Qt::Key_F);
	showSearchBox->setShortcutContext(Qt::ApplicationShortcut);
	addAction(showSearchBox);

	searchBox->installEventFilter(this);
	searchBox->hide();
	connect(showSearchBox, SIGNAL(triggered(bool)), this, SLOT(showSearchEdit()));
	connect(searchBox, SIGNAL(textChanged(QString)), model, SLOT(setFilterFixedString(QString)));
	selectedTrips.clear();
}
Пример #5
0
HistoryDialog::HistoryDialog(QWidget *parent, HistoryManager *setHistory) : QDialog(parent)
{
    HistoryManager *history = setHistory;
    if (!history)
        history = BrowserApplication::historyManager();
    setupUi(this);
    tree->setUniformRowHeights(true);
    tree->setSelectionBehavior(QAbstractItemView::SelectRows);
    tree->setTextElideMode(Qt::ElideMiddle);
    QAbstractItemModel *model = history->historyTreeModel();
    TreeProxyModel *proxyModel = new TreeProxyModel(this);
    connect(search, SIGNAL(textChanged(QString)),
            proxyModel, SLOT(setFilterFixedString(QString)));
    connect(removeButton, SIGNAL(clicked()), tree, SLOT(removeOne()));
    connect(removeAllButton, SIGNAL(clicked()), history, SLOT(clear()));
    proxyModel->setSourceModel(model);
    tree->setModel(proxyModel);
    tree->setExpanded(proxyModel->index(0, 0), true);
    tree->setAlternatingRowColors(true);
    QFontMetrics fm(font());
    int header = fm.width(QLatin1Char('m')) * 40;
    tree->header()->resizeSection(0, header);
    tree->header()->setStretchLastSection(true);
    connect(tree, SIGNAL(activated(QModelIndex)),
            this, SLOT(open()));
    tree->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(tree, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(customContextMenuRequested(QPoint)));
}
QmlProfilerStatisticsMainView::QmlProfilerStatisticsMainView(QmlProfilerStatisticsModel *model) :
    m_model(model)
{
    setViewDefaults(this);
    setObjectName(QLatin1String("QmlProfilerEventsTable"));

    auto sortModel = new QSortFilterProxyModel(this);
    sortModel->setSourceModel(model);
    sortModel->setSortRole(SortRole);
    sortModel->setSortCaseSensitivity(Qt::CaseInsensitive);
    sortModel->setFilterRole(FilterRole);
    sortModel->setFilterKeyColumn(MainType);
    sortModel->setFilterFixedString("+");

    setModel(sortModel);

    connect(this, &QAbstractItemView::activated, this, [this](const QModelIndex &index) {
        jumpToItem(index.data(TypeIdRole).toInt());
    });

    setSortingEnabled(true);
    sortByColumn(DEFAULT_SORT_COLUMN, Qt::DescendingOrder);

    setShowExtendedStatistics(m_showExtendedStatistics);
    setRootIsDecorated(false);

    resizeColumnToContents(MainLocation);
    resizeColumnToContents(MainType);
}
Пример #7
0
TagFilter::TagFilter(QWidget *parent) : QWidget(parent)
{
	ui.setupUi(this);
	QSortFilterProxyModel *filter = new QSortFilterProxyModel();
	filter->setSourceModel(TagFilterModel::instance());
	connect(ui.filterTag, SIGNAL(textChanged(QString)), filter, SLOT(setFilterFixedString(QString)));
	ui.tagView->setModel(filter);
}
Пример #8
0
void ProxyTrackModel::search(const QString& searchText, const QString& extraFilter) {
    Q_UNUSED(extraFilter);
    if (m_bHandleSearches) {
        m_currentSearch = searchText;
        setFilterFixedString(searchText);
    } else if (m_pTrackModel) {
        m_pTrackModel->search(searchText);
    }
}
Пример #9
0
	ServerHistoryWidget::ServerHistoryWidget (QObject *account, QWidget *parent)
	: QWidget { parent }
	, Toolbar_ { new QToolBar { this } }
	, AccObj_ { account }
	, IHSH_ { qobject_cast<IHaveServerHistory*> (account) }
	, ContactsFilter_ { new QSortFilterProxyModel { this } }
	{
		Ui_.setupUi (this);

		if (!IHSH_)
		{
			qWarning () << Q_FUNC_INFO
					<< "account doesn't implement IHaveServerHistory"
					<< account;
			return;
		}

		new Util::ClearLineEditAddon (Core::Instance ().GetProxy (), Ui_.ContactsFilter_);

		ContactsFilter_->setFilterCaseSensitivity (Qt::CaseInsensitive);

		const auto& sortParams = IHSH_->GetSortParams ();
		ContactsFilter_->setSortRole (sortParams.Role_);
		ContactsFilter_->setSortCaseSensitivity (Qt::CaseInsensitive);

		ContactsFilter_->setDynamicSortFilter (true);
		ContactsFilter_->setSourceModel (IHSH_->GetServerContactsModel ());

		Ui_.ContactsView_->setModel (ContactsFilter_);
		Ui_.ContactsView_->sortByColumn (sortParams.Column_, sortParams.Order_);

		connect (AccObj_,
				SIGNAL (serverHistoryFetched (QModelIndex, QByteArray, SrvHistMessages_t)),
				this,
				SLOT (handleFetched (QModelIndex, QByteArray, SrvHistMessages_t)));

		connect (Ui_.ContactsFilter_,
				SIGNAL (textChanged (QString)),
				ContactsFilter_,
				SLOT (setFilterFixedString (QString)));

		auto prevAct = Toolbar_->addAction (tr ("Previous page"),
				this, SLOT (navigatePrevious ()));
		prevAct->setProperty ("ActionIcon", "go-previous");

		auto nextAct = Toolbar_->addAction (tr ("Next page"),
				this, SLOT (navigateNext ()));
		nextAct->setProperty ("ActionIcon", "go-next");
	}
Пример #10
0
	MucJoinWidget::MucJoinWidget (ICoreProxy_ptr proxy)
	: UsersModel_ (new QStandardItemModel (this))
	, UsersFilter_ (new UsersSortFilterProxy (this))
	{
		UsersFilter_->setSourceModel (UsersModel_);

		Ui_.setupUi (this);
		Ui_.UsersTree_->setModel (UsersFilter_);

		new Util::ClearLineEditAddon (proxy, Ui_.UsersFilter_);
		connect (Ui_.UsersFilter_,
				SIGNAL (textChanged (QString)),
				UsersFilter_,
				SLOT (setFilterFixedString (QString)));
	}
Пример #11
0
  void ComponentLibrary::setModel(ComponentModel *model)
  {
    ComponentSortFilterProxyModel *proxy;
    proxy = new ComponentSortFilterProxyModel(this);
    Q_CHECK_PTR(proxy);
    
    proxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
    proxy->setSourceModel(model);
    proxy->setFilterComponentType(Component::AllComponents);

    componentListView->setModel(proxy);

    connect(filterLineEdit, SIGNAL(textChanged(QString)),
            proxy,   SLOT(setFilterFixedString(QString)));
  }
Пример #12
0
 Widget() {
    m_layout.addWidget(&m_view, 0, 0, 1, 1);
    m_layout.addWidget(&m_button, 1, 0, 1, 1);
    connect(&m_button, SIGNAL(clicked()), &m_dialog, SLOT(open()));
    m_model.append({"Volvo", "240", "SQL8941"});
    m_model.append({"Volvo", "850", {}});
    m_model.append({"Volvo", "940", "QRZ1321"});
    m_model.append({"Volvo", "960", "QRZ1628"});
    m_proxy.setSourceModel(&m_model);
    m_proxy.setFilterKeyColumn(2);
    m_view.setModel(&m_proxy);
    m_dialog.setLabelText("Enter registration number fragment to filter on. Leave empty to clear filter.");
    m_dialog.setInputMode(QInputDialog::TextInput);
    connect(&m_dialog, SIGNAL(textValueSelected(QString)),
            &m_proxy, SLOT(setFilterFixedString(QString)));
 }
Пример #13
0
Passwords::Passwords(QWidget *parent)
	: QDialog(parent)
{
    setupUi(this);
    setWindowFlags(Qt::Sheet);

	s_show_passwords = false;

	PasswordsModel *model = new PasswordsModel(this);
    m_proxyModel = new QSortFilterProxyModel(this);
    connect(search, SIGNAL(textChanged(QString)),
            m_proxyModel, SLOT(setFilterFixedString(QString)));
    connect(removeButton, SIGNAL(clicked()), PasswordsTable, SLOT(removeOne()));
    connect(removeAllButton, SIGNAL(clicked()), PasswordsTable, SLOT(removeAll()));
    connect(buttonShowPasswords, SIGNAL(clicked()), this, SLOT(showPasswords()));
    connect(buttonMaster, SIGNAL(clicked()), this, SLOT(masterPassword()));
    m_proxyModel->setSourceModel(model);
    PasswordsTable->verticalHeader()->hide();
    PasswordsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
    PasswordsTable->setModel(m_proxyModel);
    PasswordsTable->setAlternatingRowColors(true);
    PasswordsTable->setTextElideMode(Qt::ElideMiddle);
    PasswordsTable->setShowGrid(false);
    PasswordsTable->setSortingEnabled(true);
    QFont f = font();
    f.setPointSize(10);
    QFontMetrics fm(f);
    int height = fm.height() + fm.height()/3;
    PasswordsTable->verticalHeader()->setDefaultSectionSize(height);
    PasswordsTable->verticalHeader()->setMinimumSectionSize(-1);
    for (int i = 0; i < model->columnCount(); ++i){
        int header = PasswordsTable->horizontalHeader()->sectionSizeHint(i);
        switch (i) {
        case 0:
            header = fm.width(QString(40, 'X'));
            break;
        case 1:
            header = fm.width(QString(12, 'X'));
            break;
        }
        int buffer = fm.width(QLatin1String("xx"));
        header += buffer;
        PasswordsTable->horizontalHeader()->resizeSection(i, header);
    }
    PasswordsTable->horizontalHeader()->setStretchLastSection(true);

}
Пример #14
0
	RadioWidget::RadioWidget (QWidget *parent)
	: QWidget (parent)
	, StationsProxy_ (new StationsFilterModel (this))
	{
		Ui_.setupUi (this);

		StationsProxy_->setDynamicSortFilter (true);
		StationsProxy_->setSourceModel (Core::Instance ().GetRadioManager ()->GetModel ());
		Ui_.StationsView_->setModel (StationsProxy_);

		connect (Ui_.StationsSearch_,
				SIGNAL (textChanged (QString)),
				StationsProxy_,
				SLOT (setFilterFixedString (QString)));

		new Util::ClearLineEditAddon (Core::Instance ().GetProxy (), Ui_.StationsSearch_);
	}
Пример #15
0
databaseWindow::databaseWindow(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::databaseWindow)
{
    ui->setupUi(this);

    model = new cardDatabaseModel;
    proxyModel = new cardDatabaseProxyModel;
    proxyModel->setSourceModel(model);

    ui->databaseTreeView->setModel(proxyModel);

    connect(model,SIGNAL(cardAdded(flashCard*)),this,SLOT(itemJustAdded(flashCard*)));
    connect(ui->searchText,SIGNAL(textChanged(QString)),proxyModel,SLOT(setFilterFixedString(QString)));

    enableAndDisableButtons();
}
Пример #16
0
// ---------- StashDialog
StashDialog::StashDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::StashDialog),
    m_model(new StashModel),
    m_proxyModel(new QSortFilterProxyModel),
    m_deleteAllButton(new QPushButton(tr("Delete All..."))),
    m_deleteSelectionButton(new QPushButton(tr("Delete..."))),
    m_showCurrentButton(new QPushButton(tr("Show"))),
    m_restoreCurrentButton(new QPushButton(tr("Restore..."))),
    //: Restore a git stash to new branch to be created
    m_restoreCurrentInBranchButton(new QPushButton(tr("Restore to Branch..."))),
    m_refreshButton(new QPushButton(tr("Refresh")))
{
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    setAttribute(Qt::WA_DeleteOnClose, true);  // Do not update unnecessarily

    ui->setupUi(this);
    // Buttons
    ui->buttonBox->addButton(m_showCurrentButton, QDialogButtonBox::ActionRole);
    connect(m_showCurrentButton, SIGNAL(clicked()), this, SLOT(showCurrent()));
    ui->buttonBox->addButton(m_refreshButton, QDialogButtonBox::ActionRole);
    connect(m_refreshButton, SIGNAL(clicked()), this, SLOT(forceRefresh()));
    ui->buttonBox->addButton(m_restoreCurrentButton, QDialogButtonBox::ActionRole);
    connect(m_restoreCurrentButton, SIGNAL(clicked()), this, SLOT(restoreCurrent()));
    ui->buttonBox->addButton(m_restoreCurrentInBranchButton, QDialogButtonBox::ActionRole);
    connect(m_restoreCurrentInBranchButton, SIGNAL(clicked()), this, SLOT(restoreCurrentInBranch()));
    ui->buttonBox->addButton(m_deleteSelectionButton, QDialogButtonBox::ActionRole);
    connect(m_deleteSelectionButton, SIGNAL(clicked()), this, SLOT(deleteSelection()));
    ui->buttonBox->addButton(m_deleteAllButton, QDialogButtonBox::ActionRole);
    connect(m_deleteAllButton, SIGNAL(clicked()), this, SLOT(deleteAll()));
    // Models
    m_proxyModel->setSourceModel(m_model);
    m_proxyModel->setFilterKeyColumn(-1);
    m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
    ui->stashView->setModel(m_proxyModel);
    ui->stashView->setSelectionMode(QAbstractItemView::ExtendedSelection);
    ui->stashView->setAllColumnsShowFocus(true);
    ui->stashView->setUniformRowHeights(true);
    connect(ui->filterLineEdit, SIGNAL(filterChanged(QString)), m_proxyModel, SLOT(setFilterFixedString(QString)));
    connect(ui->stashView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
            this, SLOT(enableButtons()));
    connect(ui->stashView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
            this, SLOT(enableButtons()));
    connect(ui->stashView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(showCurrent()));
    ui->stashView->setFocus();
}
Пример #17
0
SettingsDialog::SettingsDialog(QWidget *parent) :
    QDialog(parent),
    m_pages(sortedOptionsPages()),
    m_proxyModel(new CategoryFilterModel(this)),
    m_model(new CategoryModel(this)),
    m_stackedLayout(new QStackedLayout),
    m_filterLineEdit(new Utils::FilterLineEdit),
    m_categoryList(new CategoryListView),
    m_headerLabel(new QLabel),
    m_running(false),
    m_applied(false),
    m_finished(false)
{
    m_applied = false;

    createGui();
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
#ifdef Q_OS_MAC
    setWindowTitle(tr("Preferences"));
#else
    setWindowTitle(tr("Options"));
#endif

    m_model->setPages(m_pages,
        ExtensionSystem::PluginManager::instance()->getObjects<IOptionsPageProvider>());

    m_proxyModel->setSourceModel(m_model);
    m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
    m_categoryList->setIconSize(QSize(categoryIconSize, categoryIconSize));
    m_categoryList->setModel(m_proxyModel);
    m_categoryList->setSelectionMode(QAbstractItemView::SingleSelection);
    m_categoryList->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);

    connect(m_categoryList->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
            this, SLOT(currentChanged(QModelIndex)));

    // The order of the slot connection matters here, the filter slot
    // opens the matching page after the model has filtered.
    connect(m_filterLineEdit, SIGNAL(filterChanged(QString)),
            this, SLOT(ensureAllCategoryWidgets()));
    connect(m_filterLineEdit, SIGNAL(filterChanged(QString)),
                m_proxyModel, SLOT(setFilterFixedString(QString)));
    connect(m_filterLineEdit, SIGNAL(filterChanged(QString)), this, SLOT(filter(QString)));
    m_categoryList->setFocus();
}
Пример #18
0
int main(int argc, char** argv)
{
    QApplication app(argc, argv);

    QCommandLineParser parser;
    parser.addPositionalArgument(QStringLiteral("filename"), QStringLiteral("file to visualize"));
    parser.addHelpOption();
    parser.process(app);

    QStringList args = parser.positionalArguments();
    if (args.size() != 1) {
        parser.showHelp(1);
    }

    QWidget* mainWidget = new QWidget();
    QVBoxLayout* layout = new QVBoxLayout(mainWidget);
    mainWidget->setLayout(layout);

    QLineEdit* edit = new QLineEdit();
    layout->addWidget(edit);

    QString fileName = args.first();
    QTreeView* view = new QTreeView(0);

    FunctionsModel* model = new FunctionsModel(view);
    model->setFilePath(QFileInfo(fileName).absoluteFilePath());

    QSortFilterProxyModel* sortModel = new QSortFilterProxyModel(view);
    sortModel->setSourceModel(model);
    sortModel->setFilterKeyColumn(2);
    sortModel->setFilterCaseSensitivity(Qt::CaseInsensitive);

    view->setModel(sortModel);
    view->setSortingEnabled(true);

    layout->addWidget(view);

    QObject::connect(edit, SIGNAL(textChanged(QString)),
                     sortModel, SLOT(setFilterFixedString(QString)));

    mainWidget->show();

    return app.exec();
}
Пример #19
0
AutoFillDialog::AutoFillDialog(QWidget *parent, Qt::WindowFlags flags)
    : QDialog(parent, flags)
{
    setupUi(this);
    setWindowFlags(Qt::Sheet);
    connect(removeButton, SIGNAL(clicked()), tableView, SLOT(removeSelected()));
    connect(removeAllButton, SIGNAL(clicked()), tableView, SLOT(removeAll()));
    tableView->verticalHeader()->hide();
    tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
    tableView->setAlternatingRowColors(true);
    tableView->setTextElideMode(Qt::ElideMiddle);
    tableView->setShowGrid(false);
    tableView->setSortingEnabled(true);

    AutoFillModel *model = new AutoFillModel();
    QSortFilterProxyModel *m_proxyModel = new QSortFilterProxyModel(this);
    connect(search, SIGNAL(textChanged(QString)),
            m_proxyModel, SLOT(setFilterFixedString(QString)));
    m_proxyModel->setSourceModel(model);
    tableView->setModel(m_proxyModel);

    QFont f = font();
    f.setPointSize(10);
    QFontMetrics fm(f);
    int height = fm.height() + fm.height() / 3;
    tableView->verticalHeader()->setDefaultSectionSize(height);
    tableView->verticalHeader()->setMinimumSectionSize(-1);
    for (int i = 0; i < model->columnCount(); ++i) {
        int header = tableView->horizontalHeader()->sectionSizeHint(i);
        switch (i) {
        case 0:
            header = fm.width(QLatin1String("averagehost.domain.com"));
            break;
        case 1:
            header = fm.width(QLatin1String("_session_id"));
            break;
        }
        int buffer = fm.width(QLatin1String("xx"));
        header += buffer;
        tableView->horizontalHeader()->resizeSection(i, header);
    }
    tableView->horizontalHeader()->setStretchLastSection(true);
}
Пример #20
0
ChannelListDlg::ChannelListDlg(QWidget *parent)
    : QDialog(parent),
    _listFinished(true),
    _ircListModel(this),
    _sortFilter(this),
    _simpleModeSpacer(0),
    _advancedMode(false)
{
    _sortFilter.setSourceModel(&_ircListModel);
    _sortFilter.setFilterCaseSensitivity(Qt::CaseInsensitive);
    _sortFilter.setFilterKeyColumn(-1);

    ui.setupUi(this);
    ui.advancedModeLabel->setPixmap(QIcon::fromTheme("edit-rename").pixmap(22));

    ui.channelListView->setSelectionBehavior(QAbstractItemView::SelectRows);
    ui.channelListView->setSelectionMode(QAbstractItemView::SingleSelection);
    ui.channelListView->setAlternatingRowColors(true);
    ui.channelListView->setTabKeyNavigation(false);
    ui.channelListView->setModel(&_sortFilter);
    ui.channelListView->setSortingEnabled(true);
    ui.channelListView->verticalHeader()->hide();
    ui.channelListView->horizontalHeader()->setStretchLastSection(true);

    ui.searchChannelsButton->setAutoDefault(false);

    setWindowIcon(QIcon::fromTheme("format-list-unordered"));

    connect(ui.advancedModeLabel, SIGNAL(clicked()), this, SLOT(toggleMode()));
    connect(ui.searchChannelsButton, SIGNAL(clicked()), this, SLOT(requestSearch()));
    connect(ui.channelNameLineEdit, SIGNAL(returnPressed()), this, SLOT(requestSearch()));
    connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), &_sortFilter, SLOT(setFilterFixedString(QString)));
    connect(Client::ircListHelper(), SIGNAL(channelListReceived(const NetworkId &, const QStringList &, QList<IrcListHelper::ChannelDescription> )),
        this, SLOT(receiveChannelList(NetworkId, QStringList, QList<IrcListHelper::ChannelDescription> )));
    connect(Client::ircListHelper(), SIGNAL(finishedListReported(const NetworkId &)), this, SLOT(reportFinishedList()));
    connect(Client::ircListHelper(), SIGNAL(errorReported(const QString &)), this, SLOT(showError(const QString &)));
    connect(ui.channelListView, SIGNAL(activated(QModelIndex)), this, SLOT(joinChannel(QModelIndex)));

    setAdvancedMode(false);
    enableQuery(true);
    showFilterLine(false);
    showErrors(false);
}
Пример #21
0
void DialogObjects::initConnections()
{

    proxyModel = new QSortFilterProxyModel(this);
    proxyModel->setSourceModel(objectModel);
    proxyModel->setFilterKeyColumn(0);
    ui->objectListView->setModel(proxyModel);
    connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), proxyModel, SLOT(setFilterFixedString(QString)));

    ui->objectTableView->setModel(objectDetailsModel);

    connect(ui->objectListView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
            this, SLOT(selected(QModelIndex)));
    connect(objectModel, SIGNAL(objectSelected(qmf::Data)),
            objectDetailsModel, SLOT(showObjectDetail(qmf::Data)));

    connect(objectDetailsModel, SIGNAL(detailReady()), this, SLOT(resizeDetail()));

}
Пример #22
0
	UsersListWidget::UsersListWidget (const QList<QObject*>& parts,
			std::function<QString (ICLEntry*)> nameGetter, QWidget *parent)
	: QDialog (parent,
			static_cast<Qt::WindowFlags> (Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint))
	, Filter_ (new QSortFilterProxyModel (this))
	, PartsModel_ (new QStandardItemModel (this))
	{
		Ui_.setupUi (this);

		for (auto part : parts)
		{
			auto entry = qobject_cast<ICLEntry*> (part);

			auto item = new QStandardItem (nameGetter (entry));
			item->setData (QVariant::fromValue (part), PLRObject);
			item->setEditable (false);

			PartsModel_->appendRow (item);
		}

		Filter_->setSourceModel (PartsModel_);
		Filter_->setSortCaseSensitivity (Qt::CaseInsensitive);
		Filter_->setFilterCaseSensitivity (Qt::CaseInsensitive);
		Filter_->setSortRole (Qt::DisplayRole);
		connect (Ui_.FilterLine_,
				SIGNAL (textChanged (QString)),
				Filter_,
				SLOT (setFilterFixedString (QString)));
		Ui_.ListView_->setModel (Filter_);
		Ui_.ListView_->sortByColumn (0, Qt::AscendingOrder);

		new Util::ClearLineEditAddon (Core::Instance ().GetProxy (), Ui_.FilterLine_);

		connect (Ui_.ListView_,
				SIGNAL (activated (QModelIndex)),
				this,
				SLOT (accept ()));
		Ui_.ListView_->setCurrentIndex (Filter_->index (0, 0));

		Ui_.ListView_->setFocusProxy (Ui_.FilterLine_);
		Ui_.ListView_->setFocus ();
		Ui_.FilterLine_->installEventFilter (new KeyboardRosterFixer (Ui_.ListView_, this));
	}
Пример #23
0
LogBrowser::LogBrowser(QWidget *parent)
  : QWidget(parent)
  , m_nextID(0)
  , m_actorFilterActive(false)
  , m_actorFilterCheck(0)
{
    m_log = new LogModel(this);
    m_log->setResultType(Log::MostRecentSubjects);

    QSortFilterProxyModel *filter = new QSortFilterProxyModel(this);
    filter->setSourceModel(m_log);
    filter->setSortCaseSensitivity(Qt::CaseInsensitive);
    filter->setDynamicSortFilter(true);
    filter->setFilterKeyColumn(0);

    QLineEdit *searchBox = new QLineEdit(this);
    searchBox->setPlaceholderText(tr("Search"));
    connect(searchBox, SIGNAL(textEdited(QString)), filter, SLOT(setFilterFixedString(QString)));


    QListView *view = new QListView(this);
    view->setResizeMode(QListView::Adjust);
    connect(view, SIGNAL(activated(QModelIndex)), this, SLOT(handleActivation(QModelIndex)));

    m_logView = view;
    m_logView->setModel(filter);


    QVBoxLayout *layout = new QVBoxLayout(this);
    m_filterLayout = new QHBoxLayout(this);
    layout->addWidget(searchBox);
    layout->addLayout(m_filterLayout);
    layout->addWidget(m_logView);

    m_actionMapper = new QSignalMapper(this);
    connect(m_actionMapper, SIGNAL(mapped(int)), this, SLOT(applyFilter(int)));

    DataModel::Event emptyEvent;
    addEventFilter(DataModel::EventList() << emptyEvent, "All")->setChecked(true);
}
Пример #24
0
BookmarksDialog::BookmarksDialog(QWidget *parent, BookmarksManager *manager)
    : QDialog(parent)
    , m_bookmarksManager(0)
    , m_bookmarksModel(0)
    , m_proxyModel(0)
{
    m_bookmarksManager = manager;
    if (!m_bookmarksManager)
        m_bookmarksManager = BrowserApplication::bookmarksManager();
    setupUi(this);

    tree->setUniformRowHeights(true);
    tree->setSelectionBehavior(QAbstractItemView::SelectRows);
    tree->setSelectionMode(QAbstractItemView::ExtendedSelection);
    tree->setTextElideMode(Qt::ElideMiddle);
    m_bookmarksModel = m_bookmarksManager->bookmarksModel();
    m_proxyModel = new TreeProxyModel(this);
    m_proxyModel->setFilterKeyColumn(-1);
    connect(search, SIGNAL(textChanged(QString)),
            m_proxyModel, SLOT(setFilterFixedString(QString)));
    connect(removeButton, SIGNAL(clicked()), tree, SLOT(removeSelected()));
    m_proxyModel->setSourceModel(m_bookmarksModel);
    tree->setModel(m_proxyModel);
    tree->setDragDropMode(QAbstractItemView::InternalMove);
    tree->setExpanded(m_proxyModel->index(0, 0), true);
    tree->setAlternatingRowColors(true);
    QFontMetrics fm(font());
    int header = fm.width(QLatin1Char('m')) * 40;
    tree->header()->resizeSection(0, header);
    tree->header()->setStretchLastSection(true);
    connect(tree, SIGNAL(activated(const QModelIndex&)),
            this, SLOT(openBookmark()));
    tree->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(tree, SIGNAL(customContextMenuRequested(const QPoint &)),
            this, SLOT(customContextMenuRequested(const QPoint &)));
    connect(addFolderButton, SIGNAL(clicked()),
            this, SLOT(newFolder()));
    expandNodes(m_bookmarksManager->bookmarks());
    setAttribute(Qt::WA_DeleteOnClose);
}
Пример #25
0
NetworkMonitor::NetworkMonitor(QWidget *parent, Qt::WindowFlags flags)
    : QDialog(parent, flags)
{
    setupUi(this);
    requestList->setSelectionBehavior(QAbstractItemView::SelectRows);
    m_requestHeaders = new QStandardItemModel(this);
    m_requestHeaders->setHorizontalHeaderLabels(QStringList() << tr("Name") << tr("Value"));
    requestDetailsView->setModel(m_requestHeaders);
    m_replyHeaders = new QStandardItemModel(this);
    m_replyHeaders->setHorizontalHeaderLabels(QStringList() << tr("Name") << tr("Value"));
    responseDetailsView->setModel(m_replyHeaders);
    requestDetailsView->horizontalHeader()->setStretchLastSection(true);
    responseDetailsView->horizontalHeader()->setStretchLastSection(true);

    requestList->horizontalHeader()->setStretchLastSection(true);
    m_proxyModel = new QSortFilterProxyModel(this);
    m_proxyModel->setFilterKeyColumn(-1);
    requestList->setShowGrid(false);
    requestList->setAlternatingRowColors(true);
    requestList->verticalHeader()->setMinimumSectionSize(-1);
    connect(search, SIGNAL(textChanged(QString)),
            m_proxyModel, SLOT(setFilterFixedString(QString)));
    connect(removeButton, SIGNAL(clicked()), requestList, SLOT(removeSelected()));
    connect(removeAllButton, SIGNAL(clicked()), requestList, SLOT(removeAll()));
    m_model = new RequestModel(this);
    m_proxyModel->setSourceModel(m_model);
    requestList->setModel(m_proxyModel);
    connect(requestList->selectionModel(),
            SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
            this,
            SLOT(currentChanged(const QModelIndex &, const QModelIndex &)));

    QFontMetrics fm = fontMetrics();
    int m = fm.width(QLatin1Char('m'));
    requestList->horizontalHeader()->resizeSection(0, m * 5);
    requestList->horizontalHeader()->resizeSection(1, m * 20);
    requestList->horizontalHeader()->resizeSection(3, m * 5);
    requestList->horizontalHeader()->resizeSection(4, m * 15);
}
Пример #26
0
FindBarWidget::FindBarWidget(TreeSortFilterProxyModel * model,QWidget *parent)
    : QFrame(parent)
{
    mEdit = new QLineEdit;
    mColBox = new QComboBox();
    QHBoxLayout * layout = new QHBoxLayout;
    layout->addWidget(mEdit);
    layout->addWidget(mColBox);
    setLayout(layout);

    mModel = model;

    for (int i=0; i< mModel->columnCount(); ++i)
        mColBox->addItem(mModel->headerData(i,Qt::Horizontal).toString());



    connect(mEdit,SIGNAL(textChanged(QString)),this,SIGNAL(textChanged(QString)));
    connect(mEdit,SIGNAL(textChanged(QString)),mModel,SLOT(setFilterFixedString(QString)));
    connect(mColBox,SIGNAL(currentIndexChanged(int)),this,SLOT(setFilterColumn(int)));


}
Пример #27
0
MainWindow::MainWindow(QWidget* parent)
  : CGAL::Qt::DemosMainWindow(parent)
{
  ui = new Ui::MainWindow;
  ui->setupUi(this);

  // remove the Load Script menu entry, when the demo has not been compiled with QT_SCRIPT_LIB
#if !defined(QT_SCRIPT_LIB)
  ui->menuBar->removeAction(ui->actionLoad_Script);
#endif
  
  // Save some pointers from ui, for latter use.
  sceneView = ui->sceneView;
  viewer = ui->viewer;

  // do not save the state of the viewer (anoying)
  viewer->setStateFileName(QString::null);

  // setup scene
  scene = new Scene(this);
  viewer->setScene(scene);

  {
    QShortcut* shortcut = new QShortcut(QKeySequence(Qt::ALT+Qt::Key_Q), this);
    connect(shortcut, SIGNAL(activated()),
            this, SLOT(setFocusToQuickSearch()));
  }

  proxyModel = new QSortFilterProxyModel(this);
  proxyModel->setSourceModel(scene);

  connect(ui->searchEdit, SIGNAL(textChanged(QString)),
          proxyModel, SLOT(setFilterFixedString(QString)));
  sceneView->setModel(proxyModel);

  // setup the sceneview: delegation and columns sizing...
  sceneView->setItemDelegate(new SceneDelegate(this));

  sceneView->header()->setStretchLastSection(false);
  sceneView->header()->setSectionResizeMode(Scene::NameColumn, QHeaderView::Stretch);
  sceneView->header()->setSectionResizeMode(Scene::NameColumn, QHeaderView::Stretch);
  sceneView->header()->setSectionResizeMode(Scene::ColorColumn, QHeaderView::ResizeToContents);
  sceneView->header()->setSectionResizeMode(Scene::RenderingModeColumn, QHeaderView::Fixed);
  sceneView->header()->setSectionResizeMode(Scene::ABColumn, QHeaderView::Fixed);
  sceneView->header()->setSectionResizeMode(Scene::VisibleColumn, QHeaderView::Fixed);
  sceneView->resizeColumnToContents(Scene::ColorColumn);
  sceneView->resizeColumnToContents(Scene::RenderingModeColumn);
  sceneView->resizeColumnToContents(Scene::ABColumn);
  sceneView->resizeColumnToContents(Scene::VisibleColumn);

  // setup connections
  connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
          this, SLOT(updateInfo()));
  
  connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
          this, SLOT(updateDisplayInfo()));

  connect(scene, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex & )),
          viewer, SLOT(updateGL()));

  connect(scene, SIGNAL(updated()),
          viewer, SLOT(updateGL()));

  connect(scene, SIGNAL(updated()),
          this, SLOT(selectionChanged()));

  connect(scene, SIGNAL(itemAboutToBeDestroyed(Scene_item*)),
          this, SLOT(removeManipulatedFrame(Scene_item*)));

  connect(scene, SIGNAL(updated_bbox()),
          this, SLOT(updateViewerBBox()));

  connect(scene, SIGNAL(selectionChanged(int)),
          this, SLOT(selectSceneItem(int)));

  connect(sceneView->selectionModel(), 
          SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
          this, SLOT(updateInfo()));

  connect(sceneView->selectionModel(), 
          SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
          this, SLOT(updateDisplayInfo()));

  connect(sceneView->selectionModel(), 
          SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
          this, SLOT(selectionChanged()));

  sceneView->setContextMenuPolicy(Qt::CustomContextMenu);
  connect(sceneView, SIGNAL(customContextMenuRequested(const QPoint & )),
          this, SLOT(showSceneContextMenu(const QPoint &)));

  connect(viewer, SIGNAL(selected(int)),
          this, SLOT(selectSceneItem(int)));
  connect(viewer, SIGNAL(selectedPoint(double, double, double)),
          this, SLOT(showSelectedPoint(double, double, double)));

  connect(viewer, SIGNAL(selectionRay(double, double, double, 
                                      double, double, double)),
          scene, SIGNAL(selectionRay(double, double, double,
                                     double, double, double)));

  connect(viewer, SIGNAL(requestContextMenu(QPoint)),
          this, SLOT(contextMenuRequested(QPoint)));

  // The contextMenuPolicy of infoLabel is now the default one, so that one
  // can easily copy-paste its text.
  // connect(ui->infoLabel, SIGNAL(customContextMenuRequested(const QPoint & )),
  //         this, SLOT(showSceneContextMenu(const QPoint &)));

  connect(ui->actionRecenterScene, SIGNAL(triggered()),
          viewer, SLOT(update()));

  connect(ui->actionAntiAliasing, SIGNAL(toggled(bool)),
          viewer, SLOT(setAntiAliasing(bool)));

  connect(ui->actionDraw_two_sides, SIGNAL(toggled(bool)),
          viewer, SLOT(setTwoSides(bool)));

  // add the "About CGAL..." and "About demo..." entries
  this->addAboutCGAL();
  this->addAboutDemo(":/cgal/Polyhedron_3/about.html");

  // Connect the button "addButton" with actionLoad
  ui->addButton->setDefaultAction(ui->actionLoad);
  // Same with "removeButton" and "duplicateButton"
  ui->removeButton->setDefaultAction(ui->actionErase);
  ui->duplicateButton->setDefaultAction(ui->actionDuplicate);

  // Connect actionQuit (Ctrl+Q) and qApp->quit()
  connect(ui->actionQuit, SIGNAL(triggered()),
          this, SLOT(quit()));

  // Connect "Select all items"
  connect(ui->actionSelect_all_items, SIGNAL(triggered()),
          this, SLOT(selectAll()));

  // Recent files menu
  this->addRecentFiles(ui->menuFile, ui->actionQuit);
  connect(this, SIGNAL(openRecentFile(QString)),
	  this, SLOT(open(QString)));

  // Reset the "Operation menu"
  clearMenu(ui->menuOperations);

#ifdef QT_SCRIPT_LIB
  std::cerr << "Enable scripts.\n";
  script_engine = new QScriptEngine(this);
  qScriptRegisterMetaType<Scene_item*>(script_engine,
                                       myScene_itemToScriptValue,
                                       myScene_itemFromScriptValue);
#  ifdef QT_SCRIPTTOOLS_LIB
  QScriptEngineDebugger* debugger = new QScriptEngineDebugger(this);
  debugger->setObjectName("qt script debugger");
  QAction* debuggerMenuAction = 
    menuBar()->addMenu(debugger->createStandardMenu());
  debuggerMenuAction->setText(tr("Qt Script &debug"));
  for(unsigned int i = 0; i < 9; ++i)
  {
    QDockWidget* dock = new QDockWidget(debug_widgets_names[i], this);
    dock->setObjectName(debug_widgets_names[i]);
    dock->setWidget(debugger->widget(debug_widgets[i]));
    this->addDockWidget(Qt::BottomDockWidgetArea, dock);
    dock->hide();
  }
  debugger->setAutoShowStandardWindow(false);
  debugger->attachTo(script_engine);
#  endif // QT_SCRIPTTOOLS_LIB
  QScriptValue fun = script_engine->newFunction(myPrintFunction);
  script_engine->globalObject().setProperty("print", fun);
  
  //  evaluate_script("print('hello', 'world', 'from QtScript!')");
  QScriptValue mainWindowObjectValue = script_engine->newQObject(this);
  script_engine->globalObject().setProperty("main_window", mainWindowObjectValue);

  QScriptValue sceneObjectValue = script_engine->newQObject(scene);
  mainWindowObjectValue.setProperty("scene", sceneObjectValue);
  script_engine->globalObject().setProperty("scene", sceneObjectValue);

  QScriptValue viewerObjectValue = script_engine->newQObject(viewer);
  mainWindowObjectValue.setProperty("viewer", viewerObjectValue);
  script_engine->globalObject().setProperty("viewer", viewerObjectValue);

  QScriptValue cameraObjectValue = script_engine->newQObject(viewer->camera());
  viewerObjectValue.setProperty("camera", cameraObjectValue);
  script_engine->globalObject().setProperty("camera", cameraObjectValue);

  evaluate_script("var plugins = new Array();");
#  ifdef QT_SCRIPTTOOLS_LIB
  QScriptValue debuggerObjectValue = script_engine->newQObject(debugger);
  script_engine->globalObject().setProperty("debugger", debuggerObjectValue);
#  endif
#endif

  readSettings(); // Among other things, the column widths are stored.

  // Load plugins, and re-enable actions that need it.
  loadPlugins();

  // Setup the submenu of the View menu that can toggle the dockwidgets
  Q_FOREACH(QDockWidget* widget, findChildren<QDockWidget*>()) {
    ui->menuDockWindows->addAction(widget->toggleViewAction());
  }
Пример #28
0
void FileSystemWidget::initSearch()
{
    connect(ui->filterEdit, SIGNAL(textChanged(QString)),   m_sortModel,    SLOT(setFilterFixedString(QString)));
    connect(m_model,        SIGNAL(pathChanged()),          ui->filterEdit, SLOT(clear()));
    connect(ui->clearButton,SIGNAL(clicked()),              ui->filterEdit, SLOT(clear()));
}
QDBusViewer::QDBusViewer(const QDBusConnection &connection, QWidget *parent)  :
    QWidget(parent),
    c(connection),
    objectPathRegExp(QLatin1String("\\[ObjectPath: (.*)\\]"))
{
    servicesModel = new QStringListModel(this);
    servicesFilterModel = new QSortFilterProxyModel(this);
    servicesFilterModel->setSourceModel(servicesModel);
    servicesFilterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
    serviceFilterLine = new QLineEdit(this);
    serviceFilterLine->setPlaceholderText(tr("Search..."));
    servicesView = new QListView(this);
    servicesView->setModel(servicesFilterModel);

    connect(serviceFilterLine, SIGNAL(textChanged(QString)), servicesFilterModel, SLOT(setFilterFixedString(QString)));

    tree = new QTreeView;
    tree->setContextMenuPolicy(Qt::CustomContextMenu);

    connect(tree, SIGNAL(activated(QModelIndex)), this, SLOT(activate(QModelIndex)));

    refreshAction = new QAction(tr("&Refresh"), tree);
    refreshAction->setData(42); // increase the amount of 42 used as magic number by one
    refreshAction->setShortcut(QKeySequence::Refresh);
    connect(refreshAction, SIGNAL(triggered()), this, SLOT(refreshChildren()));

    QShortcut *refreshShortcut = new QShortcut(QKeySequence::Refresh, tree);
    connect(refreshShortcut, SIGNAL(activated()), this, SLOT(refreshChildren()));

    QVBoxLayout *layout = new QVBoxLayout(this);
    QSplitter *topSplitter = new QSplitter(Qt::Vertical, this);
    layout->addWidget(topSplitter);

    log = new QTextBrowser;
    connect(log, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));

    QSplitter *splitter = new QSplitter(topSplitter);
    splitter->addWidget(servicesView);

    QWidget *servicesWidget = new QWidget;
    QVBoxLayout *servicesLayout = new QVBoxLayout(servicesWidget);
    servicesLayout->addWidget(serviceFilterLine);
    servicesLayout->addWidget(servicesView);
    splitter->addWidget(servicesWidget);
    splitter->addWidget(tree);

    topSplitter->addWidget(splitter);
    topSplitter->addWidget(log);

    connect(servicesView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
            this, SLOT(serviceChanged(QModelIndex)));
    connect(tree, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(showContextMenu(QPoint)));

    QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection);

    if (c.isConnected()) {
        logMessage(QLatin1String("Connected to D-Bus."));
        QDBusConnectionInterface *iface = c.interface();
        connect(iface, SIGNAL(serviceRegistered(QString)),
                this, SLOT(serviceRegistered(QString)));
        connect(iface, SIGNAL(serviceUnregistered(QString)),
                this, SLOT(serviceUnregistered(QString)));
        connect(iface, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
                this, SLOT(serviceOwnerChanged(QString,QString,QString)));
    } else {
        logError(QLatin1String("Cannot connect to D-Bus: ") + c.lastError().message());
    }

    objectPathRegExp.setMinimal(true);

}
Пример #30
0
	TodoTab::TodoTab (const TabClassInfo& tc, QObject *parent)
	: TC_ (tc)
	, Plugin_ (parent)
	, ProxyModel_ (new TodoSFProxyModel (this))
	, ProgressMenu_ (new QMenu (tr ("Set progress")))
	, DueDateMenu_ (new QMenu (tr ("Set due date")))
	, Bar_ (new QToolBar (tc.VisibleName_))
	{
		Ui_.setupUi (this);

		new Util::TagsCompleter (Ui_.FilterLine_);
		Ui_.FilterLine_->AddSelector ();

		Ui_.TodoTree_->setItemDelegate (new TodoListDelegate (Ui_.TodoTree_));

		ProxyModel_->setDynamicSortFilter (true);
		ProxyModel_->setSourceModel (Core::Instance ().GetTodoManager ()->GetTodoModel ());
		ProxyModel_->setFilterKeyColumn (0);
		ProxyModel_->setFilterCaseSensitivity (Qt::CaseInsensitive);
		connect (Ui_.FilterLine_,
				SIGNAL (textChanged (QString)),
				ProxyModel_,
				SLOT (setFilterFixedString (QString)));
		connect (Ui_.FilterLine_,
				SIGNAL (textChanged (QString)),
				ProxyModel_,
				SLOT (disableTagsMode ()));
		connect (Ui_.FilterLine_,
				SIGNAL (tagsChosen ()),
				ProxyModel_,
				SLOT (enableTagsMode ()));
		Ui_.TodoTree_->setModel (ProxyModel_);

		QAction *addTodo = new QAction (tr ("Add task..."), this);
		addTodo->setProperty ("ActionIcon", "list-add");
		addTodo->setShortcut (Qt::Key_Insert);
		connect (addTodo,
				SIGNAL (triggered ()),
				this,
				SLOT (handleAddTodoRequested ()));
		Bar_->addAction (addTodo);
		Ui_.TodoTree_->addAction (addTodo);

		QAction *addChildTodo = new QAction (tr ("Add child task..."), this);
		connect (addChildTodo,
				SIGNAL (triggered ()),
				this,
				SLOT (handleAddChildTodoRequested ()));
		Ui_.TodoTree_->addAction (addChildTodo);

		QAction *removeTodo = new QAction (tr ("Remove task"), this);
		removeTodo->setProperty ("ActionIcon", "list-remove");
		removeTodo->setShortcut (Qt::Key_Delete);
		connect (removeTodo,
				SIGNAL (triggered ()),
				this,
				SLOT (handleRemoveTodoRequested ()));
		Bar_->addAction (removeTodo);
		Ui_.TodoTree_->addAction (removeTodo);

		QAction *cloneTodo = new QAction (tr ("Clone task"), this);
		cloneTodo->setProperty ("ActionIcon", "edit-copy");
		connect (cloneTodo,
				SIGNAL (triggered ()),
				this,
				SLOT (handleCloneTodoRequested ()));
		Ui_.TodoTree_->addAction (cloneTodo);

		Ui_.TodoTree_->addAction (Util::CreateSeparator (Ui_.TodoTree_));

		for (int i = 0; i <= 100; i += 10)
		{
			QAction *action = ProgressMenu_->addAction (QString::number (i) + "%");
			action->setProperty ("Otlozhu/Progress", i);
			connect (action,
					SIGNAL (triggered ()),
					this,
					SLOT (handleQuickProgress ()));

			const QString& sc = i == 100 ?
					QString ("Ctrl+S,D") :
					QString ("Ctrl+S,%1").arg (i / 10);
			action->setShortcut (sc);
		}
		Ui_.TodoTree_->addAction (ProgressMenu_->menuAction ());

		QAction *editComment = new QAction (tr ("Edit comment..."), this);
		editComment->setProperty ("ActionIcon", "document-edit");
		connect (editComment,
				SIGNAL (triggered ()),
				this,
				SLOT (handleEditCommentRequested ()));
		Ui_.TodoTree_->addAction (editComment);

		DueDateMenu_->setProperty ("ActionIcon", "view-calendar");
		const QList<int> delays = { 0, 1, 3, 6, 12, 24, 48, 168 };
		const QStringList labels = { tr ("Clear"), tr ("Hour"), tr ("3 hours"), tr ("6 hours"),
				tr ("12 hours"), tr ("Day"), tr ("2 days"), tr ("Week") };
		for (int i = 0; i < delays.size (); ++i)
		{
			QAction *delay = new QAction (labels.at (i), this);
			connect (delay,
					SIGNAL (triggered ()),
					this,
					SLOT (handleSetDueDateRequested ()));
			delay->setProperty ("Otlozhu/Delay", delays.at (i));
			DueDateMenu_->addAction (delay);

			if (!delays.at (i))
				DueDateMenu_->addSeparator ();
		}

		QAction *customDueDate = new QAction (tr ("Custom..."), this);
		customDueDate->setProperty ("ActionIcon", "view-calendar");
		connect (customDueDate,
				SIGNAL (triggered ()),
				this,
				SLOT (handleSetCustomDueDateRequested ()));
		DueDateMenu_->addSeparator ();
		DueDateMenu_->addAction (customDueDate);
		Ui_.TodoTree_->addAction (DueDateMenu_->menuAction ());

		Bar_->addSeparator ();

		QAction *importTodos = new QAction (tr ("Import"), this);
		importTodos->setProperty ("ActionIcon", "document-import");
		connect (importTodos,
				SIGNAL (triggered ()),
				this,
				SLOT (handleImport ()));
		Bar_->addAction (importTodos);

		QAction *exportTodos = new QAction (tr ("Export"), this);
		exportTodos->setProperty ("ActionIcon", "document-export");
		connect (exportTodos,
				SIGNAL (triggered ()),
				this,
				SLOT (handleExport ()));
		Bar_->addAction (exportTodos);
	}