DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
dprintpreviewdialog_p.h
1// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DPRINTPREVIEWDIALOG_P_H
6#define DPRINTPREVIEWDIALOG_P_H
7
8#include "dprintpreviewsettinginterface.h"
9
10#include <DPrintPreviewDialog>
11#include "ddialog_p.h"
12#include <dprintpickcolorwidget.h>
13#include <DLabel>
14
15#include <DWidget>
16#include <DPushButton>
17#include <DCheckBox>
18#include <DComboBox>
19#include <DRadioButton>
20#include <QBasicTimer>
21
22class QVBoxLayout;
23class QButtonGroup;
24class DScrollArea;
25class QPrinter;
26DWIDGET_BEGIN_NAMESPACE
27class DFrame;
28class DIconButton;
29class DLineEdit;
30class DFileChooserEdit;
31class DLabel;
32class DSpinBox;
33class DSwitchButton;
34class DCommandLinkButton;
35class DSuggestButton;
36class DDoubleSpinBox;
37class DSlider;
38class DBackgroundGroup;
39class DToolButton;
40class PreviewSettingsPluginHelper;
42{
43public:
44 enum TipsNum {
45 NullTip,
46 MaxTip,
47 CommaTip,
48 FormatTip
49 };
50 enum WaterMarkType {
51 Type_None,
52 Type_Text,
53 Type_Image
54 };
55
57 void startup();
58 void initui();
59 void initleft(QVBoxLayout *layout);
60 void initright(QVBoxLayout *layout);
61 void initbasicui();
62 void initadvanceui();
63 void initWaterMarkui();
64 void initWaterSettings();
65 void marginsLayout(bool adapted);
66 void initdata();
67 void initconnections();
68 void setfrmaeback(DFrame *frame);
69 void showadvancesetting();
70 void setupPrinter();
71 void setScaling(int index);
72 void judgeSupportedAttributes(const QString &lastPaperSize);
73 void setMininumMargins();
74 void marginsUpdate(bool isPrinterChanged);
75 void adjustMargins();
76 void themeTypeChange(DGuiApplicationHelper::ColorType themeType);
77 void setPageIsLegal(bool islegal);
78 void tipSelected(TipsNum tipNum);
79 QVector<int> checkDuplication(QVector<int> data);
80
81 void updateSubControlSettings(DPrintPreviewSettingInfo::SettingType setting);
82 void updateAllControlSettings();
83 void updateAllContentSettings_impl();
84 void updateAllControlStatus();
85
86 void setEnable(const int &value, DComboBox *combox); //控件可用
87 void setTurnPageBtnStatus();
88 void watermarkTypeChoosed(int index);
89 void customPictureWatermarkChoosed(const QString &filename);
90 void waterMarkBtnClicked(bool checked);
91 void disablePrintSettings();
92 void setPageLayoutEnable(const bool &checked);
93 void matchFitablePageSize();
94 bool isActualPrinter(const QString &name);
95
96 void _q_printerChanged(int index);
97 void _q_pageRangeChanged(int index);
98 void _q_pageMarginChanged(int index);
99 void _q_ColorModeChange(int index);
100 void _q_startPrint(bool clicked);
101 void _q_orientationChanged(int index);
102 void _q_customPagesFinished();
103 void _q_marginspinChanged(double);
104 void _q_marginEditFinished();
105 void _q_currentPageSpinChanged(int value);
106 void _q_checkStateChanged(int state);
107 void _q_textWaterMarkModeChanged(int index);
108 void _q_customTextWatermarkFinished();
109 void _q_colorButtonCliked(bool cliked);
110 void _q_selectColorButton(QColor color);
111 void _q_pagePersheetComboIndexChanged(int index);
112 void _q_printOrderComboIndexChanged(int index);
113 void _q_spinboxValueEmptyChecked(const QString &);
114
115 void pageRangeError(TipsNum tipNum);
116
117 //printer
118 DPrinter *printer = nullptr;
119 int totalPages = 0;
120 bool fontSizeMore = false;
121 QString lastPageRange = "";
122 bool supportedDuplexFlag = false;
123 bool supportedColorMode = false;
124 bool isInited = false;
125 int strLengths = 0;
126 bool isOnFocus = false;
127 QString lastCusWatermarkText = "";
128 bool isChecked = false;
129 bool isEventHide = false;
130 bool isInitBtnColor = false;
131 QColor waterColor;
132 int typeChoice = 0;
133 int directChoice = 0;
134
135 //control
136 DPrintPreviewWidget *pview = nullptr;
137 DBackgroundGroup *back = nullptr;
138 DWidget *basicsettingwdg = nullptr;
139 DWidget *advancesettingwdg = nullptr;
140 DWidget *watermarksettingwdg = nullptr;
141 DWidget *textWatermarkWdg = nullptr;
142 DWidget *picWatermarkWdg = nullptr;
143 DIconButton *firstBtn = nullptr;
144 DIconButton *prevPageBtn = nullptr;
145 DSpinBox *jumpPageEdit = nullptr;
146 DLabel *totalPageLabel = nullptr;
147 DLabel *originTotalPageLabel = nullptr;
148 DIconButton *nextPageBtn = nullptr;
149 DIconButton *lastBtn = nullptr;
150 DPushButton *cancelBtn = nullptr;
151 DSuggestButton *printBtn = nullptr;
152 DPushButton *advanceBtn = nullptr;
153 DScrollArea *scrollarea = nullptr;
154 DComboBox *printDeviceCombo = nullptr;
155 DSpinBox *copycountspinbox = nullptr;
156 DComboBox *pageRangeCombo = nullptr;
157 DLineEdit *pageRangeEdit = nullptr;
158 QButtonGroup *orientationgroup = nullptr;
159 DComboBox *colorModeCombo = nullptr;
160 DComboBox *marginsCombo = nullptr;
161 DDoubleSpinBox *marginTopSpin = nullptr;
162 DDoubleSpinBox *marginBottomSpin = nullptr;
163 DDoubleSpinBox *marginLeftSpin = nullptr;
164 DDoubleSpinBox *marginRightSpin = nullptr;
165 QButtonGroup *scaleGroup = nullptr;
166 DSpinBox *scaleRateEdit = nullptr;
167 DComboBox *duplexCombo = nullptr;
168 DCheckBox *duplexCheckBox = nullptr;
169 DComboBox *paperSizeCombo = nullptr;
170 DComboBox *pagePerSheetCombo = nullptr;
171 DCheckBox *sidebysideCheckBox = nullptr;
172 QButtonGroup *directGroup = nullptr;
173 QButtonGroup *printOrderGroup = nullptr; //打印顺序
174 DComboBox *inorderCombo = nullptr;
175 DComboBox *waterTextCombo = nullptr; //添加水印类型
176 DIconButton *waterColorBtn = nullptr;
177 DLineEdit *waterTextEdit = nullptr; //文字水印内容
178 DComboBox *fontCombo = nullptr;
179 DSwitchButton *waterMarkBtn = nullptr;
180 DFileChooserEdit *picPathEdit = nullptr; //图片水印路径
181 QButtonGroup *waterTypeGroup = nullptr;
182 DComboBox *waterPosCombox = nullptr; //水印位置
183 DSpinBox *inclinatBox = nullptr; //倾度
184 DSlider *waterSizeSlider = nullptr;
185 DSpinBox *sizeBox = nullptr;
186 DSlider *wmOpaSlider = nullptr; //水印透明度
187 DSpinBox *opaBox = nullptr;
188 QVector<qreal> marginOldValue; // 记录margin自定义时的旧值 如果旧值和新值一致,就不需要刷新,top left right bottom
189 QList<qreal> minnumMargins;
190 QSpacerItem *spacer = nullptr;
191 QSpacerItem *wmSpacer = nullptr;
192 DFloatingWidget *colorWidget = nullptr;
193 DRadioButton *printInOrderRadio = nullptr;
194 DWidget *inorderwdg = nullptr;
195 DPrintPickColorWidget *pickColorWidget = nullptr;
196 QHash<QWidget *, QString> spinboxTextCaches;
197 PreviewSettingsPluginHelper *settingHelper;
198 QBasicTimer settingUpdateTimer;
199 Q_DECLARE_PUBLIC(DPrintPreviewDialog)
200};
201
203{
204public:
206 DPrintPreviewSettingInfo *loadInfo(DPrintPreviewSettingInfo::SettingType type, bool manual = false);
207
208 void setSubControlVisible(DPrintPreviewSettingInterface::SettingSubControl subControlType, bool visible);
209 void setSubControlEnabled(DPrintPreviewSettingInterface::SettingSubControl subControlType, bool enabled);
210
211 void updateSettingInfo(DPrintPreviewSettingInfo *info);
212 void updateSettingStatus(DPrintPreviewSettingInterface::SettingSubControl subControlType);
213
214 static void loadPlugin();
215 static void setPluginMimeData(const QVariant &data);
216 static QVariant pluginMimeData();
217
218 static QString currentPlugin();
219 static bool setCurrentPlugin(const QString &pluginName);
220
221 static QStringList availablePlugins();
222protected:
223 void doUpdateStatus(QWidget *source, DPrintPreviewSettingInterface::SettingSubControl subControlType, bool visible, bool enabled);
224 QWidgetList subControl(DPrintPreviewSettingInterface::SettingSubControl subControlType) const;
225 static QString pluginPath();
226
227private:
229 static QVariant m_printSettingData;
230 static DPrintPreviewSettingInterface *m_currentInterface;
231 static QList<DPrintPreviewSettingInterface *> m_availablePlugins;
232};
233
234DWIDGET_END_NAMESPACE
235
236#endif // DPRINTPREVIEWDIALOG_P_H
DBackgroundGroup提供了将布局控件改成圆角边框(将布局看成一个整体)
Definition dbackgroundgroup.h:17
DComboBox 重写QComboBox, 提供一个下拉列表供用户选择
Definition dcombobox.h:16
Definition ddialog_p.h:26
类似 DDoubleSpinBox
Definition dspinbox.h:57
带有选择文件按钮的文本编辑框
Definition dfilechooseredit.h:15
Definition dfloatingwidget.h:19
继承自QFrame类, 支持设置边框圆角,背景画刷功能
Definition dframe.h:18
按钮的图标
Definition diconbutton.h:24
DLabel一个重新实现的 QLabel。
Definition dlabel.h:18
DLineEdit一个聚合 QLineEdit 的输入框.
Definition dlineedit.h:20
Definition dprintpickcolorwidget.h:94
Definition dprintpreviewdialog_p.h:42
Dtk 风格的打印预览页面.
Definition dprintpreviewdialog.h:18
Definition dprintpreviewsettinginfo.h:15
Definition dprintpreviewsettinginterface.h:16
Definition dprintpreviewwidget.h:45
Definition dprintpreviewwidget.h:30
DSlider一个聚合 QSlider 的滑块,DSlider提供了在滑块两侧设置图标函数,且设置的滑块更加美观
Definition dslider.h:20
deepin风格的QSpinBox.
Definition dspinbox.h:17
这个控件提供了DTK中默认的建议按钮样式.点击按钮后会显示相应的建议信息
Definition dsuggestbutton.h:16
DSwitchButton 实现一个开关按钮
Definition dswitchbutton.h:19
Definition dprintpreviewdialog_p.h:203