1 /******************************************************************************************************* 2 DkStatusBar.h 3 Created on: 12.01.2016 4 5 nomacs is a fast and small image viewer with the capability of synchronizing multiple instances 6 7 Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org> 8 Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org> 9 Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org> 10 11 This file is part of nomacs. 12 13 nomacs is free software: you can redistribute it and/or modify 14 it under the terms of the GNU General Public License as published by 15 the Free Software Foundation, either version 3 of the License, or 16 (at your option) any later version. 17 18 nomacs is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License for more details. 22 23 You should have received a copy of the GNU General Public License 24 along with this program. If not, see <http://www.gnu.org/licenses/>. 25 26 *******************************************************************************************************/ 27 28 #pragma once 29 30 #pragma warning(push, 0) // no warnings from includes - begin 31 #include <QStatusBar> 32 #pragma warning(pop) 33 34 #pragma warning(disable: 4251) // TODO: remove 35 36 #ifndef DllCoreExport 37 #ifdef DK_CORE_DLL_EXPORT 38 #define DllCoreExport Q_DECL_EXPORT 39 #elif DK_DLL_IMPORT 40 #define DllCoreExport Q_DECL_IMPORT 41 #else 42 #define DllCoreExport Q_DECL_IMPORT 43 #endif 44 #endif 45 46 // Qt defines 47 class QLabel; 48 49 namespace nmc { 50 51 52 class DllCoreExport DkStatusBar : public QStatusBar { 53 Q_OBJECT 54 55 public: 56 DkStatusBar(QWidget* parent = 0); ~DkStatusBar()57 ~DkStatusBar() {}; 58 59 enum StatusLabel { 60 status_pixel_info, // the first is special (left) 61 62 status_file_info, 63 status_dimension_info, 64 status_format_info, 65 status_zoom_info, 66 status_filenumber_info, 67 status_filesize_info, 68 status_time_info, 69 70 status_end, 71 }; 72 73 void setMessage(const QString& msg, StatusLabel which = status_pixel_info); 74 75 protected: 76 77 void createLayout(); 78 79 QVector<QLabel*> mLabels; 80 }; 81 82 class DllCoreExport DkStatusBarManager { 83 84 public: 85 static DkStatusBarManager& instance(); 86 87 // singleton 88 DkStatusBarManager(DkStatusBarManager const&) = delete; 89 void operator=(DkStatusBarManager const&) = delete; 90 91 void show(bool show, bool permanent = true); 92 DkStatusBar* statusbar(); 93 void setMessage(const QString& msg, DkStatusBar::StatusLabel which = DkStatusBar::status_pixel_info); 94 95 private: 96 DkStatusBarManager(); 97 98 DkStatusBar* mStatusBar = 0; 99 }; 100 101 } 102