Remember previous dropbox position and restore it on next startup.
This commit is contained in:
parent
9001726df1
commit
9b376cd2a8
@ -771,17 +771,17 @@
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_DropBox.cpp" line="123"/>
|
<location filename="../../src/Dialog_DropBox.cpp" line="129"/>
|
||||||
<source>LameXP DropBox</source>
|
<source>LameXP DropBox</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_DropBox.cpp" line="123"/>
|
<location filename="../../src/Dialog_DropBox.cpp" line="129"/>
|
||||||
<source>You can add files to LameXP via Drag&amp;Drop here!</source>
|
<source>You can add files to LameXP via Drag&amp;Drop here!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_DropBox.cpp" line="123"/>
|
<location filename="../../src/Dialog_DropBox.cpp" line="129"/>
|
||||||
<source>(Right-click to close the DropBox)</source>
|
<source>(Right-click to close the DropBox)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -777,17 +777,17 @@
|
|||||||
<translation type="unfinished">LameXP - DropBox</translation>
|
<translation type="unfinished">LameXP - DropBox</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_DropBox.cpp" line="123"/>
|
<location filename="../../src/Dialog_DropBox.cpp" line="129"/>
|
||||||
<source>LameXP DropBox</source>
|
<source>LameXP DropBox</source>
|
||||||
<translation type="unfinished">LameXP DropBox</translation>
|
<translation type="unfinished">LameXP DropBox</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_DropBox.cpp" line="123"/>
|
<location filename="../../src/Dialog_DropBox.cpp" line="129"/>
|
||||||
<source>You can add files to LameXP via Drag&amp;Drop here!</source>
|
<source>You can add files to LameXP via Drag&amp;Drop here!</source>
|
||||||
<translation type="unfinished">Możesz dodawać pliki do lisy wrzucając je do DropBoxa!</translation>
|
<translation type="unfinished">Możesz dodawać pliki do lisy wrzucając je do DropBoxa!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_DropBox.cpp" line="123"/>
|
<location filename="../../src/Dialog_DropBox.cpp" line="129"/>
|
||||||
<source>(Right-click to close the DropBox)</source>
|
<source>(Right-click to close the DropBox)</source>
|
||||||
<translation type="unfinished">(Kliknij prawym przyciskiem myszy by zamknąć okienko)</translation>
|
<translation type="unfinished">(Kliknij prawym przyciskiem myszy by zamknąć okienko)</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -775,17 +775,17 @@
|
|||||||
<translation>LameXP - DropBox</translation>
|
<translation>LameXP - DropBox</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_DropBox.cpp" line="123"/>
|
<location filename="../../src/Dialog_DropBox.cpp" line="129"/>
|
||||||
<source>LameXP DropBox</source>
|
<source>LameXP DropBox</source>
|
||||||
<translation>LameXP DropBox</translation>
|
<translation>LameXP DropBox</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_DropBox.cpp" line="123"/>
|
<location filename="../../src/Dialog_DropBox.cpp" line="129"/>
|
||||||
<source>You can add files to LameXP via Drag&amp;Drop here!</source>
|
<source>You can add files to LameXP via Drag&amp;Drop here!</source>
|
||||||
<translation>Du kan lägga till filer i LameXP via Dra&amp;Släpp här!</translation>
|
<translation>Du kan lägga till filer i LameXP via Dra&amp;Släpp här!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_DropBox.cpp" line="123"/>
|
<location filename="../../src/Dialog_DropBox.cpp" line="129"/>
|
||||||
<source>(Right-click to close the DropBox)</source>
|
<source>(Right-click to close the DropBox)</source>
|
||||||
<translation>(Högerklicka för att stänga DropBox)</translation>
|
<translation>(Högerklicka för att stänga DropBox)</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#define VER_LAMEXP_MINOR_LO 9
|
#define VER_LAMEXP_MINOR_LO 9
|
||||||
#define VER_LAMEXP_TYPE Alpha
|
#define VER_LAMEXP_TYPE Alpha
|
||||||
#define VER_LAMEXP_PATCH 7
|
#define VER_LAMEXP_PATCH 7
|
||||||
#define VER_LAMEXP_BUILD 1447
|
#define VER_LAMEXP_BUILD 1448
|
||||||
#define VER_LAMEXP_CONFG 1348
|
#define VER_LAMEXP_CONFG 1348
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -90,6 +90,12 @@ QDialog(parent, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint),
|
|||||||
|
|
||||||
DropBox::~DropBox(void)
|
DropBox::~DropBox(void)
|
||||||
{
|
{
|
||||||
|
if(!m_firstShow)
|
||||||
|
{
|
||||||
|
m_settings->dropBoxWidgetPositionX(this->x());
|
||||||
|
m_settings->dropBoxWidgetPositionY(this->y());
|
||||||
|
}
|
||||||
|
|
||||||
LAMEXP_DELETE(m_counterLabel);
|
LAMEXP_DELETE(m_counterLabel);
|
||||||
LAMEXP_DELETE(m_windowReferencePoint);
|
LAMEXP_DELETE(m_windowReferencePoint);
|
||||||
LAMEXP_DELETE(m_mouseReferencePoint);
|
LAMEXP_DELETE(m_mouseReferencePoint);
|
||||||
@ -134,11 +140,22 @@ void DropBox::showEvent(QShowEvent *event)
|
|||||||
if(m_firstShow)
|
if(m_firstShow)
|
||||||
{
|
{
|
||||||
m_firstShow = false;
|
m_firstShow = false;
|
||||||
QWidget *parentWidget = dynamic_cast<QWidget*>(this->parent());
|
int pos_x = m_settings->dropBoxWidgetPositionX();
|
||||||
QRect availGeometry = QApplication::desktop()->availableGeometry((parentWidget) ? parentWidget : this);
|
int pos_y = m_settings->dropBoxWidgetPositionY();
|
||||||
int max_x = availGeometry.width() - frameGeometry().width() + availGeometry.left();
|
if((pos_x < 0) && (pos_y < 0))
|
||||||
int max_y = availGeometry.height() - frameGeometry().height() + availGeometry.top();
|
{
|
||||||
move(max_x, max_y);
|
QWidget *const parentWidget = dynamic_cast<QWidget*>(this->parent());
|
||||||
|
QWidget *const targetWidget = parentWidget ? parentWidget : this;
|
||||||
|
QRect availGeometry = QApplication::desktop()->availableGeometry(targetWidget);
|
||||||
|
pos_x = availGeometry.width() - frameGeometry().width() + availGeometry.left();
|
||||||
|
pos_y = availGeometry.height() - frameGeometry().height() + availGeometry.top();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pos_x = qBound(0, pos_x, m_screenGeometry.width() - frameGeometry().width());
|
||||||
|
pos_y = qBound(0, pos_y, m_screenGeometry.height() - frameGeometry().height());
|
||||||
|
}
|
||||||
|
move(pos_x, pos_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_moving)
|
if(m_moving)
|
||||||
@ -147,6 +164,8 @@ void DropBox::showEvent(QShowEvent *event)
|
|||||||
m_moving = false;
|
m_moving = false;
|
||||||
setWindowOpacity(LOW_OPACITY);
|
setWindowOpacity(LOW_OPACITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boundWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DropBox::keyPressEvent(QKeyEvent *event)
|
void DropBox::keyPressEvent(QKeyEvent *event)
|
||||||
@ -161,7 +180,10 @@ void DropBox::keyReleaseEvent(QKeyEvent *event)
|
|||||||
|
|
||||||
void DropBox::closeEvent(QCloseEvent *event)
|
void DropBox::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
if(!m_canClose) event->ignore();
|
if(!m_canClose)
|
||||||
|
{
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DropBox::mousePressEvent(QMouseEvent *event)
|
void DropBox::mousePressEvent(QMouseEvent *event)
|
||||||
@ -191,29 +213,12 @@ void DropBox::mouseReleaseEvent(QMouseEvent *event)
|
|||||||
{
|
{
|
||||||
if(m_moving && event->button() != Qt::RightButton)
|
if(m_moving && event->button() != Qt::RightButton)
|
||||||
{
|
{
|
||||||
static const int magnetic = 24;
|
boundWidget(this);
|
||||||
QRect availGeometry = QApplication::desktop()->availableGeometry(this);
|
|
||||||
|
|
||||||
const int max_x = availGeometry.width() - frameGeometry().width() + availGeometry.left();
|
|
||||||
const int max_y = availGeometry.height() - frameGeometry().height() + availGeometry.top();
|
|
||||||
|
|
||||||
int new_x = qBound(availGeometry.left(), this->x(), max_x);
|
|
||||||
int new_y = qBound(availGeometry.top() , this->y(), max_y);
|
|
||||||
|
|
||||||
if(new_x - availGeometry.left() < magnetic) new_x = availGeometry.left();
|
|
||||||
if(new_y - availGeometry.top() < magnetic) new_y = availGeometry.top();
|
|
||||||
|
|
||||||
if(max_x - new_x < magnetic) new_x = max_x;
|
|
||||||
if(max_y - new_y < magnetic) new_y = max_y;
|
|
||||||
|
|
||||||
if((this->x() != new_x) || (this->y() != new_y))
|
|
||||||
{
|
|
||||||
move(new_x, new_y);
|
|
||||||
}
|
|
||||||
|
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
m_moving = false;
|
|
||||||
setWindowOpacity(LOW_OPACITY);
|
setWindowOpacity(LOW_OPACITY);
|
||||||
|
m_settings->dropBoxWidgetPositionX(this->x());
|
||||||
|
m_settings->dropBoxWidgetPositionY(this->y());
|
||||||
|
m_moving = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,3 +262,30 @@ bool DropBox::event(QEvent *event)
|
|||||||
|
|
||||||
return QDialog::event(event);
|
return QDialog::event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// PRIVATE
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void DropBox::boundWidget(QWidget *widget)
|
||||||
|
{
|
||||||
|
static const int magnetic = 24;
|
||||||
|
QRect availGeometry = QApplication::desktop()->availableGeometry(widget);
|
||||||
|
|
||||||
|
const int max_x = availGeometry.width() - widget->frameGeometry().width() + availGeometry.left();
|
||||||
|
const int max_y = availGeometry.height() - widget->frameGeometry().height() + availGeometry.top();
|
||||||
|
|
||||||
|
int new_x = qBound(availGeometry.left(), widget->x(), max_x);
|
||||||
|
int new_y = qBound(availGeometry.top(), widget->y(), max_y);
|
||||||
|
|
||||||
|
if(new_x - availGeometry.left() < magnetic) new_x = availGeometry.left();
|
||||||
|
if(new_y - availGeometry.top() < magnetic) new_y = availGeometry.top();
|
||||||
|
|
||||||
|
if(max_x - new_x < magnetic) new_x = max_x;
|
||||||
|
if(max_y - new_y < magnetic) new_y = max_y;
|
||||||
|
|
||||||
|
if((widget->x() != new_x) || (widget->y() != new_y))
|
||||||
|
{
|
||||||
|
widget->move(new_x, new_y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -53,12 +53,14 @@ private:
|
|||||||
QPoint *m_mouseReferencePoint;
|
QPoint *m_mouseReferencePoint;
|
||||||
QPoint *m_windowReferencePoint;
|
QPoint *m_windowReferencePoint;
|
||||||
QLabel *m_counterLabel;
|
QLabel *m_counterLabel;
|
||||||
QAbstractItemModel *m_model;
|
QAbstractItemModel *const m_model;
|
||||||
SettingsModel *m_settings;
|
SettingsModel *const m_settings;
|
||||||
bool m_moving;
|
bool m_moving;
|
||||||
bool m_firstShow;
|
bool m_firstShow;
|
||||||
QRect m_screenGeometry;
|
QRect m_screenGeometry;
|
||||||
|
|
||||||
|
static void boundWidget(QWidget *widget);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent *event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
void keyReleaseEvent(QKeyEvent *event);
|
void keyReleaseEvent(QKeyEvent *event);
|
||||||
|
@ -225,7 +225,9 @@ LAMEXP_MAKE_ID(customParametersOpusEnc, "AdvancedOptions/CustomParameters/O
|
|||||||
LAMEXP_MAKE_ID(customParametersWave, "AdvancedOptions/CustomParameters/Wave");
|
LAMEXP_MAKE_ID(customParametersWave, "AdvancedOptions/CustomParameters/Wave");
|
||||||
LAMEXP_MAKE_ID(customTempPath, "AdvancedOptions/TempDirectory/CustomPath");
|
LAMEXP_MAKE_ID(customTempPath, "AdvancedOptions/TempDirectory/CustomPath");
|
||||||
LAMEXP_MAKE_ID(customTempPathEnabled, "AdvancedOptions/TempDirectory/UseCustomPath");
|
LAMEXP_MAKE_ID(customTempPathEnabled, "AdvancedOptions/TempDirectory/UseCustomPath");
|
||||||
LAMEXP_MAKE_ID(dropBoxWidgetEnabled, "Flags/EnableDropBoxWidget");
|
LAMEXP_MAKE_ID(dropBoxWidgetEnabled, "DropBoxWidget/Enabled");
|
||||||
|
LAMEXP_MAKE_ID(dropBoxWidgetPositionX, "DropBoxWidget/Position/X");
|
||||||
|
LAMEXP_MAKE_ID(dropBoxWidgetPositionY, "DropBoxWidget/Position/Y");
|
||||||
LAMEXP_MAKE_ID(favoriteOutputFolders, "OutputDirectory/Favorites");
|
LAMEXP_MAKE_ID(favoriteOutputFolders, "OutputDirectory/Favorites");
|
||||||
LAMEXP_MAKE_ID(forceStereoDownmix, "AdvancedOptions/StereoDownmix/Force");
|
LAMEXP_MAKE_ID(forceStereoDownmix, "AdvancedOptions/StereoDownmix/Force");
|
||||||
LAMEXP_MAKE_ID(hibernateComputer, "AdvancedOptions/HibernateComputerOnShutdown");
|
LAMEXP_MAKE_ID(hibernateComputer, "AdvancedOptions/HibernateComputerOnShutdown");
|
||||||
@ -611,6 +613,8 @@ LAMEXP_MAKE_OPTION_S(customParametersWave, QString())
|
|||||||
LAMEXP_MAKE_OPTION_S(customTempPath, QDesktopServices::storageLocation(QDesktopServices::TempLocation))
|
LAMEXP_MAKE_OPTION_S(customTempPath, QDesktopServices::storageLocation(QDesktopServices::TempLocation))
|
||||||
LAMEXP_MAKE_OPTION_B(customTempPathEnabled, false)
|
LAMEXP_MAKE_OPTION_B(customTempPathEnabled, false)
|
||||||
LAMEXP_MAKE_OPTION_B(dropBoxWidgetEnabled, true)
|
LAMEXP_MAKE_OPTION_B(dropBoxWidgetEnabled, true)
|
||||||
|
LAMEXP_MAKE_OPTION_I(dropBoxWidgetPositionX, -1)
|
||||||
|
LAMEXP_MAKE_OPTION_I(dropBoxWidgetPositionY, -1)
|
||||||
LAMEXP_MAKE_OPTION_S(favoriteOutputFolders, QString())
|
LAMEXP_MAKE_OPTION_S(favoriteOutputFolders, QString())
|
||||||
LAMEXP_MAKE_OPTION_B(forceStereoDownmix, false)
|
LAMEXP_MAKE_OPTION_B(forceStereoDownmix, false)
|
||||||
LAMEXP_MAKE_OPTION_B(hibernateComputer, false)
|
LAMEXP_MAKE_OPTION_B(hibernateComputer, false)
|
||||||
|
@ -155,6 +155,8 @@ public:
|
|||||||
LAMEXP_MAKE_OPTION_S(customTempPath)
|
LAMEXP_MAKE_OPTION_S(customTempPath)
|
||||||
LAMEXP_MAKE_OPTION_B(customTempPathEnabled)
|
LAMEXP_MAKE_OPTION_B(customTempPathEnabled)
|
||||||
LAMEXP_MAKE_OPTION_B(dropBoxWidgetEnabled)
|
LAMEXP_MAKE_OPTION_B(dropBoxWidgetEnabled)
|
||||||
|
LAMEXP_MAKE_OPTION_I(dropBoxWidgetPositionX)
|
||||||
|
LAMEXP_MAKE_OPTION_I(dropBoxWidgetPositionY)
|
||||||
LAMEXP_MAKE_OPTION_S(favoriteOutputFolders)
|
LAMEXP_MAKE_OPTION_S(favoriteOutputFolders)
|
||||||
LAMEXP_MAKE_OPTION_B(forceStereoDownmix)
|
LAMEXP_MAKE_OPTION_B(forceStereoDownmix)
|
||||||
LAMEXP_MAKE_OPTION_B(hibernateComputer)
|
LAMEXP_MAKE_OPTION_B(hibernateComputer)
|
||||||
|
Loading…
Reference in New Issue
Block a user