diff options
-rw-r--r-- | src/main.cpp | 60 | ||||
-rw-r--r-- | src/ui/MainWindow.h | 29 | ||||
-rw-r--r-- | src/ui/keypair_details/KeyDetailsDialog.cpp | 6 | ||||
-rw-r--r-- | src/ui/keypair_details/KeyPairDetailTab.cpp | 16 | ||||
-rw-r--r-- | src/ui/keypair_details/KeyPairSubkeyTab.cpp | 12 | ||||
-rw-r--r-- | src/ui/keypair_details/KeyPairUIDTab.cpp | 4 | ||||
-rw-r--r-- | src/ui/main_window/MainWindowFileSlotFunction.cpp | 20 | ||||
-rw-r--r-- | src/ui/main_window/MainWindowUI.cpp | 31 | ||||
-rw-r--r-- | ui/InfoBoard.ui | 21 |
9 files changed, 95 insertions, 104 deletions
diff --git a/src/main.cpp b/src/main.cpp index aad4b8fd..5faf34a9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -74,24 +74,60 @@ int main(int argc, char* argv[]) { file.close(); #endif + auto* init_ctx_thread = QThread::create([]() { + // Create & Check Gnupg Context Status + if (!GpgFrontend::GpgContext::GetInstance().good()) { + QMessageBox::critical( + nullptr, _("ENV Loading Failed"), + _("Gnupg(gpg) is not installed correctly, please follow the " + "ReadME " + "instructions in Github to install Gnupg and then open " + "GpgFrontend.")); + QCoreApplication::quit(); + exit(0); + } + }); + + QApplication::connect(init_ctx_thread, &QThread::finished, init_ctx_thread, + &QThread::deleteLater); + + init_ctx_thread->start(); + + // Waiting Dialog + auto* waiting_dialog = new QProgressDialog(); + waiting_dialog->setMaximum(0); + waiting_dialog->setMinimum(0); + auto waiting_dialog_label = + new QLabel(QString(_("Loading Gnupg Info...")) + "<br /><br />" + + _("If this process is too slow, please set the key " + "server address appropriately in the gnupg configuration " + "file (depending " + "on the network situation in your country or region).")); + waiting_dialog_label->setWordWrap(true); + waiting_dialog->setLabel(waiting_dialog_label); + waiting_dialog->resize(420, 120); + QApplication::connect(waiting_dialog, &QProgressDialog::canceled, [=]() { + LOG(INFO) << "cancel clicked"; + init_ctx_thread->terminate(); + QCoreApplication::quit(); + exit(0); + }); + + // Show Waiting Dialog + waiting_dialog->show(); + waiting_dialog->setFocus(); + while (init_ctx_thread->isRunning()) { + QApplication::processEvents(); + } + waiting_dialog->finished(0); + waiting_dialog->deleteLater(); + /** * internationalisation. loop to restart main window * with changed translation when settings change. */ int return_from_event_loop_code; - // Create & Check Gnupg Context Status - if (!GpgFrontend::GpgContext::GetInstance().good()) { - QMessageBox::critical( - nullptr, _("ENV Loading Failed"), - _("Gnupg(gpg) is not installed correctly, please follow the " - "ReadME " - "instructions in Github to install Gnupg and then open " - "GpgFrontend.")); - QCoreApplication::quit(); - exit(0); - } - do { try { // i18n diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index 97c5c73f..1a36bf8a 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -153,26 +153,6 @@ class MainWindow : public QMainWindow { void slotDecryptVerify(); /** - * @details Open dialog for encrypting file. - */ - void slotFileEncryptCustom(); - - /** - * @details Open dialog for decrypting file. - */ - void slotFileDecryptCustom(); - - /** - * @details Open dialog for signing file. - */ - void slotFileSignCustom(); - - /** - * @details Open dialog for verifying file. - */ - void slotFileVerifyCustom(); - - /** * @details Show the details of the first of the first of selected keys */ void slotShowKeyDetails(); @@ -338,7 +318,6 @@ class MainWindow : public QMainWindow { QMenu* fileMenu{}; /** Submenu for file-operations*/ QMenu* editMenu{}; /** Submenu for text-operations*/ QMenu* cryptMenu{}; /** Submenu for crypt-operations */ - QMenu* fileEncMenu{}; /** Submenu for file crypt operations */ QMenu* helpMenu{}; /** Submenu for help-operations */ QMenu* keyMenu{}; /** Submenu for key-operations */ QMenu* viewMenu{}; /** Submenu for view operations */ @@ -393,12 +372,8 @@ class MainWindow : public QMainWindow { QAction* aboutAct{}; /** Action to open about dialog */ QAction* checkUpdateAct{}; /** Action to open about dialog */ QAction* translateAct{}; /** Action to open about dialog */ - QAction* fileEncryptAct{}; /** Action to open dialog for encrypting file */ - QAction* fileDecryptAct{}; /** Action to open dialog for decrypting file */ - QAction* fileSignAct{}; /** Action to open dialog for signing file */ - QAction* fileVerifyAct{}; /** Action to open dialog for verifying file */ - QAction* openSettingsAct{}; /** Action to open settings dialog */ - QAction* showKeyDetailsAct{}; /** Action to open key-details dialog */ + QAction* openSettingsAct{}; /** Action to open settings dialog */ + QAction* showKeyDetailsAct{}; /** Action to open key-details dialog */ QAction* refreshKeysFromKeyserverAct{}; /** Action to refresh a key from keyserver */ QAction* uploadKeyToServerAct{}; /** Action to append selected keys to edit */ diff --git a/src/ui/keypair_details/KeyDetailsDialog.cpp b/src/ui/keypair_details/KeyDetailsDialog.cpp index f3cab771..3864820f 100644 --- a/src/ui/keypair_details/KeyDetailsDialog.cpp +++ b/src/ui/keypair_details/KeyDetailsDialog.cpp @@ -35,11 +35,15 @@ KeyDetailsDialog::KeyDetailsDialog(const GpgKey& key, QWidget* parent) auto* mainLayout = new QVBoxLayout; mainLayout->addWidget(tabWidget); +#ifdef MACOS + setAttribute(Qt::WA_LayoutUsesWidgetRect); +#endif this->setAttribute(Qt::WA_DeleteOnClose, true); this->setLayout(mainLayout); this->setWindowTitle(_("Key Details")); this->setModal(true); - this->setMinimumSize(380, 620); + this->setMinimumSize({520, 800}); + this->resize(this->minimumSize()); this->show(); } } // namespace GpgFrontend::UI diff --git a/src/ui/keypair_details/KeyPairDetailTab.cpp b/src/ui/keypair_details/KeyPairDetailTab.cpp index 3de83e38..c0a96488 100644 --- a/src/ui/keypair_details/KeyPairDetailTab.cpp +++ b/src/ui/keypair_details/KeyPairDetailTab.cpp @@ -75,12 +75,16 @@ KeyPairDetailTab::KeyPairDetailTab(const std::string& key_id, QWidget* parent) vboxKD->addWidget(new QLabel(QString(_("Key Size")) + ": "), 2, 0); vboxKD->addWidget(new QLabel(QString(_("Nominal Usage")) + ": "), 3, 0); vboxKD->addWidget(new QLabel(QString(_("Actual Usage")) + ": "), 4, 0); - vboxKD->addWidget(new QLabel(QString(_("Create Date")) + ": "), 5, 0); - vboxKD->addWidget(new QLabel(QString(_("Expires on")) + ": "), 6, 0); - vboxKD->addWidget(new QLabel(QString(_("Last Update")) + ": "), 7, 0); + vboxKD->addWidget(new QLabel(QString(_("Create Date (Local Time)")) + ": "), + 5, 0); + vboxKD->addWidget(new QLabel(QString(_("Expires on (Local Time)")) + ": "), 6, + 0); + vboxKD->addWidget(new QLabel(QString(_("Last Update (Local Time)")) + ": "), + 7, 0); vboxKD->addWidget(new QLabel(QString(_("Master Key Existence")) + ": "), 8, 0); + keyidVarLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); vboxKD->addWidget(keyidVarLabel, 0, 1, 1, 1); vboxKD->addWidget(algorithmVarLabel, 1, 1, 1, 2); vboxKD->addWidget(keySizeVarLabel, 2, 1, 1, 2); @@ -93,6 +97,7 @@ KeyPairDetailTab::KeyPairDetailTab(const std::string& key_id, QWidget* parent) auto* copyKeyIdButton = new QPushButton(_("Copy")); copyKeyIdButton->setFlat(true); + copyKeyIdButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); vboxKD->addWidget(copyKeyIdButton, 0, 2); connect(copyKeyIdButton, &QPushButton::clicked, this, [=]() { QString fpr = keyidVarLabel->text().trimmed(); @@ -125,8 +130,8 @@ KeyPairDetailTab::KeyPairDetailTab(const std::string& key_id, QWidget* parent) hboxFP->addStretch(); fingerprintBox->setLayout(hboxFP); - mvbox->addStretch(); mvbox->addWidget(fingerprintBox); + mvbox->addStretch(); // Set Menu createOperaMenu(); @@ -201,13 +206,12 @@ KeyPairDetailTab::KeyPairDetailTab(const std::string& key_id, QWidget* parent) expBox->addWidget(expLabel); expBox->addStretch(); mvbox->addLayout(expBox); + mvbox->setContentsMargins(0, 0, 0, 0); // when key database updated connect(SignalStation::GetInstance(), SIGNAL(KeyDatabaseRefresh()), this, SLOT(slotRefreshKey())); - mvbox->setContentsMargins(0, 0, 0, 0); - slotRefreshKeyInfo(); setAttribute(Qt::WA_DeleteOnClose, true); setLayout(mvbox); diff --git a/src/ui/keypair_details/KeyPairSubkeyTab.cpp b/src/ui/keypair_details/KeyPairSubkeyTab.cpp index cb71c09f..8068d9a8 100644 --- a/src/ui/keypair_details/KeyPairSubkeyTab.cpp +++ b/src/ui/keypair_details/KeyPairSubkeyTab.cpp @@ -62,10 +62,10 @@ KeyPairSubkeyTab::KeyPairSubkeyTab(const std::string& key_id, QWidget* parent) subkeyDetailLayout->addWidget(new QLabel(QString(_("Key Size")) + ": "), 2, 0); subkeyDetailLayout->addWidget(new QLabel(QString(_("Usage")) + ": "), 3, 0); - subkeyDetailLayout->addWidget(new QLabel(QString(_("Expires On")) + ": "), 4, - 0); - subkeyDetailLayout->addWidget(new QLabel(QString(_("Create Date")) + ": "), 5, - 0); + subkeyDetailLayout->addWidget( + new QLabel(QString(_("Expires On (Local Time)")) + ": "), 4, 0); + subkeyDetailLayout->addWidget( + new QLabel(QString(_("Create Date (Local Time)")) + ": "), 5, 0); subkeyDetailLayout->addWidget(new QLabel(QString(_("Existence")) + ": "), 6, 0); subkeyDetailLayout->addWidget(new QLabel(QString(_("Fingerprint")) + ": "), 7, @@ -143,8 +143,8 @@ void KeyPairSubkeyTab::createSubkeyList() { subkeyList->setAlternatingRowColors(true); QStringList labels; - labels << _("Subkey ID") << _("Key Size") << _("Algo") << _("Create Date") - << _("Expire Date"); + labels << _("Subkey ID") << _("Key Size") << _("Algo") + << _("Create Date (UTC)") << _("Expire Date (UTC)"); subkeyList->setHorizontalHeaderLabels(labels); subkeyList->horizontalHeader()->setStretchLastSection(false); diff --git a/src/ui/keypair_details/KeyPairUIDTab.cpp b/src/ui/keypair_details/KeyPairUIDTab.cpp index b2aa8861..92a3c3ea 100644 --- a/src/ui/keypair_details/KeyPairUIDTab.cpp +++ b/src/ui/keypair_details/KeyPairUIDTab.cpp @@ -152,8 +152,8 @@ void KeyPairUIDTab::createSignList() { sigList->setAlternatingRowColors(true); QStringList labels; - labels << _("Key ID") << _("Name") << _("Email") << _("Create Date") - << _("Expired Date"); + labels << _("Key ID") << _("Name") << _("Email") << _("Create Date (UTC)") + << _("Expired Date (UTC)"); sigList->setHorizontalHeaderLabels(labels); sigList->horizontalHeader()->setStretchLastSection(false); } diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp index 133a7820..535f47af 100644 --- a/src/ui/main_window/MainWindowFileSlotFunction.cpp +++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp @@ -450,24 +450,4 @@ void MainWindow::slotFileDecryptVerify() { } } -void MainWindow::slotFileEncryptCustom() { - new FileEncryptionDialog(mKeyList->getChecked(), - FileEncryptionDialog::Encrypt, this); -} - -void MainWindow::slotFileDecryptCustom() { - new FileEncryptionDialog(mKeyList->getChecked(), - FileEncryptionDialog::Decrypt, this); -} - -void MainWindow::slotFileSignCustom() { - new FileEncryptionDialog(mKeyList->getChecked(), FileEncryptionDialog::Sign, - this); -} - -void MainWindow::slotFileVerifyCustom() { - new FileEncryptionDialog(mKeyList->getChecked(), FileEncryptionDialog::Verify, - this); -} - } // namespace GpgFrontend::UI diff --git a/src/ui/main_window/MainWindowUI.cpp b/src/ui/main_window/MainWindowUI.cpp index 4499b9c8..a629057e 100644 --- a/src/ui/main_window/MainWindowUI.cpp +++ b/src/ui/main_window/MainWindowUI.cpp @@ -51,7 +51,7 @@ void MainWindow::createActions() { browserAct->setToolTip(_("Open a file browser")); connect(browserAct, SIGNAL(triggered()), this, SLOT(slotOpenFileTab())); - saveAct = new QAction(_("Save"), this); + saveAct = new QAction(_("Save File"), this); saveAct->setIcon(QIcon(":filesave.png")); saveAct->setShortcut(QKeySequence::Save); saveAct->setToolTip(_("Save the current File")); @@ -179,28 +179,6 @@ void MainWindow::createActions() { connect(decryptVerifyAct, SIGNAL(triggered()), this, SLOT(slotDecryptVerify())); - /* - * File encryption submenu - */ - fileEncryptAct = new QAction(_("Encrypt File"), this); - fileEncryptAct->setToolTip(_("Encrypt File")); - connect(fileEncryptAct, SIGNAL(triggered()), this, - SLOT(slotFileEncryptCustom())); - - fileDecryptAct = new QAction(_("Decrypt File"), this); - fileDecryptAct->setToolTip(_("Decrypt File")); - connect(fileDecryptAct, SIGNAL(triggered()), this, - SLOT(slotFileDecryptCustom())); - - fileSignAct = new QAction(_("Sign File"), this); - fileSignAct->setToolTip(_("Sign File")); - connect(fileSignAct, SIGNAL(triggered()), this, SLOT(slotFileSignCustom())); - - fileVerifyAct = new QAction(_("Verify File"), this); - fileVerifyAct->setToolTip(_("Verify File")); - connect(fileVerifyAct, SIGNAL(triggered()), this, - SLOT(slotFileVerifyCustom())); - signAct = new QAction(_("Sign"), this); signAct->setIcon(QIcon(":signature.png")); signAct->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I)); @@ -363,12 +341,6 @@ void MainWindow::createMenus() { editMenu->addSeparator(); editMenu->addAction(openSettingsAct); - fileEncMenu = new QMenu(_("File...")); - fileEncMenu->addAction(fileEncryptAct); - fileEncMenu->addAction(fileDecryptAct); - fileEncMenu->addAction(fileSignAct); - fileEncMenu->addAction(fileVerifyAct); - cryptMenu = menuBar()->addMenu(_("Crypt")); cryptMenu->addAction(encryptAct); cryptMenu->addAction(encryptSignAct); @@ -378,7 +350,6 @@ void MainWindow::createMenus() { cryptMenu->addAction(signAct); cryptMenu->addAction(verifyAct); cryptMenu->addSeparator(); - cryptMenu->addMenu(fileEncMenu); keyMenu = menuBar()->addMenu(_("Keys")); importKeyMenu = keyMenu->addMenu(_("Import Key")); diff --git a/ui/InfoBoard.ui b/ui/InfoBoard.ui index dcfe9e4e..1aac29aa 100644 --- a/ui/InfoBoard.ui +++ b/ui/InfoBoard.ui @@ -29,6 +29,9 @@ </item> <item> <layout class="QHBoxLayout" name="horizontalLayout_4"> + <property name="sizeConstraint"> + <enum>QLayout::SetNoConstraint</enum> + </property> <item alignment="Qt::AlignLeft"> <widget class="QWidget" name="horizontalWidget" native="true"> <property name="sizePolicy"> @@ -38,6 +41,24 @@ </sizepolicy> </property> <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="spacing"> + <number>5</number> + </property> + <property name="sizeConstraint"> + <enum>QLayout::SetNoConstraint</enum> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> <item alignment="Qt::AlignLeft"> <widget class="QLabel" name="actionLabel"> <property name="text"> |