mirror of
https://github.com/edisionnano/QDiskInfo.git
synced 2026-03-07 11:59:57 +03:00
Add option to save image
This commit is contained in:
@@ -49,6 +49,8 @@ private slots:
|
||||
|
||||
void on_actionGrid_View_triggered();
|
||||
|
||||
void on_actionSave_Image_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
QSettings settings;
|
||||
|
||||
@@ -69,7 +69,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
nextButton->setFocusPolicy(Qt::NoFocus);
|
||||
prevButton->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
ui->actionSave_JSON->setShortcut(QKeySequence::Save);
|
||||
ui->actionSave_Image->setShortcut(QKeySequence::Save);
|
||||
ui->actionQuit->setShortcut(QKeySequence::Quit);
|
||||
ui->actionRescan_Refresh->setShortcut(QKeySequence::Refresh);
|
||||
|
||||
@@ -1295,7 +1295,7 @@ void MainWindow::on_actionSave_JSON_triggered()
|
||||
}
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName(this,
|
||||
tr("Save JSON"), deviceNodeLineEdit->text().section('/', -1) + ".json",
|
||||
tr("Save JSON"), "QDiskInfo_" + deviceNodeLineEdit->text().section('/', -1) + ".json",
|
||||
tr("JSON (*.json);;All Files (*)"));
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
@@ -1476,3 +1476,10 @@ void MainWindow::on_actionGrid_View_triggered()
|
||||
gridView->show();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionSave_Image_triggered()
|
||||
{
|
||||
QPixmap screenshot = this->grab();
|
||||
screenshot.save(QFileDialog::getSaveFileName(this, tr("Save Image"), "QDiskInfo_" + deviceNodeLineEdit->text().section('/', -1) + ".png", tr("PNG Files (*.png)")));
|
||||
}
|
||||
|
||||
|
||||
@@ -498,6 +498,7 @@
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionSave_JSON"/>
|
||||
<addaction name="actionSave_Image"/>
|
||||
<addaction name="actionQuit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuSettings">
|
||||
@@ -548,7 +549,10 @@
|
||||
<iconset theme="document-save"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Save JSON</string>
|
||||
<string>&Save (JSON)</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+T</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionQuit">
|
||||
@@ -661,6 +665,17 @@
|
||||
<string>Grid View</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave_Image">
|
||||
<property name="icon">
|
||||
<iconset theme="image-x-generic"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save (Image)</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string/>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
|
||||
Reference in New Issue
Block a user