Kludget::Kludget(KClient *parent) : QObject(parent), client(parent), window(new KWindow), settings(new KSettings(this)), system(new KSystem(this)), prefWindow(0), aboutWindow(0), firstShow(true) { setObjectName("Kludget"); settings->setRootKey("kludget"); connect(system, SIGNAL(execUpdate(long)), this, SLOT(onSystemExecUpdate(long))); connect(system, SIGNAL(execFinish(long)), this, SLOT(onSystemExecFinish(long))); connect(window, SIGNAL(destroyed()), this, SLOT(onWindowDestroyed())); connect(window, SIGNAL(onShow()), this, SLOT(onShow())); connect(window, SIGNAL(onHide()), this, SLOT(onHide())); connect(window, SIGNAL(onStartDrag()), this, SLOT(onStartDrag())); connect(window, SIGNAL(onEndDrag()), this, SLOT(onEndDrag())); connect(window, SIGNAL(onSettingsChanged()), this, SLOT(onSettingsChanged())); connect(window->view(), SIGNAL(contextMenuRequested()), this, SLOT(onContextMenu())); connect(window->view(), SIGNAL(urlReceived(const QUrl*)), this, SLOT(onUrlReceived(const QUrl*))); connect(window->view()->page(), SIGNAL(loadFinished(bool)), this, SLOT(show())); connect(window->view()->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(onJavaScriptWindowObjectCleared())); connect(window->view()->page(), SIGNAL(frameCreated(QWebFrame*)), this, SLOT(onFrameCreated(QWebFrame*))); connect(this, SIGNAL(evaluate(const QString &)), this, SLOT(onEvaluate(const QString &))); connect(&customMenuMapper, SIGNAL(mapped(const QString &)), this, SIGNAL(evaluate(const QString &))); connect(&ipcClient, SIGNAL(messageReceived(QString,QString,QString)), this, SLOT(messageReceived(QString,QString,QString))); KLog::log("Kludget::created"); }
Widget::Widget(const char* wname) : m_settings(wname)//, m_shortcutGrabber(this, m_settings) { setWindowFlags(Qt::ToolTip); setAttribute(Qt::WA_TranslucentBackground); setWindowOpacity(m_settings.get("gui/opacity").toInt() / 100.0); QPropertyAnimation* anim = new QPropertyAnimation(this); anim->setTargetObject(this); m_animation.addAnimation(anim); anim->setEasingCurve(QEasingCurve::Type(m_settings.get("gui/in_animation").toInt())); connect(anim, SIGNAL(finished()), this, SLOT(reverseTrigger())); connectForPosition(m_settings.get("gui/position").toString()); connect(&m_visible, SIGNAL(timeout()), this, SLOT(reverseStart())); m_visible.setSingleShot(true); QHBoxLayout* l = new QHBoxLayout; l->setSizeConstraint(QLayout::SetNoConstraint); l->setMargin(0); l->setContentsMargins(0, 0, 0, 0); setLayout(l); l->addWidget(m_contentView["icon"] = new QLabel); l->addWidget(m_contentView["title"] = new QLabel); l->addWidget(m_contentView["text"] = new QLabel); m_contentView["title"]->setOpenExternalLinks(true); m_contentView["text"]->setOpenExternalLinks(true); setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onHide())); // Let the event loop run QTimer::singleShot(30, this, SLOT(init())); }
UpdateProgressDialog::UpdateProgressDialog(QWidget *parent) : QDialog(parent) { ui.setupUi(this); connect(ui.btnHide, SIGNAL(clicked()), this, SLOT(onHide())); connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(onCancel())); setModal(true); }
void Widget::processRemoteControl(QString command) { if (command == "activate") onActivate(); else if (command == "hide") onHide(); else if (command == "next") onNext(); else if (command == "previous") onPrevious(); }
//-----------------------------------------// MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent, Qt::Window | Qt::WindowMinimizeButtonHint | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint), ui_(std::unique_ptr<Ui::MainWindow>(new Ui::MainWindow)), armsManager_(std::unique_ptr<ArmsManager>(new ArmsManager())), remoteDevicesManager_(std::unique_ptr<RemoteDevicesManager>(new RemoteDevicesManager())) { ui_->setupUi(this); setWindowTitle(QApplication::applicationName()); setWindowIcon(QApplication::windowIcon()); // tray connect(&tray_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(onTrayActivated(QSystemTrayIcon::ActivationReason))); menu_.addAction(tr("Открыть"),this,SLOT(onShow()))->setVisible(false); menu_.setDefaultAction(menu_.addAction(tr("Спрятать"),this,SLOT(onHide()))); menu_.addSeparator(); // menu_.addAction(tr("Лог"),this,SLOT(onShowLog())); // menu_.addAction(tr("Выход"),this,SLOT(onExit())); menu_.addSeparator(); tray_.setContextMenu(&menu_); // movia_.stop(); // movia_.setFileName(":/new/list/LAN.png"); // movia_.start(); // tray_.setIcon(QIcon(movia_.currentPixmap())); tray_.setIcon(QIcon(":/new/list/LAN.png")); tray_.show(); onHide(); assert(armsManager_); armsManager_->init(); tray_.showMessage(QApplication::applicationName(), tr("Программа запущена: порт %1").arg(Settings::value("server/port").toUInt())); }
bool DlgPreferences::eventFilter(QObject* o, QEvent* e) { // Send a close signal if dialog is closing if (e->type() == QEvent::Hide) { onHide(); } if (e->type() == QEvent::Show) { onShow(); } // Standard event processing return QWidget::eventFilter(o,e); }
void GuiElement::setVisible(bool is_visible) { if(visible != is_visible) { visible = is_visible; if(visible) onShow(); else onHide(); } //Else do nothing -- already correct visibility }
//-----------------------------------------// void MainWindow::onTrayActivated(QSystemTrayIcon::ActivationReason reason) { if(reason == QSystemTrayIcon::DoubleClick) { if(isVisible() == true) { onHide(); } else { onShow(); } } }
void DropDownList::realHide() { if (!IsShown()) return; Window::Hide(); onHide(); hideSubMenu(); if (parent_menu) { parent_menu->open_sub_menu = nullptr; } else { redrawArrowOnParent(); // disconnect event handler GetParent() ->RemoveEventHandler(hider2); wxGetTopLevelParent(GetParent())->RemoveEventHandler(hider); } }
void Widget::onActivate() { if (!m_messageQueue.isEmpty()) { if (m_messageQueue.front().data.contains("ac") && m_messageQueue.front().data["ac"]) { QProcess::startDetached(m_messageQueue.front().data["ac"]->toString()); m_messageQueue.front().data["ac"] = ""; } } if(m_messageQueue.size() > 1) { onNext(); } else { onHide(); } }
PianorollTrackView::PianorollTrackView(QWidget *parent) : EditorWidgetBase(parent) { mutex = 0; trackHeight = DEFAULT_TRACK_HEIGHT; trackIndex = 0; ui->mainContent->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); ui->mainContent->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); lyricEdit = new LyricEditWidget(ui->mainContent->viewport()); lyricEdit->setVisible(false); // キーボードのキーの音名を作成 keyNames = new QString[NOTE_MAX - NOTE_MIN + 1]; char *names[] = { "C", "C#", "D", "Eb", "E", "F", "F#", "G", "G#", "A", "Bb", "B" }; for (int noteNumber = NOTE_MIN; noteNumber <= NOTE_MAX; noteNumber++) { int modura = getNoteModuration(noteNumber); int order = getNoteOctave(noteNumber); char *name = names[modura]; ostringstream oss; oss << name << order; keyNames[noteNumber - NOTE_MIN] = QString(oss.str().c_str()); } connect(ui->mainContent, SIGNAL(onMousePress(QMouseEvent *)), this, SLOT(onMousePressSlot(QMouseEvent *))); connect(ui->mainContent, SIGNAL(onMouseMove(QMouseEvent *)), this, SLOT(onMouseMoveSlot(QMouseEvent *))); connect(ui->mainContent, SIGNAL(onMouseRelease(QMouseEvent *)), this, SLOT(onMouseReleaseSlot(QMouseEvent *))); connect(ui->mainContent, SIGNAL(onMouseDoubleClick(QMouseEvent *)), this, SLOT(onMouseDoubleClickSlot(QMouseEvent *))); connect(ui->mainContent->horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(onContentScroll(int))); connect(ui->mainContent->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(onContentScroll(int))); connect(lyricEdit, SIGNAL(onCommit()), this, SLOT(onLyricEditCommitSlot())); connect(lyricEdit, SIGNAL(onHide()), this, SLOT(onLyricEditHideSlot())); connect(lyricEdit, SIGNAL(onMove(bool)), this, SLOT(onLyricEditMoveSlot(bool))); }
void AreaSettingsDialog::closeEvent(QCloseEvent *event) { Q_UNUSED(event); emit onHide(); saveGeometry(); }
int main(int argc, char ** argv) { QApplication app(argc, argv); MaliitKeyboard::Dashboard *dashboard = new MaliitKeyboard::Dashboard; dashboard->show(); MaliitKeyboard::Renderer renderer; // renderer.setSurfaceFactory(dashboard); dashboard->setRenderer(&renderer); MaliitKeyboard::Glass glass; // glass.setWindow(renderer.viewport()); // One layout updater can only manage one layout. If more layouts need to // be managed, then more layout updaters are required. MaliitKeyboard::LayoutUpdater lu0; MaliitKeyboard::SharedLayout l0(new MaliitKeyboard::Layout); l0->setAlignment(MaliitKeyboard::Layout::Bottom); l0->setScreenSize(dashboard->size()); MaliitKeyboard::Font font; font.setColor(QByteArray("#ddd")); font.setSize(20); MaliitKeyboard::WordRibbon ribbon; MaliitKeyboard::Area area; area.setBackground(QByteArray("key-background.png")); area.setBackgroundBorders(QMargins(10, 10, 10, 10)); area.setSize(QSize(856, 40)); ribbon.setArea(area); l0->setWordRibbon(ribbon); renderer.addLayout(l0); glass.addLayout(l0); lu0.setLayout(l0); MaliitKeyboard::SharedLayout l1(new MaliitKeyboard::Layout); l1->setAlignment(MaliitKeyboard::Layout::Top); l1->setScreenSize(dashboard->size()); renderer.addLayout(l1); glass.addLayout(l1); MaliitKeyboard::LayoutUpdater lu1; lu1.setLayout(l1); MaliitKeyboard::Logic::WordEngine word_engine; DefaultFeedback feedback; MaliitKeyboard::Setup::connectAll(&glass, &lu0, &renderer, dashboard->editor(), &word_engine, &feedback); MaliitKeyboard::Setup::connectGlassToLayoutUpdater(&glass, &lu1); MaliitKeyboard::Setup::connectLayoutUpdaterToRenderer(&lu1, &renderer); QObject::connect(&glass, SIGNAL(keyboardClosed()), dashboard, SLOT(onHide())); QObject::connect(dashboard, SIGNAL(orientationChanged(Layout::Orientation)), &lu0, SLOT(setOrientation(Layout::Orientation))); QObject::connect(dashboard, SIGNAL(orientationChanged(Layout::Orientation)), &lu1, SLOT(setOrientation(Layout::Orientation))); QObject::connect(&glass, SIGNAL(keyboardClosed()), dashboard, SIGNAL(keyboardClosed())); QObject::connect(dashboard, SIGNAL(keyboardClosed()), &lu0, SLOT(resetOnKeyboardClosed())); QObject::connect(dashboard, SIGNAL(keyboardClosed()), &lu1, SLOT(resetOnKeyboardClosed())); QObject::connect(dashboard, SIGNAL(keyboardClosed()), &renderer, SLOT(hide())); QObject::connect(dashboard, SIGNAL(keyboardClosed()), dashboard, SLOT(onHide())); // Allow to specify keyboard id via command line: QString keyboard_id("en_gb"); bool found_keyboard_id = false; Q_FOREACH (const QString &arg, QApplication::arguments()) { if (found_keyboard_id && not arg.isEmpty()) { keyboard_id = arg; } if (arg == "--id" || arg == "-id") { found_keyboard_id = true; } } lu0.setActiveKeyboardId(keyboard_id); lu1.setActiveKeyboardId("toolbar"); renderer.show(); return app.exec(); }
void Kludget::hide() { onHide(); window->hide(); }