File indexing completed on 2024-05-19 16:06:16
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Library General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Library General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Library General Public License 0015 * along with this library; see the file COPYING.LIB. If not, write to 0016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #include "ArtisticTextShapeOnPathWidget.h" 0021 #include "ui_ArtisticTextShapeOnPathWidget.h" 0022 #include "ArtisticTextTool.h" 0023 #include <QAction> 0024 0025 ArtisticTextShapeOnPathWidget::ArtisticTextShapeOnPathWidget(ArtisticTextTool *tool, QWidget *parent) 0026 : QWidget(parent) 0027 , ui(new Ui::ArtisticTextShapeOnPathWidget) 0028 , m_textTool(tool) 0029 { 0030 ui->setupUi(this); 0031 ui->detachFromPath->setDefaultAction(tool->action("artistictext_detach_from_path")); 0032 ui->convertToPath->setDefaultAction(tool->action("artistictext_convert_to_path")); 0033 0034 connect(ui->startOffset, SIGNAL(valueChanged(int)), this, SIGNAL(offsetChanged(int))); 0035 } 0036 0037 ArtisticTextShapeOnPathWidget::~ArtisticTextShapeOnPathWidget() 0038 { 0039 delete ui; 0040 } 0041 0042 void ArtisticTextShapeOnPathWidget::updateWidget() 0043 { 0044 ArtisticTextToolSelection *selection = dynamic_cast<ArtisticTextToolSelection*>(m_textTool->selection()); 0045 if (!selection) 0046 return; 0047 0048 ArtisticTextShape *currentText = selection->selectedShape(); 0049 if (!currentText) 0050 return; 0051 0052 ui->startOffset->blockSignals(true); 0053 ui->startOffset->setValue( static_cast<int>( currentText->startOffset() * 100.0 ) ); 0054 ui->startOffset->setEnabled(currentText->isOnPath()); 0055 ui->startOffset->blockSignals(false); 0056 }