| 1052 | } |
| 1053 | |
| 1054 | void MainFrame::show_doc() |
| 1055 | { |
| 1056 | AppConfig &app = AppConfig::Instance(); |
| 1057 | int lan = app.frameOptions.language; |
| 1058 | |
| 1059 | if (app.userHistory.showDocuments) { |
| 1060 | dialogs::DSDialog dlg(this, true); |
| 1061 | dlg.setTitle(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_DOCUMENT), "Document")); |
| 1062 | |
| 1063 | QString path = GetAppDataDir() + "/showDoc" + QString::number(lan)+ ".png"; |
| 1064 | if (!QFile::exists(path)){ |
| 1065 | path = ":/icons/showDoc"+QString::number(lan)+".png"; |
| 1066 | } |
| 1067 | |
| 1068 | QLabel tipsLabel; |
| 1069 | tipsLabel.setPixmap(path); |
| 1070 | |
| 1071 | QMessageBox msg; |
| 1072 | msg.setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowSystemMenuHint); |
| 1073 | msg.setContentsMargins(0, 0, 0, 0); |
| 1074 | |
| 1075 | QPushButton *noMoreButton = msg.addButton(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_NOT_SHOW_AGAIN), "Not Show Again"), QMessageBox::ActionRole); |
| 1076 | msg.addButton(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_IGNORE), "Ignore"), QMessageBox::ActionRole); |
| 1077 | QPushButton *openButton = msg.addButton(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_OPEN), "Open"), QMessageBox::ActionRole); |
| 1078 | |
| 1079 | QVBoxLayout layout; |
| 1080 | layout.addWidget(&tipsLabel); |
| 1081 | layout.addWidget(&msg, 0, Qt::AlignRight); |
| 1082 | layout.setContentsMargins(0, 0, 0, 0); |
| 1083 | |
| 1084 | dlg.layout()->addLayout(&layout); |
| 1085 | connect(&msg, SIGNAL(buttonClicked(QAbstractButton*)), &dlg, SLOT(accept())); |
| 1086 | |
| 1087 | dlg.exec(); |
| 1088 | |
| 1089 | if (msg.clickedButton() == openButton) { |
| 1090 | _mainWindow->openDoc(); |
| 1091 | } |
| 1092 | if (msg.clickedButton() == noMoreButton){ |
| 1093 | app.userHistory.showDocuments = false; |
| 1094 | app.SaveHistory(); |
| 1095 | } |
| 1096 | } |
| 1097 | } |
| 1098 | |
| 1099 | QWidget* MainFrame::GetMainWindow() |
| 1100 | { |
nothing calls this directly
no test coverage detected