1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
/*
TimeTrackingWindow.h
This file is part of Charm, a task-based time tracking application.
Copyright (C) 2014-2018 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
Author: Frank Osterfeld <frank.osterfeld@kdab.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TimeTrackingWindow_H
#define TimeTrackingWindow_H
#include <QTimer>
#include "Core/CharmDataModelAdapterInterface.h"
#include "Charm/HttpClient/CheckForUpdatesJob.h"
#include "CharmWindow.h"
#include "Charm/WeeklySummary.h"
#include "BillDialog.h"
class HttpJob;
class CheckForUpdatesJob;
class CharmCommand;
class TimeTrackingView;
class IdleDetector;
class ReportConfigurationDialog;
class WeeklyTimesheetConfigurationDialog;
class MonthlyTimesheetConfigurationDialog;
class ActivityReportConfigurationDialog;
class TimeTrackingWindow : public CharmWindow, public CharmDataModelAdapterInterface
{
Q_OBJECT
public:
explicit TimeTrackingWindow(QWidget *parent = nullptr);
~TimeTrackingWindow() override;
enum VerboseMode {
Verbose = 0,
Silent
};
// application:
void stateChanged(State previous) override;
void restore() override;
bool event(QEvent *) override;
void showEvent(QShowEvent *) override;
QMenu *menu() const;
// model adapter:
void resetTasks() override;
void taskAboutToBeAdded(TaskId parent, int pos) override;
void taskAdded(TaskId id) override;
void taskModified(TaskId id) override;
void taskParentChanged(TaskId task, TaskId oldParent, TaskId newParent) override;
void taskAboutToBeDeleted(TaskId) override;
void taskDeleted(TaskId id) override;
void resetEvents() override;
void eventAboutToBeAdded(EventId id) override;
void eventAdded(EventId id) override;
void eventModified(EventId id, Event discardedEvent) override;
void eventAboutToBeDeleted(EventId id) override;
void eventDeleted(EventId id) override;
void eventActivated(EventId id) override;
void eventDeactivated(EventId id) override;
public Q_SLOTS:
// slots migrated from the old main window:
void slotEditPreferences(bool); // show prefs dialog
void slotAboutDialog();
void slotEnterVacation();
void slotActivityReport();
void slotWeeklyTimesheetReport();
void slotMonthlyTimesheetReport();
void slotExportToXml();
void slotImportFromXml();
void slotSyncTasks(VerboseMode mode = Verbose);
void slotSyncTasksVerbose();
void slotImportTasks();
void slotExportTasks();
void maybeIdle(IdleDetector *idleDetector);
void slotTasksDownloaded(HttpJob *);
void slotUserInfoDownloaded(HttpJob *);
void slotCheckForUpdatesManual();
void slotStartEvent(TaskId);
void configurationChanged() override;
protected:
void insertEditMenu() override;
private Q_SLOTS:
void slotStopEvent();
void slotSelectTasksToShow();
void slotWeeklyTimesheetPreview(int result);
void slotMonthlyTimesheetPreview(int result);
void slotActivityReportPreview(int result);
void slotCheckUploadedTimesheets();
void slotBillGone(int result);
void slotCheckForUpdatesAutomatic();
void slotCheckForUpdates(CheckForUpdatesJob::JobData);
void slotSyncTasksAutomatic();
void slotGetUserInfo();
Q_SIGNALS:
void emitCommand(CharmCommand *) override;
void emitCommandRollback(CharmCommand *) override;
void showNotification(const QString &title, const QString &message);
void taskMenuChanged();
private:
void uploadStagedTimesheet();
void resetWeeklyTimesheetDialog();
void resetMonthlyTimesheetDialog();
void showPreview(ReportConfigurationDialog *, int result);
//ugly but private:
void importTasksFromDeviceOrFile(QIODevice *device, const QString &filename,
bool verbose = true);
void startCheckForUpdates(VerboseMode mode = Silent);
void informUserAboutNewRelease(const QString &releaseVersion, const QUrl &link,
const QString &releaseInfoLink);
void handleIdleEvents(IdleDetector *detector, bool restart);
WeeklyTimesheetConfigurationDialog *m_weeklyTimesheetDialog = nullptr;
MonthlyTimesheetConfigurationDialog *m_monthlyTimesheetDialog = nullptr;
ActivityReportConfigurationDialog *m_activityReportDialog = nullptr;
TimeTrackingView *m_summaryWidget;
QVector<WeeklySummary> m_summaries;
QTimer m_checkUploadedSheetsTimer;
QTimer m_checkCharmReleaseVersionTimer;
QTimer m_updateUserInfoAndTasksDefinitionsTimer;
BillDialog *m_billDialog;
bool m_idleCorrectionDialogVisible = false;
bool m_uploadingStagedTimesheet = false;
};
#endif
|