File indexing completed on 2024-04-28 04:32:02

0001 /*
0002  * Copyright (C) 2010-2015 by Stephen Allewell
0003  * steve.allewell@gmail.com
0004  *
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 2 of the License, or
0008  * (at your option) any later version.
0009  */
0010 
0011 #ifndef LibraryManagerDlg_H
0012 #define LibraryManagerDlg_H
0013 
0014 #include <QDialog>
0015 #include <QMenu>
0016 #include <QTreeWidgetItem>
0017 #include <QWidget>
0018 
0019 #include "ui_LibraryManager.h"
0020 
0021 class LibraryListWidgetItem;
0022 class LibraryTreeWidgetItem;
0023 class QHideEvent;
0024 class QShowEvent;
0025 
0026 class LibraryManagerDlg : public QDialog
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     explicit LibraryManagerDlg(QWidget *parent);
0032     virtual ~LibraryManagerDlg() = default;
0033 
0034     LibraryTreeWidgetItem *currentLibrary();
0035 
0036 protected:
0037     virtual bool event(QEvent *) Q_DECL_OVERRIDE;
0038     virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
0039     virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
0040 
0041 public slots:
0042     void setCellSize(double, double);
0043 
0044 private slots:
0045     void on_LibraryTree_customContextMenuRequested(const QPoint &);
0046     void on_LibraryIcons_customContextMenuRequested(const QPoint &);
0047     void on_LibraryTree_currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
0048     void on_IconSizeSlider_valueChanged(int);
0049     void on_DialogButtonBox_rejected();
0050     void on_DialogButtonBox_helpRequested();
0051 
0052     void newCategory();
0053     void addLibraryToExportList();
0054     void libraryProperties();
0055     void pasteFromClipboard();
0056 
0057     void patternProperties();
0058     void addPatternToExportList();
0059     void copyToClipboard();
0060     void deletePattern();
0061 
0062 private:
0063     void refreshLibraries();
0064     void recurseLibraryDirectory(LibraryTreeWidgetItem *, const QString &);
0065 
0066     QMenu m_contextMenu;
0067     LibraryTreeWidgetItem *m_contextTreeItem;
0068     LibraryListWidgetItem *m_contextListItem;
0069 
0070     Ui::LibraryManager ui;
0071 };
0072 
0073 #endif // LibraryManagerDlg_H