Debian Codegraph @

src/album/dialogs/albumcreatedialog.h

raw
1 /*
2 * Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co., Ltd.
3 *
4 * Author: ZhangYong <[email protected]>
5 *
6 * Maintainer: ZhangYong <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #ifndef ALBUMCREATEDIALOG_H
22 #define ALBUMCREATEDIALOG_H
23
24 #include "ddialog.h"
25 #include "dlineedit.h"
26 #include "controller/signalmanager.h"
27
28
29 class AlbumCreateDialog : public DDialog
30 {
31 Q_OBJECT
32 public:
33 explicit AlbumCreateDialog(DWidget *parent = nullptr);
34 const QString getCreateAlbumName() const;
35 /**
36 * @brief AlbumCreateDialog::getNewAlbumName
37 * @param[in] baseName
38 * @param[in] isWithOutSelf
39 * @param[in] beforeName
40 * @author DJH
41 * @date 2020/6/1
42 * @return const QString
43 * 根据已有相册名,获取对于数据库中不重复的新相册名,当isWithOutSefl为true的时候,查询不会包含自己,用于替换型查询
44 */
45 static const QString getNewAlbumName(const QString &baseName, bool isWithOutSelf = false, const QString &beforeName = "");
46 DLineEdit *getEdit();
47
48 signals:
49 void albumAdded();
50 void sigClose();
51
52 protected:
53 void keyPressEvent(QKeyEvent *e) override;
54 bool eventFilter(QObject *obj, QEvent *event) override;
55
56
57 private:
58 void initUI();
59 void initConnection();
60 void createAlbum(const QString &newName);
61
62 private slots:
63 void onTextEdited(const QString &);
64 void onVisibleChanged(bool v);
65 void onReturnPressed();
66 void onButtonClicked(int index);
67 void onClosed();
68
69 private:
70 QString m_createAlbumName;
71 DLineEdit *edit;
72 bool m_OKClicked;
73
74 //键盘交互
75 QList<QWidget *> m_allTabOrder;
76
77 };
78
79 #endif // ALBUMCREATEDIALOG_H