TimerWidget::TimerWidget(QWidget *parent) : QWidget(parent), ui(new Ui::TimerWidget), timer(new QTimer(this)), duration(0), timeEntryAutocompleteNeedsUpdate(false) { ui->setupUi(this); connect(TogglApi::instance, SIGNAL(displayStoppedTimerState()), this, SLOT(displayStoppedTimerState())); connect(TogglApi::instance, SIGNAL(displayRunningTimerState(TimeEntryView*)), // NOLINT this, SLOT(displayRunningTimerState(TimeEntryView*))); // NOLINT connect(TogglApi::instance, SIGNAL(displayMinitimerAutocomplete(QVector<AutocompleteView*>)), // NOLINT this, SLOT(displayMinitimerAutocomplete(QVector<AutocompleteView*>))); // NOLINT connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(focusChanged(QWidget*, QWidget*))); connect(timer, SIGNAL(timeout()), this, SLOT(timeout())); connect(ui->description->lineEdit(), SIGNAL(returnPressed()), this, SLOT(descriptionReturnPressed())); ui->description->completer()->setCaseSensitivity(Qt::CaseInsensitive); ui->description->completer()->setCompletionMode( QCompleter::PopupCompletion); ui->description->completer()->setMaxVisibleItems(20); descriptionPlaceholder = "What are you doing?"; }
TimerWidget::TimerWidget(QWidget *parent) : QFrame(parent), ui(new Ui::TimerWidget), timer(new QTimer(this)), duration(0), project(""), tagsHolder(""), timeEntryAutocompleteNeedsUpdate(false), descriptionModel(new AutocompleteListModel(this)), timeEntry(nullptr), selectedTaskId(0), selectedProjectId(0) { ui->setupUi(this); ui->start->installEventFilter(this); connect(TogglApi::instance, SIGNAL(displayStoppedTimerState()), this, SLOT(displayStoppedTimerState())); connect(TogglApi::instance, SIGNAL(displayRunningTimerState(TimeEntryView*)), // NOLINT this, SLOT(displayRunningTimerState(TimeEntryView*))); // NOLINT connect(TogglApi::instance, SIGNAL(displayMinitimerAutocomplete(QVector<AutocompleteView*>)), // NOLINT this, SLOT(displayMinitimerAutocomplete(QVector<AutocompleteView*>))); // NOLINT connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(focusChanged(QWidget*, QWidget*))); connect(timer, SIGNAL(timeout()), this, SLOT(timeout())); connect(ui->description, SIGNAL(returnPressed()), this, SLOT(descriptionReturnPressed())); connect(ui->description, SIGNAL(projectSelected(QString,uint64_t,QString,QString,uint64_t)), this, SLOT(descriptionProjectSelected(QString,uint64_t,QString,QString,uint64_t))); connect(ui->description, SIGNAL(billableChanged(bool)), this, SLOT(descriptionBillableChanged(bool))); connect(ui->description, SIGNAL(tagsChanged(QString)), this, SLOT(descriptionTagsChanged(QString))); connect(ui->description, &QComboBox::editTextChanged, this, &TimerWidget::updateCoverLabel); connect(ui->deleteProject, &QPushButton::clicked, this, &TimerWidget::clearProject); connect(ui->deleteTask, &QPushButton::clicked, this, &TimerWidget::clearTask); ui->description->setModel(descriptionModel); ui->taskFrame->setVisible(false); ui->projectFrame->setVisible(false); ui->billable->setVisible(false); ui->tags->setVisible(false); descriptionPlaceholder = "What are you doing?"; tagsHolder = ""; }
IdleNotificationDialog::IdleNotificationDialog(QWidget *parent) : QDialog(parent), ui(new Ui::IdleNotificationDialog), idleStarted(0), timer(new QTimer(this)) { ui->setupUi(this); connect(TogglApi::instance, SIGNAL(displayIdleNotification(QString,QString,uint64_t)), this, SLOT(displayIdleNotification(QString,QString,uint64_t))); connect(TogglApi::instance, SIGNAL(displaySettings(bool,SettingsView*)), this, SLOT(displaySettings(bool,SettingsView*))); connect(timer, SIGNAL(timeout()), this, SLOT(timeout())); connect(TogglApi::instance, SIGNAL(displayStoppedTimerState()), this, SLOT(displayStoppedTimerState())); connect(TogglApi::instance, SIGNAL(displayLogin(bool,uint64_t)), this, SLOT(displayLogin(bool,uint64_t))); }
TimerWidget::TimerWidget(QWidget *parent) : QWidget(parent), ui(new Ui::TimerWidget), timer(new QTimer(this)), duration(0), timeEntryAutocompleteNeedsUpdate(false) { ui->setupUi(this); connect(TogglApi::instance, SIGNAL(displayStoppedTimerState()), this, SLOT(displayStoppedTimerState())); connect(TogglApi::instance, SIGNAL(displayRunningTimerState(TimeEntryView*)), // NOLINT this, SLOT(displayRunningTimerState(TimeEntryView*))); // NOLINT connect(TogglApi::instance, SIGNAL(displayTimeEntryAutocomplete(QVector<AutocompleteView*>)), // NOLINT this, SLOT(displayTimeEntryAutocomplete(QVector<AutocompleteView*>))); // NOLINT connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(focusChanged(QWidget*, QWidget*))); connect(timer, SIGNAL(timeout()), this, SLOT(timeout())); descriptionPlaceholder = "What are you doing?"; }
MainWindowController::MainWindowController( QWidget *parent, QString logPathOverride, QString dbPathOverride, QString scriptPath) : QMainWindow(parent), ui(new Ui::MainWindowController), togglApi(new TogglApi(0, logPathOverride, dbPathOverride)), tracking(false), loggedIn(false), actionEmail(0), actionNew(0), actionContinue(0), actionStop(0), actionSync(0), actionLogout(0), actionClear_Cache(0), actionSend_Feedback(0), actionReports(0), preferencesDialog(new PreferencesDialog(this)), aboutDialog(new AboutDialog(this)), feedbackDialog(new FeedbackDialog(this)), idleNotificationDialog(new IdleNotificationDialog(this)), trayIcon(0), reminder(false), pomodoro(false), script(scriptPath), ui_started(false) { TogglApi::instance->setEnvironment(APP_ENVIRONMENT); ui->setupUi(this); ui->menuBar->setVisible(true); QVBoxLayout *verticalLayout = new QVBoxLayout(); verticalLayout->addWidget(new ErrorViewController()); verticalLayout->addWidget(new LoginWidget()); verticalLayout->addWidget(new TimeEntryListWidget()); verticalLayout->addWidget(new TimeEntryEditorWidget()); verticalLayout->setContentsMargins(0, 0, 0, 0); verticalLayout->setSpacing(0); centralWidget()->setLayout(verticalLayout); readSettings(); connect(TogglApi::instance, SIGNAL(displayApp(bool)), // NOLINT this, SLOT(displayApp(bool))); // NOLINT connect(TogglApi::instance, SIGNAL(displayStoppedTimerState()), // NOLINT this, SLOT(displayStoppedTimerState())); // NOLINT connect(TogglApi::instance, SIGNAL(displayRunningTimerState(TimeEntryView*)), // NOLINT this, SLOT(displayRunningTimerState(TimeEntryView*))); // NOLINT connect(TogglApi::instance, SIGNAL(displayLogin(bool,uint64_t)), // NOLINT this, SLOT(displayLogin(bool,uint64_t))); // NOLINT connect(TogglApi::instance, SIGNAL(displayReminder(QString,QString)), // NOLINT this, SLOT(displayReminder(QString,QString))); // NOLINT connect(TogglApi::instance, SIGNAL(displayUpdate(QString)), // NOLINT this, SLOT(displayUpdate(QString))); // NOLINT connect(TogglApi::instance, SIGNAL(displayOnlineState(int64_t)), // NOLINT this, SLOT(displayOnlineState(int64_t))); // NOLINT hasTrayIconCached = hasTrayIcon(); if (hasTrayIconCached) { icon.addFile(QString::fromUtf8(":/icons/1024x1024/toggldesktop.png")); iconDisabled.addFile(QString::fromUtf8( ":/icons/1024x1024/toggldesktop_gray.png")); trayIcon = new QSystemTrayIcon(this); } connectMenuActions(); enableMenuActions(); if (hasTrayIconCached) { // icon is set in enableMenuActions based on if tracking is in progress trayIcon->show(); } else { setWindowIcon(icon); } }