<commit_before>/*
 * This file is part of the proxy model test suite.
 *
 * Copyright 2009  <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301  USA
 */

#include "descendantpmwidget.h"

#include <QTreeView>
#include <QSplitter>

#include "dynamictreemodel.h"
#include "descendantentitiesproxymodel.h"
#include <QHBoxLayout>
#include "selectionproxymodel.h"
#include <QLineEdit>

using namespace Akonadi;

DescendantProxyModelWidget::DescendantProxyModelWidget(QWidget* parent): QWidget(parent)
{
  QHBoxLayout *layout = new QHBoxLayout(this);
  QSplitter *vSplitter = new QSplitter( this );
  layout->addWidget(vSplitter);


  m_rootModel = new DynamicTreeModel(this);

  m_descProxyModel = new DescendantEntitiesProxyModel(this);
  m_descProxyModel->setSourceModel(m_rootModel);

  DescendantEntitiesProxyModel *descProxyModel2 = new DescendantEntitiesProxyModel(this);
  descProxyModel2->setSourceModel(m_rootModel);
  descProxyModel2->setDisplayAncestorData(true);

  m_itemSelectionModel = new QItemSelectionModel(m_descProxyModel, this);

  m_selectionProxyModel = new SelectionProxyModel(m_itemSelectionModel, this);
  m_selectionProxyModel->setSourceModel(m_descProxyModel);

  QList<int> ancestorRows;

  ModelInsertCommand *ins;
  int max_runs = 4;
  for (int i = 0; i < max_runs; i++)
  {
    ins = new ModelInsertCommand(m_rootModel, this);
    ins->setAncestorRowNumbers(ancestorRows);
    ins->setStartRow(0);
    ins->setEndRow(4);
    ins->doCommand();
    ancestorRows << 2;
  }

  ancestorRows.clear();
  ancestorRows << 3;
  for (int i = 0; i < max_runs - 1; i++)
  {
    ins = new ModelInsertCommand(m_rootModel, this);
    ins->setAncestorRowNumbers(ancestorRows);
    ins->setStartRow(0);
    ins->setEndRow(4);
    ins->doCommand();
    ancestorRows << 3;
  }

  ModelDataChangeCommand *dataChCmd = new ModelDataChangeCommand(m_rootModel, this);
  dataChCmd->setStartRow(0);
  dataChCmd->setEndRow(4);
  dataChCmd->doCommand();

  QTreeView *treeview = new QTreeView( vSplitter );
  treeview->setModel(m_rootModel);
  treeview->setSelectionMode(QAbstractItemView::ExtendedSelection);

  m_descView = new QTreeView( vSplitter );
  m_descView->setModel(m_descProxyModel);

  QTreeView *descView2 = new QTreeView( vSplitter );
  descView2->setModel(descProxyModel2);
<commit_msg>Change the commands to run on the model on start.<commit_after>/*
 * This file is part of the proxy model test suite.
 *
 * Copyright 2009  <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301  USA
 */

#include "descendantpmwidget.h"

#include <QTreeView>
#include <QSplitter>

#include "dynamictreemodel.h"
#include "descendantentitiesproxymodel.h"
#include <QHBoxLayout>
#include "selectionproxymodel.h"
#include <QLineEdit>

using namespace Akonadi;

DescendantProxyModelWidget::DescendantProxyModelWidget(QWidget* parent): QWidget(parent)
{
  QHBoxLayout *layout = new QHBoxLayout(this);
  QSplitter *vSplitter = new QSplitter( this );
  layout->addWidget(vSplitter);


  m_rootModel = new DynamicTreeModel(this);

  const int numCols = 2;

  m_descProxyModel = new DescendantEntitiesProxyModel(this);
  m_descProxyModel->setSourceModel(m_rootModel);

  DescendantEntitiesProxyModel *descProxyModel2 = new DescendantEntitiesProxyModel(this);
  descProxyModel2->setSourceModel(m_rootModel);
  descProxyModel2->setDisplayAncestorData(true);

  m_itemSelectionModel = new QItemSelectionModel(m_descProxyModel, this);

  m_selectionProxyModel = new SelectionProxyModel(m_itemSelectionModel, this);
  m_selectionProxyModel->setSourceModel(m_descProxyModel);

  QList<int> ancestorRows;

  ModelInsertCommand *insertCommand;
  int max_runs = 4;
  for (int i = 0; i < max_runs; i++)
  {
    insertCommand = new ModelInsertCommand(m_rootModel, this);
    insertCommand->setAncestorRowNumbers(ancestorRows);
    insertCommand->setNumCols(numCols);
    insertCommand->setStartRow(0);
    insertCommand->setEndRow(9);
    insertCommand->doCommand();
    ancestorRows << 9;
  }
  ancestorRows.clear();
  ancestorRows << 4;
  for (int i = 0; i < max_runs; i++)
  {
    insertCommand = new ModelInsertCommand(m_rootModel, this);
    insertCommand->setAncestorRowNumbers(ancestorRows);
    insertCommand->setNumCols(numCols);
    insertCommand->setStartRow(0);
    insertCommand->setEndRow(9);
    insertCommand->doCommand();
    ancestorRows << 4;
  }

  QTreeView *treeview = new QTreeView( vSplitter );
  treeview->setModel(m_rootModel);
  treeview->setSelectionMode(QAbstractItemView::ExtendedSelection);

  m_descView = new QTreeView( vSplitter );
  m_descView->setModel(m_descProxyModel);

  QTreeView *descView2 = new QTreeView( vSplitter );
  descView2->setModel(descProxyModel2);

{'fraction_non_alphanumeric': 0.09607488914435867, 'fraction_numerical': 0.011496140581376253, 'mean_word_length': 5.077844311377246, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 58, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2128997', 'n_tokens_mistral': 1969, 'n_tokens_neox': 1901, 'n_words': 518}