mirror of
https://github.com/edisionnano/QDiskInfo.git
synced 2026-04-16 00:41:28 +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_actionGrid_View_triggered();
|
||||||
|
|
||||||
|
void on_actionSave_Image_triggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
nextButton->setFocusPolicy(Qt::NoFocus);
|
nextButton->setFocusPolicy(Qt::NoFocus);
|
||||||
prevButton->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->actionQuit->setShortcut(QKeySequence::Quit);
|
||||||
ui->actionRescan_Refresh->setShortcut(QKeySequence::Refresh);
|
ui->actionRescan_Refresh->setShortcut(QKeySequence::Refresh);
|
||||||
|
|
||||||
@@ -1295,7 +1295,7 @@ void MainWindow::on_actionSave_JSON_triggered()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(this,
|
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 (*)"));
|
tr("JSON (*.json);;All Files (*)"));
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
return;
|
return;
|
||||||
@@ -1476,3 +1476,10 @@ void MainWindow::on_actionGrid_View_triggered()
|
|||||||
gridView->show();
|
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>
|
<string>File</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionSave_JSON"/>
|
<addaction name="actionSave_JSON"/>
|
||||||
|
<addaction name="actionSave_Image"/>
|
||||||
<addaction name="actionQuit"/>
|
<addaction name="actionQuit"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuSettings">
|
<widget class="QMenu" name="menuSettings">
|
||||||
@@ -548,7 +549,10 @@
|
|||||||
<iconset theme="document-save"/>
|
<iconset theme="document-save"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Save JSON</string>
|
<string>&Save (JSON)</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+T</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionQuit">
|
<action name="actionQuit">
|
||||||
@@ -661,6 +665,17 @@
|
|||||||
<string>Grid View</string>
|
<string>Grid View</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</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>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="resources.qrc"/>
|
<include location="resources.qrc"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user