Hello community, here is the log from the commit of package pairs for openSUSE:Factory checked in at 2013-08-16 13:43:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/pairs (Old) and /work/SRC/openSUSE:Factory/.pairs.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "pairs" Changes: -------- --- /work/SRC/openSUSE:Factory/pairs/pairs.changes 2013-07-30 16:07:56.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.pairs.new/pairs.changes 2013-08-16 13:43:37.000000000 +0200 @@ -1,0 +2,7 @@ +Thu Aug 8 15:25:25 UTC 2013 - [email protected] + +- Update to 4.11.0 + * KDE 4.11 Final release + * See http://www.kde.org/announcements/4.11/ + +------------------------------------------------------------------- Old: ---- pairs-4.10.97.tar.xz New: ---- pairs-4.11.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ pairs.spec ++++++ --- /var/tmp/diff_new_pack.NbRQ0A/_old 2013-08-16 13:43:38.000000000 +0200 +++ /var/tmp/diff_new_pack.NbRQ0A/_new 2013-08-16 13:43:38.000000000 +0200 @@ -17,7 +17,7 @@ Name: pairs -Version: 4.10.97 +Version: 4.11.0 Release: 0 Summary: Memory and Pairs Game License: GPL-2.0+ ++++++ pairs-4.10.97.tar.xz -> pairs-4.11.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pairs-4.10.97/pairseditor/elementitem.cpp new/pairs-4.11.0/pairseditor/elementitem.cpp --- old/pairs-4.10.97/pairseditor/elementitem.cpp 2013-07-10 01:02:04.000000000 +0200 +++ new/pairs-4.11.0/pairseditor/elementitem.cpp 2013-08-06 14:45:35.000000000 +0200 @@ -27,7 +27,8 @@ #include <QtXml/QXmlStreamWriter> #include <QtCore/QDebug> -ElementItem::ElementItem(const ThemeElement &el): QStandardItem() +ElementItem::ElementItem(const QString& text, const ThemeElement& el) + : QStandardItem(text) { QStringList l = el.foundLanglist(); if(!l.isEmpty()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pairs-4.10.97/pairseditor/elementitem.h new/pairs-4.11.0/pairseditor/elementitem.h --- old/pairs-4.10.97/pairseditor/elementitem.h 2013-07-10 01:02:04.000000000 +0200 +++ new/pairs-4.11.0/pairseditor/elementitem.h 2013-08-06 14:45:35.000000000 +0200 @@ -30,7 +30,7 @@ class ElementItem: public QStandardItem { public: - explicit ElementItem(const ThemeElement &el); + explicit ElementItem(const QString& text, const ThemeElement &el); void writeElement(QXmlStreamWriter *stream); QString checkMessage() const {return m_checkMessage;}; bool check(int index); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pairs-4.10.97/pairseditor/mainwindow.cpp new/pairs-4.11.0/pairseditor/mainwindow.cpp --- old/pairs-4.10.97/pairseditor/mainwindow.cpp 2013-07-10 01:02:04.000000000 +0200 +++ new/pairs-4.11.0/pairseditor/mainwindow.cpp 2013-08-06 14:45:35.000000000 +0200 @@ -64,6 +64,8 @@ m_mainWidget->widgetsHide(); createGUI(); actionCollection()->action("help_whats_this"); + + doNew(); } MainWindow::~MainWindow() @@ -124,7 +126,7 @@ void MainWindow::doNew() { - if(!askToSave()) + if(m_model && !askToSave()) return; m_file.clear(); delete m_model; @@ -134,7 +136,6 @@ m_mainWidget->clearUi(m_tmpDir->path()); m_mainWidget->widgetsHide(); m_fileSaved = true; - } void MainWindow::doSave() @@ -181,7 +182,7 @@ compress(m_file); m_fileSaved = true; - + setCaption(m_mainWidget->title(), !m_fileSaved); } @@ -194,6 +195,7 @@ m_mainWidget->setUi(m_pt); m_mainWidget->widgetsHide(); m_fileSaved = true; + setCaption(m_mainWidget->title(), !m_fileSaved); } @@ -257,3 +259,9 @@ m_tmpDir->mkpath(m_tmpDir->path()); } + +void MainWindow::doChange() +{ + m_fileSaved = false; + setCaption(m_mainWidget->title(), !m_fileSaved); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pairs-4.10.97/pairseditor/mainwindow.h new/pairs-4.11.0/pairseditor/mainwindow.h --- old/pairs-4.10.97/pairseditor/mainwindow.h 2013-07-10 01:02:04.000000000 +0200 +++ new/pairs-4.11.0/pairseditor/mainwindow.h 2013-08-06 14:45:35.000000000 +0200 @@ -54,7 +54,7 @@ void doTry(); void pairsFinished(); QString copyFile(KUrlRequester *k); - void doChange() {m_fileSaved = false;} + void doChange(); protected: virtual bool queryClose(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pairs-4.10.97/pairseditor/mainwindowview.cpp new/pairs-4.11.0/pairseditor/mainwindowview.cpp --- old/pairs-4.10.97/pairseditor/mainwindowview.cpp 2013-07-10 01:02:04.000000000 +0200 +++ new/pairs-4.11.0/pairseditor/mainwindowview.cpp 2013-08-06 14:45:35.000000000 +0200 @@ -34,12 +34,12 @@ #include <Phonon/MediaObject> #include <Phonon/AudioOutput> -MainWindowView::MainWindowView(QWidget *parent) : m_ui(new Ui::MainWindowView) +MainWindowView::MainWindowView(MainWindow *parent) + : m_ui(new Ui::MainWindowView) + , m_parent(parent) + , m_model(0) + , m_pt(0) { - m_parent = static_cast<MainWindow*> (parent); - m_model = 0; - m_pt = 0; - m_selectedItem = 0; m_ui->setupUi(this); m_ui->splitter->setStretchFactor(1, 3); connect(m_ui->fileKurl, SIGNAL(urlSelected(KUrl)), this, SLOT(fileSelected())); @@ -71,10 +71,10 @@ void MainWindowView::playSound() { - - if(!m_selectedItem) + if(!m_ui->treeView->selectionModel()->hasSelection()) return; - int type = m_selectedItem->data(ThemeModel::CardTypeRole).toInt(); + QModelIndex selectedIdx = m_ui->treeView->selectionModel()->selectedIndexes().first(); + int type = selectedIdx.data(ThemeModel::CardTypeRole).toInt(); if(type != CARD_SOUND && type != CARD_SOUNDLOGIC && type != CARD_FOUND) return; Phonon::MediaSource media(m_ui->fileKurl->startDir().path() + '/' + m_ui->fileKurl->text()); @@ -88,9 +88,16 @@ void MainWindowView::setModel(ThemeModel *model) { + if(m_model) + disconnect(m_model, 0, this, 0); m_model = model; - m_ui->treeView->setModel(model); - connect(m_ui->treeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(selectionChanged(QItemSelection,QItemSelection))); + if(m_model) { + connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SIGNAL(changed())); + connect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), SIGNAL(changed())); + connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), SIGNAL(changed())); + m_ui->treeView->setModel(model); + connect(m_ui->treeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(selectionChanged(QItemSelection,QItemSelection))); + } } void MainWindowView::widgetsHide() @@ -200,12 +207,12 @@ void MainWindowView::addFeature(int index) { - if(!m_model || m_model->rowCount() == 0 || !m_selectedItem || index == -1) + if(!m_model || m_model->rowCount() == 0 || !m_ui->treeView->selectionModel()->hasSelection() || index == -1) return; - QStandardItem *paren = m_selectedItem; + QModelIndex paren = m_ui->treeView->selectionModel()->selectedIndexes().first(); m_ui->moreButton->setCurrentIndex(-1); - if(m_selectedItem->data(ThemeModel::CardTypeRole).toInt()) - paren = m_selectedItem->parent(); + if(paren.parent().isValid()) + paren = paren.parent(); qDebug() << "addFeature called" << index; CardType newType; switch(index) @@ -228,38 +235,32 @@ break; } FeatureItem *fi = new FeatureItem(newType, "any", ""); - m_model->insertFeature(fi, paren); - emit changed(); + m_model->insertFeature(fi, m_model->itemFromIndex(paren)); + m_ui->treeView->expand(fi->parent()->index()); + m_ui->treeView->selectionModel()->select(fi->index(), QItemSelectionModel::ClearAndSelect); } void MainWindowView::addElement() { - - if(!m_model || m_model->rowCount() == 0 || !m_selectedItem || m_selectedItem->data(ThemeModel::CardTypeRole).toInt()) + if(!m_model) return; - const ThemeElement el; - ElementItem *newItem = new ElementItem (el); - QString name = i18n("Element %1", m_model->rowCount()+1); - newItem->setText(name); - m_model->insertItem(newItem); - emit changed(); + ElementItem* item = new ElementItem(i18n("Element %1", m_model->rowCount()+1), ThemeElement()); + m_model->appendRow(item); + m_ui->treeView->selectionModel()->select(item->index(), QItemSelectionModel::ClearAndSelect); } void MainWindowView::deleteElement() { - if(!m_model || m_model->rowCount() == 0 || !m_selectedItem) - return; - int new_row = m_selectedItem->row(); - m_model->removeItem(m_selectedItem); - m_selectedItem = 0; - emit changed(); - if(new_row >= m_model->rowCount()) - new_row = m_model->rowCount() - 1; - QModelIndex index = m_model->index(new_row,0); - m_ui->treeView->selectionModel()->select(index, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); + if(!m_ui->treeView->selectionModel()->hasSelection()) + return; + QModelIndex oldIdx = m_ui->treeView->selectionModel()->selectedIndexes().first(); + m_model->removeRow(oldIdx.row(), oldIdx.parent()); + int new_row = qMin(oldIdx.row(), m_model->rowCount() - 1); + QModelIndex index = m_model->index(new_row, 0); + m_ui->treeView->selectionModel()->select(index, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); } void MainWindowView::selectionChanged(const QItemSelection& selected, const QItemSelection& ) { @@ -269,7 +270,6 @@ void MainWindowView::elementSelected(const QModelIndex & idx) { - m_selectedItem = m_model->itemFromIndex(idx); int type = idx.data(ThemeModel::CardTypeRole).toInt(); if(!type) { @@ -355,23 +355,24 @@ } void MainWindowView::backSelected() { - QPixmap image; QString newFile = m_parent->copyFile(m_ui->backKurl); m_ui->backKurl->setText(m_ui->backKurl->url().fileName()); - image.load(newFile); + QPixmap image(newFile); m_ui->pixLabel->setPixmap(scaleImage(image, 100)); emit changed(); } void MainWindowView::fileSelected() { - QPixmap image; QString newFile = m_parent->copyFile(m_ui->fileKurl); m_ui->fileKurl->setText(m_ui->fileKurl->url().fileName()); - image.load(newFile); + QPixmap image(newFile); m_ui->itemLabel->setPixmap(scaleImage(image, 100)); - m_selectedItem->setData(m_ui->fileKurl->text(),ThemeModel::PathRole); - m_selectedItem->setText(m_ui->fileKurl->text()); - emit changed(); + + Q_ASSERT(m_ui->treeView->selectionModel()->hasSelection()); + QModelIndex idx = m_ui->treeView->selectionModel()->selectedIndexes().first(); + QStandardItem* selectedItem = m_model->itemFromIndex(idx); + selectedItem->setData(m_ui->fileKurl->text(),ThemeModel::PathRole); + selectedItem->setText(m_ui->fileKurl->text()); } QPixmap MainWindowView::scaleImage(const QPixmap &i, int max) const @@ -383,8 +384,14 @@ void MainWindowView::wordChanged(const QString &word) { - m_selectedItem->setData(word, ThemeModel::PathRole); - m_selectedItem->setText(word); - emit changed(); + Q_ASSERT(m_ui->treeView->selectionModel()->hasSelection()); + QModelIndex idx = m_ui->treeView->selectionModel()->selectedIndexes().first(); + QStandardItem* selectedItem = m_model->itemFromIndex(idx); + selectedItem->setData(word, ThemeModel::PathRole); + selectedItem->setText(word); } +QString MainWindowView::title() const +{ + return m_ui->titleEdit->text(); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pairs-4.10.97/pairseditor/mainwindowview.h new/pairs-4.11.0/pairseditor/mainwindowview.h --- old/pairs-4.10.97/pairseditor/mainwindowview.h 2013-07-10 01:02:04.000000000 +0200 +++ new/pairs-4.11.0/pairseditor/mainwindowview.h 2013-08-06 14:45:35.000000000 +0200 @@ -46,16 +46,16 @@ Q_OBJECT public: - explicit MainWindowView(QWidget *parent = 0); + explicit MainWindowView(MainWindow* parent); ~MainWindowView(); void widgetsHide(); void clearUi(const QString &path); void writeXmlCommon(QXmlStreamWriter *stream); - Ui::MainWindowView *ui(){return m_ui;}; void setUi(PairsThemeEditor *theme); void setModel(ThemeModel *model); bool check(); QString checkString() const {return m_checkMessage;}; + QString title() const; signals: void changed(); @@ -72,13 +72,12 @@ void playSound(); private: - MainWindow *m_parent; Ui::MainWindowView *m_ui; + MainWindow *m_parent; QString m_checkMessage; QString m_path; ThemeModel *m_model; PairsThemeEditor *m_pt; - QStandardItem *m_selectedItem; QPixmap scaleImage(const QPixmap &i, int max) const; Phonon::MediaObject *m_media; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pairs-4.10.97/pairseditor/thememodel.cpp new/pairs-4.11.0/pairseditor/thememodel.cpp --- old/pairs-4.10.97/pairseditor/thememodel.cpp 2013-07-10 01:02:04.000000000 +0200 +++ new/pairs-4.11.0/pairseditor/thememodel.cpp 2013-08-06 14:45:35.000000000 +0200 @@ -34,9 +34,8 @@ setRoleNames(names); Q_FOREACH(const ThemeElement& el, t.items()) { - ElementItem *item = new ElementItem(el); QString name = i18n("Element %1", el.value(CARD_IMAGE, "any").split('.').first()); - item->setText(name); + ElementItem *item = new ElementItem(name, el); appendRow(item); } } @@ -48,43 +47,11 @@ names.insert(LanguageRole, "language"); names.insert(PathRole, "path"); setRoleNames(names); - ElementItem *item = new ElementItem(ThemeElement()); - QString name = i18n("Element %1", rowCount()+1); - item->setText(name); - appendRow(item); -} - -void ThemeModel::removeItem(QStandardItem *selectedItem) -{ - - QStandardItem *par = selectedItem->parent(); - - QModelIndex mi = indexFromItem(selectedItem); - - if (par) { - beginRemoveRows(mi, mi.row(), mi.row()); - par->removeRow(mi.row()); - } - else - { - beginRemoveRows(QModelIndex(), mi.row(), mi.row()); - removeRow(mi.row()); - } - endRemoveRows(); - reset(); -} - -void ThemeModel::insertItem(QStandardItem *newItem) -{ - beginInsertRows(QModelIndex(), rowCount(), rowCount()); - insertRow(rowCount(), newItem); - endInsertRows(); + appendRow(new ElementItem(i18n("Element %1", rowCount()+1), ThemeElement())); } void ThemeModel::insertFeature(QStandardItem *newItem, QStandardItem *parent) { - beginInsertRows(indexFromItem(parent), parent->row(), parent->row()); parent->appendRow(newItem); - endInsertRows(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pairs-4.10.97/pairseditor/thememodel.h new/pairs-4.11.0/pairseditor/thememodel.h --- old/pairs-4.10.97/pairseditor/thememodel.h 2013-07-10 01:02:04.000000000 +0200 +++ new/pairs-4.11.0/pairseditor/thememodel.h 2013-08-06 14:45:35.000000000 +0200 @@ -35,8 +35,6 @@ }; explicit ThemeModel(PairsThemeEditor &t, QObject* parent = 0); explicit ThemeModel(QObject* parent = 0); - void removeItem(QStandardItem *selectedItem); - void insertItem(QStandardItem *newItem); void insertFeature(QStandardItem *newItem, QStandardItem *parent); }; -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
