- fixes
This commit is contained in:
parent
e6bfe23703
commit
5a328a7518
@ -1,2 +1,2 @@
|
||||
// Auto generated file ! Please do not edit !
|
||||
#define APP_BUILD_NUMBER 113
|
||||
#define APP_BUILD_NUMBER 154
|
||||
@ -1,5 +1,6 @@
|
||||
#include "connectdb_widget.h"
|
||||
#include "ui_connectdb_widget.h"
|
||||
#include <QSizePolicy>
|
||||
|
||||
ConnectDbWidget::ConnectDbWidget(const QString& message, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
@ -10,6 +11,8 @@ ConnectDbWidget::ConnectDbWidget(const QString& message, QWidget *parent) :
|
||||
connect(ui->mButtonBox, SIGNAL(accepted()), this, SLOT(onOk()));
|
||||
connect(ui->mButtonBox, SIGNAL(rejected()), this, SLOT(onCancel()));
|
||||
connect(ui->mPasswordEdit, SIGNAL(returnPressed()), this, SLOT(onOk()));
|
||||
|
||||
this->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);
|
||||
}
|
||||
|
||||
ConnectDbWidget::~ConnectDbWidget()
|
||||
|
||||
@ -6,10 +6,16 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>277</width>
|
||||
<height>114</height>
|
||||
<width>400</width>
|
||||
<height>150</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
@ -18,8 +24,8 @@
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>150</height>
|
||||
<width>160000</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -49,8 +55,26 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="QLineEdit" name="mPasswordEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>500</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
|
||||
@ -245,6 +245,10 @@ QString path::pathToDatabaseTemplate()
|
||||
#ifdef TARGET_OSX
|
||||
return QCoreApplication::applicationDirPath() + "/../Resources/" + DATABASENAME;
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_LINUX
|
||||
return QCoreApplication::applicationDirPath() + "/" + DATABASENAME;
|
||||
#endif
|
||||
}
|
||||
|
||||
QString path::pathToLog()
|
||||
|
||||
@ -11,12 +11,9 @@ int main(int argc, char *argv[])
|
||||
QApplication a(argc, argv);
|
||||
helper::theme::applyCurrent(Settings::instance());
|
||||
|
||||
// Check if database / password are available
|
||||
QString path = helper::path::pathToDatabase();
|
||||
// Path to database.
|
||||
QString path = Settings::instance().getDatabasePath();
|
||||
|
||||
// Find optional custom path to database
|
||||
if (Settings::instance().data()[KEY_DB_FILENAME_SPECIFIED].toBool())
|
||||
path = Settings::instance().data()[KEY_DB_FILENAME].toString();
|
||||
|
||||
QString folder = QFileInfo(path).absoluteDir().path();
|
||||
Storage::instance().setPath(path);
|
||||
|
||||
@ -80,15 +80,7 @@ MainWindow::~MainWindow()
|
||||
void MainWindow::attachDatabase()
|
||||
{
|
||||
// Find default database file exists
|
||||
QString path = helper::path::pathToDatabase();
|
||||
|
||||
// Find optional custom path to database
|
||||
if (mSettings->data()[KEY_DB_FILENAME_SPECIFIED].toBool())
|
||||
{
|
||||
path = mSettings->data()[KEY_DB_FILENAME].toString();
|
||||
if (path.contains("~"))
|
||||
path.replace("~", QDir::homePath());
|
||||
}
|
||||
QString path = mSettings->getDatabasePath();
|
||||
|
||||
QString folder = QFileInfo(path).absoluteDir().path();
|
||||
Storage::instance().setPath(path);
|
||||
@ -173,6 +165,9 @@ void MainWindow::alertBox(const QString &title, const QString &text, AlertType a
|
||||
case AlertType_Warning:
|
||||
connect(mAlertBox, SIGNAL(finished(int)), this, SLOT(warningAlertFinished(int)));
|
||||
break;
|
||||
|
||||
case AlertType_CannotOpen:
|
||||
break;
|
||||
}
|
||||
|
||||
mAlertBox->show();
|
||||
@ -181,7 +176,7 @@ void MainWindow::alertBox(const QString &title, const QString &text, AlertType a
|
||||
void MainWindow::initClient()
|
||||
{
|
||||
// Avoid double initialization
|
||||
if (!mStackedViews->children().empty())
|
||||
if (mStackedViews->children().size() > 2)
|
||||
return;
|
||||
|
||||
mFindStartIndex = 0;
|
||||
@ -226,6 +221,8 @@ void MainWindow::initClient()
|
||||
connect(mActivityTracker.data(), SIGNAL(activityDetected()), this, SLOT(activityDetected()));
|
||||
|
||||
// Configure toolbar
|
||||
if (nullptr == mAttachmentsAction)
|
||||
{
|
||||
connect(ui->mMainToolbar, SIGNAL(visibilityChanged(bool)), this, SLOT(toolbarVisibilityChanged(bool)));
|
||||
QWidget *spacerWidget = new QWidget(this);
|
||||
spacerWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
@ -241,6 +238,7 @@ void MainWindow::initClient()
|
||||
mAttachmentsLabel = new QLabel(this);
|
||||
mAttachmentsLabel->setMargin(5);
|
||||
mAttachmentsLabel->setOpenExternalLinks(false);
|
||||
|
||||
QFont f = mAttachmentsLabel->font();
|
||||
f.setUnderline(true);
|
||||
mAttachmentsLabel->setFont(f);
|
||||
@ -255,6 +253,7 @@ void MainWindow::initClient()
|
||||
ui->mMainToolbar->addWidget(mAttachmentsLabel);
|
||||
connect(mAttachmentsLabel, SIGNAL(linkActivated(QString)), this, SLOT(showAttachments()));
|
||||
updateAttachmentsLabel(PTask());
|
||||
}
|
||||
|
||||
#ifdef TARGET_OSX
|
||||
mSleepTracker.install();
|
||||
@ -724,9 +723,9 @@ void MainWindow::taskIndexChanged(const QModelIndex& current, const QModelIndex&
|
||||
emit onTimeChanged();
|
||||
|
||||
// Set new timeline tree model
|
||||
/*int w = ui->mTaskTimeTree->columnWidth(0);
|
||||
/* int w = ui->mTaskTimeTree->columnWidth(0);
|
||||
ui->mTaskTimeTree->setModel(new TimeTreeModel(task->timeline(), *mSettings));
|
||||
ui->mTaskTimeTree->setColumnWidth(0, w);*/
|
||||
ui->mTaskTimeTree->setColumnWidth(0, w); */
|
||||
|
||||
// Show or hide time table depending on type of loaded task
|
||||
handleTrackableState(task);
|
||||
@ -876,7 +875,7 @@ void MainWindow::buildOpenOrCreateView()
|
||||
}
|
||||
|
||||
// Ask password
|
||||
void MainWindow::askDbPassword(const QString& message)
|
||||
void MainWindow::askDbPassword(const QString& /*message*/)
|
||||
{
|
||||
if (mStackedViews)
|
||||
mStackedViews->setCurrentIndex(ViewIndex_DbPassword);
|
||||
@ -1656,7 +1655,7 @@ void MainWindow::stopOnActivity()
|
||||
stopTracking(TSR_Manual);
|
||||
}
|
||||
|
||||
void MainWindow::trayWindowDestroyed(QObject *object)
|
||||
void MainWindow::trayWindowDestroyed(QObject */*object*/)
|
||||
{
|
||||
mTrayWindow = nullptr;
|
||||
}
|
||||
@ -1707,7 +1706,6 @@ void MainWindow::onNewDbPasswordEntered(const QString& password)
|
||||
void MainWindow::onDatabaseChanged(const QString& path)
|
||||
{
|
||||
// Bind to specific database
|
||||
mSettings->data()[KEY_DB_FILENAME_SPECIFIED] = true;
|
||||
mSettings->data()[KEY_DB_FILENAME] = path;
|
||||
mSettings->save();
|
||||
Storage::instance().setPath(path);
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>647</width>
|
||||
<height>508</height>
|
||||
<width>1206</width>
|
||||
<height>522</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -253,8 +253,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>647</width>
|
||||
<height>29</height>
|
||||
<width>1206</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="mFileMenu">
|
||||
@ -1280,6 +1280,22 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>mPreferencesAction</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>preferences()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>323</x>
|
||||
<y>253</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>save()</slot>
|
||||
|
||||
@ -35,11 +35,7 @@ PreferencesDlg::PreferencesDlg(QWidget *parent, Settings& settings) :
|
||||
ui->mDarkThemeCheckbox->setChecked(settings.data().value(KEY_DARK_THEME).toBool());
|
||||
|
||||
// Use custom database path ?
|
||||
ui->mCustomDatabaseFileCheckbox->setChecked(settings.data().value(KEY_DB_FILENAME_SPECIFIED).toBool());
|
||||
if (settings.data().value(KEY_DB_FILENAME_SPECIFIED).toBool())
|
||||
ui->mDatabaseLocation->setText(settings.data().value(KEY_DB_FILENAME).toString());
|
||||
else
|
||||
ui->mDatabaseLocation->setText(helper::path::pathToDatabase());
|
||||
|
||||
// Use stop on idle ?
|
||||
ui->mSmartStopTracking->setChecked(GET_BOOL(KEY_SMART_STOP));
|
||||
@ -83,7 +79,6 @@ void PreferencesDlg::accepted()
|
||||
|
||||
mSettings.data()[KEY_SHOW_SECONDS] = ui->mShowSecondsCheckbox->isChecked();
|
||||
mSettings.data()[KEY_ASK_BEFORE_DELETE] = ui->mAskBeforeDeleteCheckbox->isChecked();
|
||||
mSettings.data()[KEY_DB_FILENAME_SPECIFIED] = ui->mCustomDatabaseFileCheckbox->isChecked();
|
||||
mSettings.data()[KEY_DB_FILENAME] = ui->mDatabaseLocation->text();
|
||||
mSettings.data()[KEY_SMART_STOP] = ui->mSmartStopTracking->isChecked();
|
||||
mSettings.data()[KEY_SMART_STOP_MINUTES] = ui->mSmartStopIntervalInMinutes->text().toInt();
|
||||
|
||||
@ -58,13 +58,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="mCustomDatabaseFileCheckbox">
|
||||
<property name="text">
|
||||
<string>Use database at custom location (requires app restart)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mSelectDatabaseButton">
|
||||
<property name="text">
|
||||
|
||||
@ -56,6 +56,21 @@ void Settings::load()
|
||||
mData[KEY_SHOW_SECONDS] = true;
|
||||
}
|
||||
|
||||
QString Settings::getDatabasePath()
|
||||
{
|
||||
// Path to settings file
|
||||
QString path = helper::path::pathToSettings();
|
||||
|
||||
QString stored_path = data()[KEY_DB_FILENAME].toString();
|
||||
if (!stored_path.isEmpty())
|
||||
path = stored_path;
|
||||
|
||||
if (path.contains("~"))
|
||||
path.replace("~", QDir::homePath());
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
static Settings* GInstance = nullptr;
|
||||
Settings& Settings::instance()
|
||||
{
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
#define KEY_PASSWORD "Password"
|
||||
#define KEY_SHOW_SECONDS "ShowSeconds"
|
||||
#define KEY_DB_FILENAME "DbFilename"
|
||||
#define KEY_DB_FILENAME_SPECIFIED "DbFilenameSpecified"
|
||||
#define KEY_TIMECOUNTER_TYPE "TimecounterType"
|
||||
|
||||
#define KEY_LEFT "Left"
|
||||
@ -54,6 +53,7 @@ public:
|
||||
void save();
|
||||
QVariantMap& data();
|
||||
|
||||
QString getDatabasePath();
|
||||
static Settings& instance();
|
||||
|
||||
protected:
|
||||
|
||||
@ -372,6 +372,9 @@ TimeRecord TimeTreeModel::findInterval(const QModelIndex &index)
|
||||
case Level_Time:
|
||||
mTimeLine->getTime(year, month, day, &intervals);
|
||||
return intervals[index.row()];
|
||||
|
||||
default:
|
||||
return TimeRecord();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user