File indexing completed on 2024-05-19 05:42:22
0001 // ct_lvtqtc_repositoryentity.cpp -*-C++-*- 0002 0003 /* 0004 // Copyright 2023 Codethink Ltd <codethink@codethink.co.uk> 0005 // SPDX-License-Identifier: Apache-2.0 0006 // 0007 // Licensed under the Apache License, Version 2.0 (the "License"); 0008 // you may not use this file except in compliance with the License. 0009 // You may obtain a copy of the License at 0010 // 0011 // http://www.apache.org/licenses/LICENSE-2.0 0012 // 0013 // Unless required by applicable law or agreed to in writing, software 0014 // distributed under the License is distributed on an "AS IS" BASIS, 0015 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0016 // See the License for the specific language governing permissions and 0017 // limitations under the License. 0018 */ 0019 0020 #include <ct_lvtldr_lakosiannode.h> 0021 #include <ct_lvtqtc_repositoryentity.h> 0022 #include <preferences.h> 0023 0024 namespace Codethink::lvtqtc { 0025 0026 RepositoryEntity::RepositoryEntity(lvtldr::LakosianNode *node, lvtshr::LoaderInfo info): 0027 LakosEntity(getUniqueId(node->id()), node, info) 0028 { 0029 updateTooltip(); 0030 setText(node->name()); 0031 0032 setNumOutlines(1); 0033 QPen currentPen = pen(); 0034 currentPen.setStyle(Qt::PenStyle::DashLine); 0035 setPen(currentPen); 0036 0037 setFont(Preferences::pkgFont()); 0038 connect(Preferences::self(), &Preferences::pkgFontChanged, this, [this] { 0039 setFont(Preferences::pkgFont()); 0040 }); 0041 0042 connect(this, &LakosEntity::formFactorChanged, this, [this] { 0043 if (isExpanded()) { 0044 truncateTitle(EllipsisTextItem::Truncate::No); 0045 } else { 0046 truncateTitle(EllipsisTextItem::Truncate::Yes); 0047 } 0048 }); 0049 } 0050 0051 RepositoryEntity::~RepositoryEntity() = default; 0052 0053 void RepositoryEntity::updateTooltip() 0054 { 0055 makeToolTip("(no namespace)"); 0056 } 0057 0058 std::string RepositoryEntity::getUniqueId(const long long id) 0059 { 0060 return "repository#" + std::to_string(id); 0061 } 0062 0063 lvtshr::DiagramType RepositoryEntity::instanceType() const 0064 { 0065 return lvtshr::DiagramType::RepositoryType; 0066 } 0067 0068 void RepositoryEntity::updateBackground() 0069 { 0070 /* Intentionally left blank */ 0071 } 0072 0073 } // end namespace Codethink::lvtqtc