void AnalysisWidget::slotLinkClicked(const QUrl& url) { if (m_NextBoard != m_board) { return; // Pinned and user moved somewhere else } int mpv = url.toString().toInt() - 1; if(mpv >= 0 && mpv < m_analyses.count()) { emit addVariation(m_analyses[mpv]); } else if(mpv == -1) { emit addVariation(m_tablebaseEvaluation); } else { mpv = (-mpv) - 2; if(mpv < m_analyses.count()) { if (m_analyses[mpv].variation().size()) { emit addVariation(m_analyses[mpv].variation().at(0).toAlgebraic()); } } } }
/** * Constructs a tile stamp with the given \a map as its only variation. */ TileStamp::TileStamp(std::unique_ptr<Map> map) : d(new TileStampData) { addVariation(std::move(map)); }
TileStamp::TileStamp(Map *map) : d(new TileStampData) { addVariation(map); }
TileStampsDock::TileStampsDock(TileStampManager *stampManager, QWidget *parent) : QDockWidget(parent) , mTileStampManager(stampManager) , mTileStampModel(stampManager->tileStampModel()) , mNewStamp(new QAction(this)) , mAddVariation(new QAction(this)) , mDelete(new QAction(this)) { setObjectName(QLatin1String("TileStampsDock")); mTileStampView = new TileStampView(this); mTileStampView->setModel(mTileStampModel); mTileStampView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); mTileStampView->header()->setStretchLastSection(false); #if QT_VERSION >= 0x050000 mTileStampView->header()->setSectionResizeMode(0, QHeaderView::Stretch); mTileStampView->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); #else mTileStampView->header()->setResizeMode(0, QHeaderView::Stretch); mTileStampView->header()->setResizeMode(1, QHeaderView::ResizeToContents); #endif mTileStampView->setContextMenuPolicy(Qt::CustomContextMenu); connect(mTileStampView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showContextMenu(QPoint))); mNewStamp->setIcon(QIcon(QLatin1String(":images/16x16/document-new.png"))); mAddVariation->setIcon(QIcon(QLatin1String(":/images/16x16/add.png"))); mDelete->setIcon(QIcon(QLatin1String(":images/16x16/edit-delete.png"))); Utils::setThemeIcon(mNewStamp, "document-new"); Utils::setThemeIcon(mAddVariation, "add"); Utils::setThemeIcon(mDelete, "edit-delete"); connect(mNewStamp, SIGNAL(triggered()), stampManager, SLOT(newStamp())); connect(mAddVariation, SIGNAL(triggered()), SLOT(addVariation())); connect(mDelete, SIGNAL(triggered()), SLOT(delete_())); mDelete->setEnabled(false); mAddVariation->setEnabled(false); QWidget *widget = new QWidget(this); QVBoxLayout *layout = new QVBoxLayout(widget); layout->setMargin(5); QToolBar *buttonContainer = new QToolBar; buttonContainer->setFloatable(false); buttonContainer->setMovable(false); buttonContainer->setIconSize(QSize(16, 16)); buttonContainer->addAction(mNewStamp); buttonContainer->addAction(mAddVariation); buttonContainer->addAction(mDelete); QVBoxLayout *listAndToolBar = new QVBoxLayout; listAndToolBar->setSpacing(0); listAndToolBar->addWidget(mTileStampView); listAndToolBar->addWidget(buttonContainer); layout->addLayout(listAndToolBar); QItemSelectionModel *selectionModel = mTileStampView->selectionModel(); connect(selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(currentRowChanged(QModelIndex))); setWidget(widget); retranslateUi(); }