Added marking
This commit is contained in:
+34
-1
@@ -35,7 +35,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
|
||||
|
||||
QMenu *selectMenu = new QMenu(tr("Select"), this);
|
||||
selectMenu->addAction(tr("Mark"), this, SLOT(markImage()), Qt::Key_F5);
|
||||
//menuBar()->addMenu(selectMenu);
|
||||
selectMenu->addAction(tr("Unmark"), this, SLOT(unmarkImage()), Qt::Key_F8);
|
||||
menuBar()->addMenu(selectMenu);
|
||||
|
||||
m_database = new Database(this);
|
||||
if(!m_database->init())
|
||||
@@ -67,6 +68,9 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
if(event->isAccepted())
|
||||
updateWindowTitle();
|
||||
}
|
||||
|
||||
void MainWindow::keyReleaseEvent(QKeyEvent *event)
|
||||
@@ -91,6 +95,7 @@ void MainWindow::openFile()
|
||||
{
|
||||
QFileInfo info(file);
|
||||
m_ringList->setDir(info.dir().absolutePath());
|
||||
updateWindowTitle();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,5 +107,33 @@ void MainWindow::markImage()
|
||||
QString file = ptr->name();
|
||||
if(!file.isEmpty())
|
||||
m_database->mark(file);
|
||||
|
||||
updateWindowTitle();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::unmarkImage()
|
||||
{
|
||||
ImagePtr ptr = m_ringList->currentImage();
|
||||
if(ptr)
|
||||
{
|
||||
QString file = ptr->name();
|
||||
if(!file.isEmpty())
|
||||
m_database->unmark(file);
|
||||
|
||||
updateWindowTitle();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateWindowTitle()
|
||||
{
|
||||
ImagePtr ptr = m_ringList->currentImage();
|
||||
if(ptr)
|
||||
{
|
||||
QFileInfo info(ptr->name());
|
||||
QString title = info.fileName();
|
||||
if(m_database->isMarked(ptr->name()))
|
||||
title += " *";
|
||||
setWindowTitle(title);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user