You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.9 KiB
C

#ifndef SARIBBONCUSTOMIZEDIALOG_H
#define SARIBBONCUSTOMIZEDIALOG_H
#include "SARibbonGlobal.h"
#include <QDialog>
#include "SARibbonCustomizeWidget.h"
class SARibbonActionsManager;
class SARibbonCustomizeDialogUi;
class QXmlStreamWriter;
/**
* @brief SARibbonCustomizeWidget
*
* @ref SARibbonActionsManager SARibbonActionsManagermianwindow
* SARibbonActionsManagerQActionSARibbonActionsManager
*
* @note SARibbon@ref sa_apply_customize_from_xml_file
* @ref SARibbonCustomizeDialog::fromXml
*/
class SA_RIBBON_EXPORT SARibbonCustomizeDialog : public QDialog
{
Q_OBJECT
public:
SARibbonCustomizeDialog(SARibbonMainWindow *ribbonWindow, QWidget *p = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
//设置action管理器
void setupActionsManager(SARibbonActionsManager *mgr);
//判断用户是否有要存储的内容对应save动作
bool isApplied() const;
//判断用户是否有改动内容对应apply动作
bool isCached() const;
//应用所有的设定
bool applys();
//清除所有动作
void clear();
//转换为xml
bool toXml(QXmlStreamWriter *xml) const;
bool toXml(const QString& xmlpath) const;
//从xml中加载QList<SARibbonCustomizeData>,对于基于配置文件的设置,对话框显示前建议调用此函数,保证叠加设置的正确记录
void fromXml(QXmlStreamReader *xml);
void fromXml(const QString& xmlpath);
//返回SARibbonCustomizeWidget窗口指针
SARibbonCustomizeWidget *customizeWidget() const;
private:
void initConnection();
SARibbonCustomizeDialogUi *ui;
};
#endif // SARIBBONCUSTOMIZEDIALOG_H