swift
enableforviewbasedindicator.cpp
1 // SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #include <QtGlobal>
7 
8 #include "gui/views/viewbase.h"
9 
10 using namespace swift::misc;
11 using namespace swift::gui;
12 using namespace swift::gui::views;
13 
14 namespace swift::gui
15 {
16  void CEnableForViewBasedIndicator::enableLoadIndicator(bool enable)
17  {
18  Q_ASSERT_X(m_viewWithIndicator, Q_FUNC_INFO, "Missing view to display indicator");
19  if (m_viewWithIndicator) { m_viewWithIndicator->enableLoadIndicator(enable); }
20  }
21 
22  bool CEnableForViewBasedIndicator::isShowingLoadIndicator() const
23  {
24  Q_ASSERT_X(m_viewWithIndicator, Q_FUNC_INFO, "Missing view to display indicator");
25  if (m_viewWithIndicator) { return m_viewWithIndicator->isShowingLoadIndicator(); }
26  return false;
27  }
28 
29  int CEnableForViewBasedIndicator::showLoadIndicator(std::chrono::milliseconds timeout)
30  {
31  Q_ASSERT_X(m_viewWithIndicator, Q_FUNC_INFO, "Missing view to display indicator");
32  if (m_viewWithIndicator) { return m_viewWithIndicator->showLoadIndicatorWithTimeout(timeout); }
33  return -1;
34  }
35 
36  void CEnableForViewBasedIndicator::hideLoadIndicator()
37  {
38  Q_ASSERT_X(m_viewWithIndicator, Q_FUNC_INFO, "Missing view to display indicator");
39  if (m_viewWithIndicator) { m_viewWithIndicator->hideLoadIndicator(); }
40  }
41 
42  CEnableForViewBasedIndicator::CEnableForViewBasedIndicator(
43  swift::gui::views::CViewBaseNonTemplate *viewWithIndicator)
44  : m_viewWithIndicator(viewWithIndicator)
45  {
46  // void
47  }
48 
50  {
51  this->m_viewWithIndicator = viewWithIndicator;
52  }
53 } // namespace swift::gui
void setViewWithIndicator(swift::gui::views::CViewBaseNonTemplate *viewWithIndicator)
Set the corresponding view.
Non templated base class, allows Q_OBJECT and signals / slots to be used.
Definition: viewbase.h:87
Views, mainly QTableView.
GUI related classes.
Free functions in swift::misc.