Skip to content

Commit

Permalink
imageframe toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
ponchio committed Jan 24, 2024
1 parent 30e4b72 commit 84e5181
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 32 deletions.
31 changes: 29 additions & 2 deletions relightlab/imageframe.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
#include <QVBoxLayout>
#include <QToolBar>
#include <QGraphicsView>

#include "relightapp.h"
#include "imageframe.h"

ImageFrame::ImageFrame()
{
ImageFrame::ImageFrame() {
QVBoxLayout *container = new QVBoxLayout(this);

QHBoxLayout *toolbars = new QHBoxLayout();

QToolBar *left_toolbar = new QToolBar;
left_toolbar->addAction(qRelightApp->action("zoom_fit"));
left_toolbar->addAction(qRelightApp->action("zoom_one"));
left_toolbar->addAction(qRelightApp->action("zoom_in"));
left_toolbar->addAction(qRelightApp->action("zoom_out"));
left_toolbar->addAction(qRelightApp->action("rotate_right"));
left_toolbar->addAction(qRelightApp->action("rotate_left"));

toolbars->addWidget(left_toolbar);
toolbars->addSpacing(1);

QToolBar *right_toolbar = new QToolBar;
right_toolbar->addAction(qRelightApp->action("show_image"));
right_toolbar->addAction(qRelightApp->action("show_list"));
right_toolbar->addAction(qRelightApp->action("show_grid"));
toolbars->addWidget(right_toolbar);

container->addLayout(toolbars);
container->addWidget(new QGraphicsView);

}
14 changes: 0 additions & 14 deletions relightlab/imagestab.cpp

This file was deleted.

11 changes: 0 additions & 11 deletions relightlab/imagestab.h

This file was deleted.

5 changes: 2 additions & 3 deletions relightlab/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ void MainWindow::openProject() {
}

void MainWindow::closeProject() {

cout << "close Project" << endl;
qRelightApp->action("close_project")->setEnabled(false);
}
Expand All @@ -181,8 +180,8 @@ void MainWindow::initInterface() {
}

bool MainWindow::needsSavingProceed() {
if(!qRelightApp->project().needs_saving);
return true;
if(!qRelightApp->project().needs_saving)
return true;
auto answer = QMessageBox::question(this, "Current project is unsaved", "Do you want to proceed without saving?");
return answer == QMessageBox::Yes;
}
12 changes: 12 additions & 0 deletions relightlab/relightapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ RelightApp::RelightApp(int &argc, char **argv): QApplication(argc, argv) {
addAction("open_project", "Open project...", "Ctrl+O");
addAction("close_project", "Close project", "Ctrl-W");
addAction("exit", "Exit", "Alt+F4");

//imagesframe
addAction("zoom_fit", "Fit", "");
addAction("zoom_one", "Zoom 1x", "1");
addAction("zoom_in", "Zoom in", "+");
addAction("zoom_out", "Zoom out", "-");
addAction("rotate_left", "Rotate left", "");
addAction("rotate_right", "Rotate right", "");

addAction("show_image", "Show image", "");
addAction("show_list", "Show list", "");
addAction("show_grid", "Show grid", "");
}

void RelightApp::addAction(const QString &id, const QString &label, const QString &shortcut) {
Expand Down
2 changes: 0 additions & 2 deletions relightlab/relightlab.pro
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ SOURCES += main.cpp \
../src/project.cpp \
../src/sphere.cpp \
../src/white.cpp \
imagestab.cpp \
mainwindow.cpp \
recentprojects.cpp \
relightapp.cpp \
Expand Down Expand Up @@ -66,7 +65,6 @@ HEADERS += \
../src/project.h \
../src/sphere.h \
../src/white.h \
imagestab.h \
mainwindow.h \
mainwindow.h \
recentprojects.h \
Expand Down

0 comments on commit 84e5181

Please sign in to comment.