MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), config_(kimai::paths::dataFolder() + "Config.ini") { ui->setupUi(this); configDialog_ = NULL; setWindowTitle("Kimai"); QWebSettings* webSettings = QWebSettings::globalSettings(); webSettings->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true); webSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); jsBridge_ = new KimaiJavaScriptBridge(this); connect(ui->webView, SIGNAL(loadFinished(bool)), this, SLOT(webView_loadFinished(bool))); connect(ui->webView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(mainFrame_javaScriptWindowObjectCleared())); connect(ui->actionConfiguration, SIGNAL(triggered()), this, SLOT(menuBar_configuration_triggered())); connect(&config_, SIGNAL(valueChanged(QString)), this, SLOT(config_valueChanged(QString))); QVariant kimaiUrl = config_.value("kimaiUrl"); if (kimaiUrl.isNull() || kimaiUrl.toString().trimmed().isEmpty()) { QMessageBox::information(this, "Kimai URL not set", "No Kimai URL set. Please set it in the configuration dialog."); showConfigDialog(); } else { ui->webView->load(QUrl(kimaiUrl.toString())); } QSettings settings("Kimai", "Kimai Desktop Client"); QVariant geometry = settings.value("kimai/windowGeometry"); if (!geometry.isNull()) restoreGeometry(geometry.toByteArray()); }
void soundKonverter::setupActions() { KStandardAction::quit( this, SLOT(close()), actionCollection() ); KStandardAction::preferences( this, SLOT(showConfigDialog()), actionCollection() ); KAction *logviewer = actionCollection()->addAction("logviewer"); logviewer->setText(i18n("View logs...")); logviewer->setIcon(KIcon("view-list-text")); connect( logviewer, SIGNAL(triggered()), this, SLOT(showLogViewer()) ); KAction *replaygainscanner = actionCollection()->addAction("replaygainscanner"); replaygainscanner->setText(i18n("Replay Gain tool...")); replaygainscanner->setIcon(KIcon("soundkonverter-replaygain")); connect( replaygainscanner, SIGNAL(triggered()), this, SLOT(showReplayGainScanner()) ); KAction *aboutplugins = actionCollection()->addAction("aboutplugins"); aboutplugins->setText(i18n("About plugins...")); aboutplugins->setIcon(KIcon("preferences-plugin")); connect( aboutplugins, SIGNAL(triggered()), this, SLOT(showAboutPlugins()) ); KAction *add_files = actionCollection()->addAction("add_files"); add_files->setText(i18n("Add files...")); add_files->setIcon(KIcon("audio-x-generic")); connect( add_files, SIGNAL(triggered()), m_view, SLOT(showFileDialog()) ); KAction *add_folder = actionCollection()->addAction("add_folder"); add_folder->setText(i18n("Add folder...")); add_folder->setIcon(KIcon("folder")); connect( add_folder, SIGNAL(triggered()), m_view, SLOT(showDirDialog()) ); KAction *add_audiocd = actionCollection()->addAction("add_audiocd"); add_audiocd->setText(i18n("Add CD tracks...")); add_audiocd->setIcon(KIcon("media-optical-audio")); connect( add_audiocd, SIGNAL(triggered()), m_view, SLOT(showCdDialog()) ); KAction *add_url = actionCollection()->addAction("add_url"); add_url->setText(i18n("Add url...")); add_url->setIcon(KIcon("network-workgroup")); connect( add_url, SIGNAL(triggered()), m_view, SLOT(showUrlDialog()) ); KAction *add_playlist = actionCollection()->addAction("add_playlist"); add_playlist->setText(i18n("Add playlist...")); add_playlist->setIcon(KIcon("view-media-playlist")); connect( add_playlist, SIGNAL(triggered()), m_view, SLOT(showPlaylistDialog()) ); KAction *load = actionCollection()->addAction("load"); load->setText(i18n("Load file list")); load->setIcon(KIcon("document-open")); connect( load, SIGNAL(triggered()), m_view, SLOT(loadFileList()) ); KAction *save = actionCollection()->addAction("save"); save->setText(i18n("Save file list")); save->setIcon(KIcon("document-save")); connect( save, SIGNAL(triggered()), m_view, SLOT(saveFileList()) ); actionCollection()->addAction("start", m_view->start()); actionCollection()->addAction("stop_menu", m_view->stopMenu()); }
Dialog::Dialog(QWidget *parent) : QDialog(parent, Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint), ui(new Ui::Dialog), mSettings(new RazorSettings("razor-runner", this)), mGlobalShortcut(new QxtGlobalShortcut(this)) { ui->setupUi(this); setWindowTitle("Razor Runner"); connect(RazorSettings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(update())); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide())); connect(mSettings, SIGNAL(settingsChanged()), this, SLOT(applySettings())); ui->commandEd->installEventFilter(this); connect(ui->commandEd, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString))); connect(ui->commandEd, SIGNAL(returnPressed()), this, SLOT(runCommand())); mCommandItemModel = new CommandItemModel(this); ui->commandList->installEventFilter(this); ui->commandList->setModel(mCommandItemModel); ui->commandList->setEditTriggers(QAbstractItemView::NoEditTriggers); connect(ui->commandList, SIGNAL(clicked(QModelIndex)), this, SLOT(runCommand())); setFilter(""); ui->commandList->setItemDelegate(new HtmlDelegate(QSize(32, 32), ui->commandList)); connect(mGlobalShortcut, SIGNAL(activated()), this, SLOT(showHide())); // Popup menu ............................... QAction *a = new QAction(XdgIcon::fromTheme("configure"), tr("Configure razor-runner"), this); connect(a, SIGNAL(triggered()), this, SLOT(showConfigDialog())); addAction(a); a = new QAction(XdgIcon::fromTheme("edit-clear-history"), tr("Clear razor-runner History"), this); connect(a, SIGNAL(triggered()), mCommandItemModel, SLOT(clearHistory())); addAction(a); mPowerManager = new PowerManager(this); addActions(mPowerManager->availableActions()); mScreenSaver = new ScreenSaver(this); addActions(mScreenSaver->availableActions()); setContextMenuPolicy(Qt::ActionsContextMenu); QMenu *menu = new QMenu(this); menu->addActions(actions()); ui->actionButton->setMenu(menu); ui->actionButton->setIcon(XdgIcon::fromTheme("configure")); // End of popup menu ........................ applySettings(); resize(mSettings->value("dialog/width", 400).toInt(), size().height()); }
void KonferencePart::setupActions() { ( void ) new KAction( i18n( "&Configure Konference" ), "configure", 0, this, SLOT( showConfigDialog() ), actionCollection(), "config" ); m_connectAction = new KAction( i18n( "C&onnect" ), "connect_creating", 0, this, SLOT( connectClicked() ), actionCollection(), "connect" ); m_cancelAction = new KAction( i18n( "&Stop connection" ), "button_cancel", 0, this, SLOT( cancelClicked() ), actionCollection(), "stop" ); m_cancelAction->setEnabled( false ); m_locationAction = new KWidgetAction( m_location, i18n( "&Location" ), CTRL + Key_L, this, SLOT( textEntered() ), actionCollection(), "location" ); m_locationAction->setAutoSized( true ); }
Dialog::Dialog(QWidget *parent) : QDialog(parent, Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint), ui(new Ui::Dialog), mSettings(new RazorSettings("razor-runner", this)), mGlobalShortcut(new QxtGlobalShortcut(this)), mCommandItemModel(new CommandItemModel(this)) { ui->setupUi(this); setStyleSheet(razorTheme->qss("razor-runner/razor-runner")); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide())); connect(mSettings, SIGNAL(settigsChanged()), this, SLOT(applySettings())); ui->commandEd->installEventFilter(this); ui->commandEd->setInsertPolicy(QComboBox::NoInsert); ui->commandEd->setCompleter(0); connect(ui->commandEd, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString))); connect(ui->commandEd->lineEdit(), SIGNAL(returnPressed()), this, SLOT(runCommand())); ui->commandList->installEventFilter(this); ui->commandList->setModel(mCommandItemModel); ui->commandList->setEditTriggers(QAbstractItemView::NoEditTriggers); connect(ui->commandList, SIGNAL(clicked(QModelIndex)), this, SLOT(runCommand())); setFilter(""); ui->commandList->setItemDelegate(new HtmlDelegate(QSize(32, 32), ui->commandList)); connect(mGlobalShortcut, SIGNAL(activated()), this, SLOT(showHide())); // Popup menu ............................... QAction *a = new QAction(XdgIcon::fromTheme("configure"), tr("Configure razor-runner"), this); connect(a, SIGNAL(triggered()), this, SLOT(showConfigDialog())); addAction(a); setContextMenuPolicy(Qt::ActionsContextMenu); // End of popup menu ........................ applySettings(); resize(mSettings->value("dialog/width", 400).toInt(), size().height()); XdgIcon::setThemeName(RazorSettings::globalSettings()->value("icon_theme").toString()); connect(RazorSettings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(update())); }
void MainWindow::menuBar_configuration_triggered() { showConfigDialog(); }
void MainWindow::setupGui() { model = new TreeModel(this); model->addSection(i18n("Overdue"), -1 ); model->addSection(i18n("Today"), 0); model->addSection(i18n("Tomorrow"), 1 ); model->addSection(i18n("Next week"), 7); model->addSection(i18n("Next month"), 31); model->addSection(i18n("Future"), -2); filterModel = new FilterModel(this); filterModel->setSourceModel(model); view = new QTreeView(this); delegate = new TodoDelegate(view, this); view->setModel(filterModel); view->setHeaderHidden(true); view->setIconSize(QSize(0,0)); view->setAnimated(true); view->setStyleSheet("QTreeView::branch{border-image: none; image: none;border-left: 0px;}"); view->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); view->setEditTriggers(QAbstractItemView::AllEditTriggers); //view->setTabKeyNavigation(true); view->setSelectionMode(QAbstractItemView::SingleSelection); view->setSelectionBehavior(QAbstractItemView::SelectRows); view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); view->setRootIsDecorated(false); view->setSortingEnabled(false); view->setAllColumnsShowFocus(true); view->setExpandsOnDoubleClick(true); view->header()->setStretchLastSection(false); view->header()->setResizeMode(0,QHeaderView::Stretch); view->setItemDelegate(delegate); view->setContextMenuPolicy(Qt::CustomContextMenu); doEdit = new KLineEdit(this); doEdit->setClickMessage(i18n("new task...")); view->setFocusProxy(doEdit); // doAddBtn = new KPushButton(KIcon("list-add"),"",this); doAddBtn = new QToolButton(); doAddBtn->setIcon(KIcon("list-add")); doAddBtn->setIconSize(QSize(35,35)); timeBox = new KComboBox(this); timeBox->addItem(i18n("Today")); timeBox->addItem(i18n("Tomorrow")); timeBox->addItem(i18n("Next Monday")); timeBox->addItem(i18n("Next Tuesday")); timeBox->addItem(i18n("Next Wednesday")); timeBox->addItem(i18n("Next Thursday")); timeBox->addItem(i18n("Next Friday")); timeBox->addItem(i18n("Next Saturday")); timeBox->addItem(i18n("Next Sunday")); timeBox->addItem(i18n("Future")); timeBox->setFocusProxy(doEdit); addSelectCatBox = new KComboBox(this); for( int i=0; i<Settings::self()->categories()->count(); i++ ){ addSelectCatBox->addItem(Settings::self()->categories()->at(i)); } addSelectCatBox->setCurrentIndex(0); addSelectCatBox->setFocusProxy(doEdit); addLayout = new QGridLayout; addLayout->addWidget(doEdit, 0,0,1,2); addLayout->addWidget(timeBox, 1,0); addLayout->addWidget(addSelectCatBox, 1, 1); addLayout->addWidget(doAddBtn, 0,2,2,1); categoryBox = new KComboBox(); categoryBox->addItem(i18nc("category, show all items", "All")); for( int i=0; i<Settings::self()->categories()->count(); i++ ){ categoryBox->addItem(Settings::self()->categories()->at(i)); } doneBtn = new KPushButton(KIcon("edit-delete"),i18n("Remove")); editBtn = new KPushButton(KIcon("document-edit"),i18n("Edit")); bottomLayout = new QHBoxLayout; bottomLayout->addWidget(categoryBox); bottomLayout->addStretch(); bottomLayout->addWidget(editBtn); bottomLayout->addWidget(doneBtn); mainLayout = new QVBoxLayout; mainLayout->addLayout(addLayout); mainLayout->addWidget(view); mainLayout->addLayout(bottomLayout); mainWidget = new QWidget(this); mainWidget->setLayout(mainLayout); setCentralWidget(mainWidget); setWindowTitle("DoBeeDo"); doneAct = new KAction(KIcon("edit-delete"),i18n("Remove"), this); editAct = new KAction(KIcon("document-edit"),i18n("Edit"), this); configAct = new KAction(KIcon("configure"),i18n("Configure DoBeeDo"),this); actionCollection()->addAction("done", doneAct); actionCollection()->addAction("edit", editAct); actionCollection()->addAction("configDobeedo", configAct); KStandardAction::quit( kapp, SLOT(quit()), actionCollection() ); KXmlGuiWindow::setupGUI(Default, "dobeedoui.rc"); connect( view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)) ); connect( view, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(editTodo()) ); connect( doEdit, SIGNAL(returnPressed()), doAddBtn, SLOT(animateClick()) ); connect( doAddBtn, SIGNAL(clicked()), this, SLOT(newTodo()) ); connect( doneAct, SIGNAL(triggered()), this, SLOT(removeTodo()) ); connect( doneBtn, SIGNAL(clicked()), this, SLOT(removeTodo()) ); connect( editAct, SIGNAL(triggered()), this, SLOT(editTodo()) ); connect( editBtn, SIGNAL(clicked()), this, SLOT(editTodo()) ); connect( categoryBox, SIGNAL(currentIndexChanged(int)), this, SLOT(showCat(int)) ); connect( categoryBox, SIGNAL(currentIndexChanged(int)), view, SLOT(expandAll()) ); connect( configAct, SIGNAL(triggered()), this, SLOT(showConfigDialog()) ); }
Dialog::Dialog(QWidget *parent) : QDialog(parent, Qt::Tool | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint), ui(new Ui::Dialog), mSettings(new LxQt::Settings("lxqt-runner", this)), mGlobalShortcut(0), mLockCascadeChanges(false), mConfigureDialog(0) { ui->setupUi(this); setWindowTitle("LXQt Runner"); setAttribute(Qt::WA_TranslucentBackground); connect(LxQt::Settings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(update())); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide())); connect(mSettings, SIGNAL(settingsChanged()), this, SLOT(applySettings())); ui->commandEd->installEventFilter(this); connect(ui->commandEd, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString))); connect(ui->commandEd, SIGNAL(returnPressed()), this, SLOT(runCommand())); mCommandItemModel = new CommandItemModel(this); ui->commandList->installEventFilter(this); ui->commandList->setModel(mCommandItemModel); ui->commandList->setEditTriggers(QAbstractItemView::NoEditTriggers); connect(ui->commandList, SIGNAL(clicked(QModelIndex)), this, SLOT(runCommand())); setFilter(""); dataChanged(); ui->commandList->setItemDelegate(new LxQt::HtmlDelegate(QSize(32, 32), ui->commandList)); // Popup menu ............................... QAction *a = new QAction(XdgIcon::fromTheme("configure"), tr("Configure"), this); connect(a, SIGNAL(triggered()), this, SLOT(showConfigDialog())); addAction(a); a = new QAction(XdgIcon::fromTheme("edit-clear-history"), tr("Clear History"), this); connect(a, SIGNAL(triggered()), mCommandItemModel, SLOT(clearHistory())); addAction(a); mPowerManager = new LxQt::PowerManager(this); addActions(mPowerManager->availableActions()); mScreenSaver = new LxQt::ScreenSaver(this); addActions(mScreenSaver->availableActions()); setContextMenuPolicy(Qt::ActionsContextMenu); QMenu *menu = new QMenu(this); menu->addActions(actions()); ui->actionButton->setMenu(menu); ui->actionButton->setIcon(XdgIcon::fromTheme("configure")); // End of popup menu ........................ applySettings(); connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), SLOT(realign())); connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(realign())); connect(mGlobalShortcut, SIGNAL(activated()), this, SLOT(showHide())); connect(mGlobalShortcut, SIGNAL(shortcutChanged(QString,QString)), this, SLOT(shortcutChanged(QString,QString))); resize(mSettings->value("dialog/width", 400).toInt(), size().height()); // TEST connect(mCommandItemModel, SIGNAL(layoutChanged()), this, SLOT(dataChanged())); }