Krita Source Code Documentation
Loading...
Searching...
No Matches
KisWelcomePageWidget Class Reference

A widget for displaying if no documents are open. This will display in the MDI area. More...

#include <KisWelcomePageWidget.h>

+ Inheritance diagram for KisWelcomePageWidget:

Public Slots

void showDropAreaIndicator (bool show)
 
void slotUpdateThemeColors ()
 

Public Member Functions

 KisWelcomePageWidget (QWidget *parent)
 
void setMainWindow (KisMainWindow *m_mainWindow)
 
 ~KisWelcomePageWidget () override
 

Protected Member Functions

void changeEvent (QEvent *event) override
 
void dragEnterEvent (QDragEnterEvent *event) override
 
void dragLeaveEvent (QDragLeaveEvent *event) override
 
void dragMoveEvent (QDragMoveEvent *event) override
 
void dropEvent (QDropEvent *event) override
 
bool eventFilter (QObject *watched, QEvent *event) override
 

Private Slots

bool isDevelopmentBuild ()
 
QFont largerFont ()
 
void recentDocumentClicked (QModelIndex index)
 
void slotNewFileClicked ()
 
void slotOpenFileClicked ()
 
void slotRecentDocContextMenuRequest (const QPoint &pos)
 
void slotRecentFilesModelIsUpToDate ()
 
void slotScrollerStateChanged (QScroller::State state)
 

Private Member Functions

void setupNewsLangSelection (QMenu *newsOptionMenu)
 
void showDevVersionHighlight ()
 

Private Attributes

const QString analyticsString = "pk_campaign=startup-sceen&pk_kwd="
 
QColor backgroundColor
 
QColor blendedColor
 
QString blendedStyle
 
KisMainWindowm_mainWindow {nullptr}
 
bool m_networkIsAllowed {false}
 
QScopedPointer< RecentItemDelegaterecentItemDelegate
 
QColor textColor
 

Detailed Description

A widget for displaying if no documents are open. This will display in the MDI area.

Definition at line 37 of file KisWelcomePageWidget.h.

Constructor & Destructor Documentation

◆ KisWelcomePageWidget()

KisWelcomePageWidget::KisWelcomePageWidget ( QWidget * parent)
explicit

Definition at line 116 of file KisWelcomePageWidget.cpp.

117 : QWidget(parent)
118{
119 setupUi(this);
120
121 // URLs that go to web browser...
122 devBuildIcon->setIcon(KisIconUtils::loadIcon("warning"));
123 devBuildLabel->setVisible(false);
124 updaterFrame->setVisible(false);
125 versionNotificationLabel->setVisible(false);
126 bnVersionUpdate->setVisible(false);
127 bnErrorDetails->setVisible(false);
128
129 // Recent docs...
130 recentDocumentsListView->setDragEnabled(false);
131 recentDocumentsListView->viewport()->setAutoFillBackground(false);
132 recentDocumentsListView->setSpacing(2);
133 recentDocumentsListView->installEventFilter(this);
134 recentDocumentsListView->setViewMode(QListView::IconMode);
135 recentDocumentsListView->setSelectionMode(QAbstractItemView::NoSelection);
136
137// m_recentItemDelegate.reset(new RecentItemDelegate(this));
138// m_recentItemDelegate->setItemHeight(KisRecentDocumentsModelWrapper::ICON_SIZE_LENGTH);
139// recentDocumentsListView->setItemDelegate(m_recentItemDelegate.data());
141 recentDocumentsListView->setVerticalScrollMode(QListView::ScrollPerPixel);
142 recentDocumentsListView->verticalScrollBar()->setSingleStep(50);
143 {
144 QScroller* scroller = KisKineticScroller::createPreconfiguredScroller(recentDocumentsListView);
145 if (scroller) {
146 connect(scroller, SIGNAL(stateChanged(QScroller::State)), this, SLOT(slotScrollerStateChanged(QScroller::State)));
147 }
148 }
149 recentDocumentsListView->setContextMenuPolicy(Qt::CustomContextMenu);
150 connect(recentDocumentsListView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(slotRecentDocContextMenuRequest(QPoint)));
151
152 // News widget...
153 QMenu *newsOptionsMenu = new QMenu(this);
154 newsOptionsMenu->setToolTipsVisible(true);
155 ShowNewsAction *showNewsAction = new ShowNewsAction(i18n("Enable news and check for new releases"), newsOptionsMenu);
156 newsOptionsMenu->addAction(showNewsAction);
157 showNewsAction->setToolTip(i18n("Show news about Krita: this needs internet to retrieve information from the krita.org website"));
158 showNewsAction->setCheckable(true);
159
160 newsOptionsMenu->addSection(i18n("Language"));
161 QAction *newsInfoAction = newsOptionsMenu->addAction(i18n("English news is always up to date."));
162 newsInfoAction->setEnabled(false);
163
164 setupNewsLangSelection(newsOptionsMenu);
165 btnNewsOptions->setMenu(newsOptionsMenu);
166
167 labelSupportText->setFont(largerFont());
168 donationLink->setFont(largerFont());
169
170 connect(showNewsAction, SIGNAL(toggled(bool)), newsWidget, SLOT(setVisible(bool)));
171 connect(showNewsAction, SIGNAL(toggled(bool)), labelNoFeed, SLOT(setHidden(bool)));
172 connect(showNewsAction, SIGNAL(toggled(bool)), newsWidget, SLOT(toggleNews(bool)));
173 connect(labelNoFeed, SIGNAL(linkActivated(QString)), showNewsAction, SLOT(enableFromLink(QString)));
174
175 labelNoFeed->setDismissable(false);
176
177#ifdef ENABLE_UPDATERS
178 connect(showNewsAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleUpdateChecks(bool)));
179#endif
180
181 donationLink->hide();
182 supporterBadge->hide();
183#ifdef Q_OS_ANDROID
184 initDonations();
185#endif
186
187 // configure the News area
188 KisConfig cfg(true);
189 m_networkIsAllowed = cfg.readEntry<bool>("FetchNews", false);
190
191
192#ifdef ENABLE_UPDATERS
193#ifndef Q_OS_ANDROID
194 // Setup version updater, but do not check for them, unless the user explicitly
195 // wants to check for updates.
196 // * No updater is created for Linux/Steam, Windows/Steam and Windows/Store distributions,
197 // as those stores have their own updating mechanism.
198 // * STEAMAPPID(Windows)/SteamAppId(Linux) environment variable is set when Krita is run from Steam.
199 // The environment variables are not public API.
200 // * MS Store version runs as a package (though we cannot know if it was
201 // installed from the Store or manually with the .msix package)
202#if defined Q_OS_LINUX
203 if (!qEnvironmentVariableIsSet("SteamAppId")) { // do not create updater for linux/steam
204 if (qEnvironmentVariableIsSet("APPIMAGE")) {
205 m_versionUpdater.reset(new KisAppimageUpdater());
206 } else {
207 m_versionUpdater.reset(new KisManualUpdater());
208 }
209 }
210#elif defined Q_OS_WIN
211 if (!KisWindowsPackageUtils::isRunningInPackage() && !qEnvironmentVariableIsSet("STEAMAPPID")) {
212 m_versionUpdater.reset(new KisManualUpdater());
213 KisUsageLogger::log("Non-store package - creating updater");
214 } else {
215 KisUsageLogger::log("detected appx or steam package - not creating the updater");
216 }
217#else
218 // always create updater for MacOS
219 m_versionUpdater.reset(new KisManualUpdater());
220#endif // Q_OS_*
221 if (!m_versionUpdater.isNull()) {
222 connect(bnVersionUpdate, SIGNAL(clicked()), this, SLOT(slotRunVersionUpdate()));
223 connect(bnErrorDetails, SIGNAL(clicked()), this, SLOT(slotShowUpdaterErrorDetails()));
224 connect(m_versionUpdater.data(), SIGNAL(sigUpdateCheckStateChange(KisUpdaterStatus)),
225 this, SLOT(slotSetUpdateStatus(const KisUpdaterStatus&)));
226
227 if (m_networkIsAllowed) { // only if the user wants them
228 m_versionUpdater->checkForUpdate();
229 }
230 }
231#endif // ifndef Q_OS_ANDROID
232#endif // ENABLE_UPDATERS
233
234
235 showNewsAction->setChecked(m_networkIsAllowed);
236 newsWidget->setVisible(m_networkIsAllowed);
237 versionNotificationLabel->setEnabled(m_networkIsAllowed);
238
239 // Drop area..
240 setAcceptDrops(true);
241}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
static void log(const QString &message)
Logs with date/time.
void setupNewsLangSelection(QMenu *newsOptionMenu)
void slotScrollerStateChanged(QScroller::State state)
void slotRecentDocContextMenuRequest(const QPoint &pos)
QIcon loadIcon(const QString &name)
KRITAWIDGETUTILS_EXPORT QScroller * createPreconfiguredScroller(QAbstractScrollArea *target)

References connect(), KisKineticScroller::createPreconfiguredScroller(), KisRecentDocumentsModelWrapper::ICON_SIZE_LENGTH, KisWindowsPackageUtils::isRunningInPackage(), largerFont(), KisIconUtils::loadIcon(), KisUsageLogger::log(), m_networkIsAllowed, KisConfig::readEntry(), setupNewsLangSelection(), slotRecentDocContextMenuRequest(), and slotScrollerStateChanged().

◆ ~KisWelcomePageWidget()

KisWelcomePageWidget::~KisWelcomePageWidget ( )
override

Definition at line 243 of file KisWelcomePageWidget.cpp.

244{
245}

Member Function Documentation

◆ changeEvent()

void KisWelcomePageWidget::changeEvent ( QEvent * event)
overrideprotected

Definition at line 475 of file KisWelcomePageWidget.cpp.

476{
477 if (event->type() == QEvent::FontChange) {
478 labelSupportText->setFont(largerFont());
479 donationLink->setFont(largerFont());
480 }
481}

References largerFont().

◆ dragEnterEvent()

void KisWelcomePageWidget::dragEnterEvent ( QDragEnterEvent * event)
overrideprotected

Definition at line 413 of file KisWelcomePageWidget.cpp.

414{
416 if (event->mimeData()->hasUrls() ||
417 event->mimeData()->hasFormat("application/x-krita-node-internal-pointer") ||
418 event->mimeData()->hasFormat("application/x-qt-image")) {
419 return event->accept();
420 }
421
422 return event->ignore();
423}
void showDropAreaIndicator(bool show)

References showDropAreaIndicator().

◆ dragLeaveEvent()

void KisWelcomePageWidget::dragLeaveEvent ( QDragLeaveEvent * event)
overrideprotected

◆ dragMoveEvent()

void KisWelcomePageWidget::dragMoveEvent ( QDragMoveEvent * event)
overrideprotected

Definition at line 456 of file KisWelcomePageWidget.cpp.

457{
459
460 if (event->mimeData()->hasUrls() ||
461 event->mimeData()->hasFormat("application/x-krita-node-internal-pointer") ||
462 event->mimeData()->hasFormat("application/x-qt-image")) {
463 return event->accept();
464 }
465
466 return event->ignore();
467}
void dragMoveEvent(QDragMoveEvent *event) override

References KisMainWindow::dragMoveEvent(), and m_mainWindow.

◆ dropEvent()

void KisWelcomePageWidget::dropEvent ( QDropEvent * event)
overrideprotected

Definition at line 425 of file KisWelcomePageWidget.cpp.

426{
428
429 if (event->mimeData()->hasUrls() && !event->mimeData()->urls().empty()) {
430 Q_FOREACH (const QUrl &url, event->mimeData()->urls()) {
431 if (url.toLocalFile().endsWith(".bundle", Qt::CaseInsensitive)) {
432 bool r = m_mainWindow->installBundle(url.toLocalFile());
433 if (!r) {
434 qWarning() << "Could not install bundle" << url.toLocalFile();
435 }
436 } else if (!url.isLocalFile()) {
437 QScopedPointer<QTemporaryFile> tmp(new QTemporaryFile());
438 tmp->setFileName(url.fileName());
439
440 KisRemoteFileFetcher fetcher;
441
442 if (!fetcher.fetchFile(url, tmp.data())) {
443 qWarning() << "Fetching" << url << "failed";
444 continue;
445 }
446 const auto localUrl = QUrl::fromLocalFile(tmp->fileName());
447
448 m_mainWindow->openDocument(localUrl.toLocalFile(), KisMainWindow::None);
449 } else {
451 }
452 }
453 }
454}
bool installBundle(const QString &fileName) const
Copy the given file into the bundle directory.
bool openDocument(const QString &path, OpenFlags flags)
The KisRemoteFileFetcher class can fetch a remote file and blocks until the file is downloaded.
bool fetchFile(const QUrl &remote, QIODevice *io)
fetch the image. Shows a progress dialog

References KisRemoteFileFetcher::fetchFile(), KisMainWindow::installBundle(), m_mainWindow, KisMainWindow::None, KisMainWindow::openDocument(), and showDropAreaIndicator().

◆ eventFilter()

bool KisWelcomePageWidget::eventFilter ( QObject * watched,
QEvent * event )
overrideprotected

Definition at line 483 of file KisWelcomePageWidget.cpp.

484{
485 if (watched == recentDocumentsListView && event->type() == QEvent::Leave) {
486 recentDocumentsListView->clearSelection();
487 }
488 return QWidget::eventFilter(watched, event);
489}

◆ isDevelopmentBuild

bool KisWelcomePageWidget::isDevelopmentBuild ( )
privateslot

Definition at line 642 of file KisWelcomePageWidget.cpp.

643{
645}
KRITAVERSION_EXPORT bool isDevelopersBuild()

References KritaVersionWrapper::isDevelopersBuild().

◆ largerFont

QFont KisWelcomePageWidget::largerFont ( )
privateslot

Definition at line 811 of file KisWelcomePageWidget.cpp.

812{
813 QFont larger = font();
814 larger.setPointSizeF(larger.pointSizeF() * 1.1f);
815 return larger;
816}

◆ recentDocumentClicked

void KisWelcomePageWidget::recentDocumentClicked ( QModelIndex index)
privateslot

Definition at line 620 of file KisWelcomePageWidget.cpp.

621{
622 QString fileUrl = index.data(Qt::ToolTipRole).toString();
624}

References m_mainWindow, KisMainWindow::None, and KisMainWindow::openDocument().

◆ setMainWindow()

void KisWelcomePageWidget::setMainWindow ( KisMainWindow * m_mainWindow)

Definition at line 247 of file KisWelcomePageWidget.cpp.

248{
249 if (mainWin) {
250 m_mainWindow = mainWin;
251
252 // set the shortcut links from actions (only if a shortcut exists)
253 if ( mainWin->viewManager()->actionManager()->actionByName("file_new")->shortcut().toString() != "") {
254 newFileLinkShortcut->setText(
255 QString("(") + mainWin->viewManager()->actionManager()->actionByName("file_new")->shortcut().toString(QKeySequence::NativeText) + QString(")"));
256 }
257 if (mainWin->viewManager()->actionManager()->actionByName("file_open")->shortcut().toString() != "") {
258 openFileShortcut->setText(
259 QString("(") + mainWin->viewManager()->actionManager()->actionByName("file_open")->shortcut().toString(QKeySequence::NativeText) + QString(")"));
260 }
261 connect(recentDocumentsListView, SIGNAL(clicked(QModelIndex)), this, SLOT(recentDocumentClicked(QModelIndex)));
262 // we need the view manager to actually call actions, so don't create the connections
263 // until after the view manager is set
264 connect(newFileLink, SIGNAL(clicked(bool)), this, SLOT(slotNewFileClicked()));
265 connect(openFileLink, SIGNAL(clicked(bool)), this, SLOT(slotOpenFileClicked()));
266 connect(clearRecentFilesLink, SIGNAL(clicked(bool)), mainWin, SLOT(clearRecentFiles()));
267
269
270 // allows RSS news items to apply analytics tracking.
271 newsWidget->setAnalyticsTracking("?" + analyticsString);
272
274 connect(recentFilesModel, SIGNAL(sigModelIsUpToDate()), this, SLOT(slotRecentFilesModelIsUpToDate()));
275 recentDocumentsListView->setModel(&recentFilesModel->model());
277 }
278}
static KisRecentDocumentsModelWrapper * instance()
void recentDocumentClicked(QModelIndex index)

References KisActionManager::actionByName(), KisViewManager::actionManager(), analyticsString, connect(), KisRecentDocumentsModelWrapper::instance(), m_mainWindow, KisRecentDocumentsModelWrapper::model(), recentDocumentClicked(), slotNewFileClicked(), slotOpenFileClicked(), slotRecentFilesModelIsUpToDate(), slotUpdateThemeColors(), and KisMainWindow::viewManager.

◆ setupNewsLangSelection()

void KisWelcomePageWidget::setupNewsLangSelection ( QMenu * newsOptionMenu)
private

Definition at line 518 of file KisWelcomePageWidget.cpp.

519{
520 // Hard-coded news language data:
521 // These are languages in which the news items should be regularly
522 // translated into as of 04-09-2024.
523 // The language display names should not be translated. This reflects
524 // the language selection box on the Krita website.
525 struct Lang {
526 const QString siteCode;
527 const QString name;
528 };
529 static const std::array<Lang, 22> newsLangs = {{
530 {QString("en"), QStringLiteral("English")},
531 {QString("jp"), QStringLiteral("日本語")},
532 {QString("zh"), QStringLiteral("中文 (简体)")},
533 {QString("zh-tw"), QStringLiteral("中文 (台灣正體)")},
534 {QString("zh-hk"), QStringLiteral("廣東話 (香港)")},
535 {QString("ca"), QStringLiteral("Català")},
536 {QString("ca@valencia"), QStringLiteral("Català de Valencia")},
537 {QString("cs"), QStringLiteral("Čeština")},
538 {QString("de"), QStringLiteral("Deutsch")},
539 {QString("eo"), QStringLiteral("Esperanto")},
540 {QString("es"), QStringLiteral("Español")},
541 {QString("eu"), QStringLiteral("Euskara")},
542 {QString("fr"), QStringLiteral("Français")},
543 {QString("it"), QStringLiteral("Italiano")},
544 {QString("lt"), QStringLiteral("lietuvių")},
545 {QString("nl"), QStringLiteral("Nederlands")},
546 {QString("pt"), QStringLiteral("Português")},
547 {QString("sk"), QStringLiteral("Slovenský")},
548 {QString("sl"), QStringLiteral("Slovenski")},
549 {QString("sv"), QStringLiteral("Svenska")},
550 {QString("tr"), QStringLiteral("Türkçe")},
551 {QString("uk"), QStringLiteral("Українська")}
552 }};
553
554 static const QString newsLangConfigName = QStringLiteral("FetchNewsLanguages");
555
556 QSharedPointer<QSet<QString>> enabledNewsLangs = QSharedPointer<QSet<QString>>::create();
557 {
558 // Initialize with the config.
559 KisConfig cfg(true);
560 auto languagesList = cfg.readList<QString>(newsLangConfigName);
561 *enabledNewsLangs = QSet(languagesList.begin(), languagesList.end());
562 }
563
564 // If no languages are selected in the config, use the automatic selection.
565 if (enabledNewsLangs->isEmpty()) {
566 enabledNewsLangs->insert(QString(getAutoNewsLang()));
567 }
568
569 for (const auto &lang : newsLangs) {
570 QAction *langItem = newsOptionsMenu->addAction(lang.name);
571 langItem->setCheckable(true);
572 // We can copy `code` into the lambda because its backing string is a
573 // static string literal.
574 const QString code = lang.siteCode;
575 connect(langItem, &QAction::toggled, newsWidget, [=](bool checked) {
576 newsWidget->toggleNewsLanguage(code, checked);
577 });
578
579 // Set the initial checked state.
580 if (enabledNewsLangs->contains(code)) {
581 langItem->setChecked(true);
582 }
583
584 // Connect this lambda after setting the initial checked state because
585 // we don't want to overwrite the config when doing the initial setup.
586 connect(langItem, &QAction::toggled, [=](bool checked) {
587 KisConfig cfg(false);
588 // It is safe to modify `enabledNewsLangs` here, because the slots
589 // are called synchronously on the UI thread so there is no need
590 // for explicit synchronization.
591 if (checked) {
592 enabledNewsLangs->insert(QString(code));
593 } else {
594 enabledNewsLangs->remove(QString(code));
595 }
596 cfg.writeList(newsLangConfigName, enabledNewsLangs->values());
597 });
598 }
599}
const char * name(StandardAction id)

References connect(), KisConfig::readList(), and KisConfig::writeList().

◆ showDevVersionHighlight()

void KisWelcomePageWidget::showDevVersionHighlight ( )
private

Definition at line 601 of file KisWelcomePageWidget.cpp.

602{
603 // always flag development version
604 if (isDevelopmentBuild()) {
605 QString devBuildLabelText = QString("<a style=\"color: " +
606 blendedColor.name() +
607 " \" href=\"https://docs.krita.org/en/untranslatable_pages/triaging_bugs.html?"
608 + analyticsString + "dev-build" + "\">")
609 .append(i18n("DEV BUILD")).append("</a>");
610
611 devBuildLabel->setText(devBuildLabelText);
612 devBuildIcon->setVisible(true);
613 devBuildLabel->setVisible(true);
614 } else {
615 devBuildIcon->setVisible(false);
616 devBuildLabel->setVisible(false);
617 }
618}

References analyticsString, blendedColor, and isDevelopmentBuild().

◆ showDropAreaIndicator

void KisWelcomePageWidget::showDropAreaIndicator ( bool show)
slot

if a document is placed over this area, a dotted line will appear as an indicator that it is a droppable area. KisMainwindow is what triggers this

Definition at line 281 of file KisWelcomePageWidget.cpp.

282{
283 if (!show) {
284 QString dropFrameStyle = QStringLiteral("QFrame#dropAreaIndicator { border: 2px solid transparent }");
285 dropFrameBorder->setStyleSheet(dropFrameStyle);
286 } else {
287 QColor textColor = qApp->palette().color(QPalette::Text);
288 QColor backgroundColor = qApp->palette().color(QPalette::Window);
290
291 // QColor.name() turns it into a hex/web format
292 QString dropFrameStyle = QString("QFrame#dropAreaIndicator { border: 2px dotted ").append(blendedColor.name()).append(" }") ;
293 dropFrameBorder->setStyleSheet(dropFrameStyle);
294 }
295}
QColor blendColors(const QColor &c1, const QColor &c2, qreal r1)

References backgroundColor, KisPaintingTweaks::blendColors(), blendedColor, and textColor.

◆ slotNewFileClicked

void KisWelcomePageWidget::slotNewFileClicked ( )
privateslot

Definition at line 647 of file KisWelcomePageWidget.cpp.

648{
650}

References m_mainWindow, and KisMainWindow::slotFileNew().

◆ slotOpenFileClicked

void KisWelcomePageWidget::slotOpenFileClicked ( )
privateslot

Definition at line 652 of file KisWelcomePageWidget.cpp.

653{
655}
void slotFileOpen(bool isImporting=false)

References m_mainWindow, and KisMainWindow::slotFileOpen().

◆ slotRecentDocContextMenuRequest

void KisWelcomePageWidget::slotRecentDocContextMenuRequest ( const QPoint & pos)
privateslot

Definition at line 626 of file KisWelcomePageWidget.cpp.

627{
628 QMenu contextMenu;
629 QModelIndex index = recentDocumentsListView->indexAt(pos);
630 QAction *actionForget = 0;
631 if (index.isValid()) {
632 actionForget = new QAction(i18n("Forget \"%1\"", index.data(Qt::DisplayRole).toString()), &contextMenu);
633 contextMenu.addAction(actionForget);
634 }
635 QAction *triggered = contextMenu.exec(recentDocumentsListView->mapToGlobal(pos));
636
637 if (index.isValid() && triggered == actionForget) {
638 m_mainWindow->removeRecentFile(index.data(Qt::ToolTipRole).toString());
639 }
640}
void removeRecentFile(QString url)

References m_mainWindow, and KisMainWindow::removeRecentFile().

◆ slotRecentFilesModelIsUpToDate

void KisWelcomePageWidget::slotRecentFilesModelIsUpToDate ( )
privateslot

Once all files in the recent documents model are checked, cleanup the UI if the model is empty

Definition at line 657 of file KisWelcomePageWidget.cpp.

658{
660 const bool modelIsEmpty = recentFilesModel->model().rowCount() == 0;
661
662 if (modelIsEmpty) {
663 recentDocsStackedWidget->setCurrentWidget(labelNoRecentDocs);
664 } else {
665 recentDocsStackedWidget->setCurrentWidget(recentDocumentsListView);
666 }
667 clearRecentFilesLink->setVisible(!modelIsEmpty);
668}

References KisRecentDocumentsModelWrapper::instance(), and KisRecentDocumentsModelWrapper::model().

◆ slotScrollerStateChanged

void KisWelcomePageWidget::slotScrollerStateChanged ( QScroller::State state)
inlineprivateslot

Definition at line 71 of file KisWelcomePageWidget.h.

KRITAWIDGETUTILS_EXPORT void updateCursor(QWidget *source, QScroller::State state)

References KisKineticScroller::updateCursor().

◆ slotUpdateThemeColors

void KisWelcomePageWidget::slotUpdateThemeColors ( )
slot

Definition at line 297 of file KisWelcomePageWidget.cpp.

298{
299 textColor = qApp->palette().color(QPalette::Text);
300 backgroundColor = qApp->palette().color(QPalette::Window);
301
302 // make the welcome screen labels a subtle color so it doesn't clash with the main UI elements
304 // only apply color to the widget itself, not to the tooltip or something
305 blendedStyle = "QWidget{color: " + blendedColor.name() + "}";
306
307 // what labels to change the color...
308 startTitleLabel->setStyleSheet(blendedStyle);
309 recentDocumentsLabel->setStyleSheet(blendedStyle);
310 helpTitleLabel->setStyleSheet(blendedStyle);
311 newsTitleLabel->setStyleSheet(blendedStyle);
312 newFileLinkShortcut->setStyleSheet(blendedStyle);
313 openFileShortcut->setStyleSheet(blendedStyle);
314 clearRecentFilesLink->setStyleSheet(blendedStyle);
315 recentDocumentsListView->setStyleSheet(blendedStyle);
316 newsWidget->setStyleSheet(blendedStyle);
317
318#ifdef Q_OS_ANDROID
319 blendedStyle = blendedStyle + "\nQPushButton { padding: 10px }";
320#endif
321
322 newFileLink->setStyleSheet(blendedStyle);
323 openFileLink->setStyleSheet(blendedStyle);
324
325 // make drop area QFrame have a dotted line
326 dropFrameBorder->setObjectName("dropAreaIndicator");
327 QString dropFrameStyle = QString("QFrame#dropAreaIndicator { border: 4px dotted ").append(blendedColor.name()).append("}");
328 dropFrameBorder->setStyleSheet(dropFrameStyle);
329
330 // only show drop area when we have a document over the empty area
332
333 // add icons for new and open settings to make them stand out a bit more
334 openFileLink->setIconSize(QSize(48, 48));
335 newFileLink->setIconSize(QSize(48, 48));
336
337 openFileLink->setIcon(KisIconUtils::loadIcon("document-open"));
338 newFileLink->setIcon(KisIconUtils::loadIcon("document-new"));
339
340 btnNewsOptions->setIcon(KisIconUtils::loadIcon("view-choose"));
341 btnNewsOptions->setFlat(true);
342
343 supportKritaIcon->setIcon(KisIconUtils::loadIcon(QStringLiteral("support-krita")));
344 const QIcon &linkIcon = KisIconUtils::loadIcon(QStringLiteral("bookmarks"));
345 userManualIcon->setIcon(linkIcon);
346 gettingStartedIcon->setIcon(linkIcon);
347 userCommunityIcon->setIcon(linkIcon);
348 kritaWebsiteIcon->setIcon(linkIcon);
349 sourceCodeIcon->setIcon(linkIcon);
350
351 kdeIcon->setIcon(KisIconUtils::loadIcon(QStringLiteral("kde")));
352
353 // HTML links seem to be a bit more stubborn with theme changes... setting inline styles to help with color change
354 userCommunityLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://krita-artists.org\">")
355 .append(i18n("User Community")).append("</a>"));
356
357 gettingStartedLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://docs.krita.org/user_manual/getting_started.html\">")
358 .append(i18n("Getting Started")).append("</a>"));
359
360 manualLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://docs.krita.org\">")
361 .append(i18n("User Manual")).append("</a>"));
362
363 supportKritaLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://krita.org/support-us/donations?" + analyticsString + "donations" + "\">")
364 .append(i18n("Support Krita")).append("</a>"));
365
366 kritaWebsiteLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://www.krita.org?" + analyticsString + "marketing-site" + "\">")
367 .append(i18n("Krita Website")).append("</a>"));
368
369 sourceCodeLink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://invent.kde.org/graphics/krita\">")
370 .append(i18n("Source Code")).append("</a>"));
371
372 poweredByKDELink->setText(QString("<a style=\"color: " + blendedColor.name() + " \" href=\"https://userbase.kde.org/What_is_KDE\">")
373 .append(i18n("Powered by KDE")).append("</a>"));
374
375 QString translationNoFeed = i18n("You can <a href=\"ignored\" style=\"color: COLOR_PLACEHOLDER; text-decoration: underline;\">enable news</a> from krita.org in various languages with the menu above");
376 labelNoFeed->setText(translationNoFeed.replace("COLOR_PLACEHOLDER", blendedColor.name()));
377
378 const QColor faintTextColor = KisPaintingTweaks::blendColors(textColor, backgroundColor, 0.4);
379 const QString &faintTextStyle = "QWidget{color: " + faintTextColor.name() + "}";
380 labelNoRecentDocs->setStyleSheet(faintTextStyle);
381 labelNoFeed->setStyleSheet(faintTextStyle);
382
383 const QColor frameColor = KisPaintingTweaks::blendColors(textColor, backgroundColor, 0.1);
384 const QString &frameQss = "{border: 1px solid " + frameColor.name() + "}";
385 recentDocsStackedWidget->setStyleSheet("QStackedWidget#recentDocsStackedWidget" + frameQss);
386 newsFrame->setStyleSheet("QFrame#newsFrame" + frameQss);
387
388 // show the dev version labels, if dev version is detected
390
391#ifdef ENABLE_UPDATERS
392 updateVersionUpdaterFrame(); // updater frame
393#endif
394
395#ifdef Q_OS_ANDROID
396 donationLink->setText(
397 QStringLiteral("<a href=\"#\">%1</a>").arg(QString(i18n("Get your Krita Supporter Badge here!"))));
398#endif
399
400#ifdef Q_OS_MACOS
401 // macOS store version should not contain external links containing donation buttons or forms
402 if (KisMacosEntitlements().sandbox()) {
403 supportKritaLink->hide();
404 supportKritaIcon->hide();
405 labelSupportText->hide();
406 kritaWebsiteLink->hide();
407 kritaWebsiteIcon->hide();
408 donationLink->hide();
409 }
410#endif
411}

References analyticsString, backgroundColor, KisPaintingTweaks::blendColors(), blendedColor, blendedStyle, KisIconUtils::loadIcon(), showDevVersionHighlight(), showDropAreaIndicator(), and textColor.

Member Data Documentation

◆ analyticsString

const QString KisWelcomePageWidget::analyticsString = "pk_campaign=startup-sceen&pk_kwd="
private

help us see how many people are clicking startup screen links you can see the results in Matomo (stats.kde.org) this will be listed in the "Acquisition" section of Matomo just append some text to this to associate it with an event/page

Definition at line 116 of file KisWelcomePageWidget.h.

◆ backgroundColor

QColor KisWelcomePageWidget::backgroundColor
private

Definition at line 121 of file KisWelcomePageWidget.h.

◆ blendedColor

QColor KisWelcomePageWidget::blendedColor
private

Definition at line 122 of file KisWelcomePageWidget.h.

◆ blendedStyle

QString KisWelcomePageWidget::blendedStyle
private

Definition at line 123 of file KisWelcomePageWidget.h.

◆ m_mainWindow

KisMainWindow* KisWelcomePageWidget::m_mainWindow {nullptr}
private

Definition at line 110 of file KisWelcomePageWidget.h.

110{nullptr};

◆ m_networkIsAllowed

bool KisWelcomePageWidget::m_networkIsAllowed {false}
private

Definition at line 129 of file KisWelcomePageWidget.h.

129{false};

◆ recentItemDelegate

QScopedPointer<RecentItemDelegate> KisWelcomePageWidget::recentItemDelegate
private

Definition at line 131 of file KisWelcomePageWidget.h.

◆ textColor

QColor KisWelcomePageWidget::textColor
private

Definition at line 120 of file KisWelcomePageWidget.h.


The documentation for this class was generated from the following files: