/* Setup common to all constructors */ void QELabel::setup() { // Set up data // This control used a single data source setNumVariables(1); // Set up default properties setAllowDrop( false ); // Set the initial state setText( "----" ); setIndent( 6 ); isConnected = false; updateConnectionStyle( isConnected ); updateOption = UPDATE_TEXT; // Use standard context menu setupContextMenu(); // defaultStyleSheet = styleSheet(); // Use label signals // --Currently none-- // Set up a connection to recieve variable name property changes // The variable name property manager class only delivers an updated variable name after the user has stopped typing QObject::connect( &variableNamePropertyManager, SIGNAL( newVariableNameProperty( QString, QString, unsigned int ) ), this, SLOT( useNewVariableNameProperty( QString, QString, unsigned int) ) ); }
ClientRegisterDialog::ClientRegisterDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ClientRegisterDialog) { ui->setupUi(this); setupContextMenu(); }
/* Common construction */ void QESpinBox::setup() { // Set up data // This control used a single data source setNumVariables(1); // Initialise the flag indicating the value is being changed programatically (not by the user) programaticValueChange = false; // Set up default properties writeOnChange = true; setAllowDrop( false ); addUnitsAsSuffix = false; useDbPrecisionForDecimal = true; // Set the initial state lastValue = 0.0; isConnected = false; ignoreSingleShotRead = false; // Use standard context menu setupContextMenu(); // Use spin box signals QObject::connect( this, SIGNAL( valueChanged( double ) ), this, SLOT( userValueChanged( double ) ) ); // Set up a connection to recieve variable name property changes // The variable name property manager class only delivers an updated variable name after the user has stopped typing QObject::connect( &variableNamePropertyManager, SIGNAL( newVariableNameProperty( QString, QString, unsigned int ) ), this, SLOT( useNewVariableNameProperty( QString, QString, unsigned int) ) ); }
void Application::slotNoOwnCloudFound( QNetworkReply* reply ) { qDebug() << "** Application: NO ownCloud found!"; QString msg; if( reply ) { QString url( reply->url().toString() ); url.remove( QLatin1String("/status.php") ); msg = tr("<p>The %1 at %2 could not be reached.</p>").arg(_theme->appName()).arg( url ); msg += tr("<p>The detailed error message is<br/><tt>%1</tt></p>").arg( reply->errorString() ); } msg += tr("<p>Please check your configuration by clicking on the tray icon.</p>"); QMessageBox::warning(0, tr("%1 Connection Failed").arg(_theme->appName()), msg ); _actionAddFolder->setEnabled( false ); // Disconnect. disconnect( ownCloudInfo::instance(),SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)), this, SLOT(slotOwnCloudFound(QString,QString,QString,QString))); disconnect( ownCloudInfo::instance(),SIGNAL(noOwncloudFound(QNetworkReply*)), this, SLOT(slotNoOwnCloudFound(QNetworkReply*))); disconnect( ownCloudInfo::instance(),SIGNAL(ownCloudDirExists(QString,QNetworkReply*)), this,SLOT(slotAuthCheck(QString,QNetworkReply*))); setupContextMenu(); }
// - Application constructor ItemWidget::ItemWidget(QWidget *parent, XDGDesktop item) : QFrame(parent){ createWidget(); isDirectory = false; if(LUtils::isFavorite(item.filePath)){ linkPath = item.filePath; isShortcut=true; }else if( item.filePath.section("/",0,-2)==QDir::homePath()+"/Desktop" ){ isShortcut = true; }else{ isShortcut = false; } if(isShortcut){ name->setToolTip(icon->whatsThis()); //also allow the user to see the full shortcut path } //Now fill it appropriately icon->setPixmap( LXDG::findIcon(item.icon,"preferences-system-windows-actions").pixmap(64,64) ); text = item.name; if(!item.genericName.isEmpty() && item.name!=item.genericName){ text.append("<br><i> -- "+item.genericName+"</i>"); } name->setText(text); name->setToolTip(item.comment); this->setWhatsThis(item.name); icon->setWhatsThis(item.filePath); iconPath = item.icon; //Now setup the buttons appropriately setupContextMenu(); setupActions(item); }
/* Setup common to all constructors */ void QESlider::setup() { // Set up data // This control used a single data source setNumVariables(1); // Set up default properties updateInProgress = false; writeOnChange = true; setAllowDrop( false ); scale = 1.0; offset = 0.0; currentValue = 0.0; // Set the initial state isConnected = false; ignoreSingleShotRead = false; // Use standard context menu setupContextMenu(); // Use slider signals QObject::connect( this, SIGNAL( valueChanged( const int &) ), this, SLOT( userValueChanged( const int & ) ) ); // Set up a connection to recieve variable name property changes // The variable name property manager class only delivers an updated variable name after the user has stopped typing QObject::connect( &variableNamePropertyManager, SIGNAL( newVariableNameProperty( QString, QString, unsigned int ) ), this, SLOT( useNewVariableNameProperty( QString, QString, unsigned int ) ) ); }
/* Setup for starting new GUIs */ void QEGenericButton::guiSetup() { // Set default properties creationOption = QEActionRequests::OptionOpen; // Use standard context menu setupContextMenu(); // If a profile is define by whatever contains the button, use it if( isProfileDefined() ) { // Setup a signal to launch a new gui // The signal will be used by whatever the button is in QObject* launcher = getGuiLaunchConsumer(); if( launcher ) { QObject::connect( getButtonQObject(), SIGNAL( newGui( const QEActionRequests& ) ), launcher, SLOT( requestAction( const QEActionRequests& ) ) ); } } // A profile is not already defined, create one. This is the case if this class is used by an application that does not set up a profile, such as 'designer'. else { // Set up the button's own gui form launcher QObject::connect( getButtonQObject(), SIGNAL( newGui( const QEActionRequests& ) ), getButtonQObject(), SLOT( requestAction( const QEActionRequests& ) ) ); } }
UserphraseView::UserphraseView(QWidget *parent) :QListView{parent} ,UserphraseDialog_{new UserphraseDialog{this}} ,menu_(new UserphraseViewMenu{this}) ,originalPhrase{new QString()} ,originalBopomofo{new QString()} { setupContextMenu(); setupAddUserphraseDialog(); // setup double click connect( this, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(showModifyUserphraseDialog()) ); }
CurvePresenter::CurvePresenter(CurveModel* model, CurveView* view, QObject* parent): QObject{parent}, m_model{model}, m_view{view}, m_commandDispatcher{iscore::IDocument::documentFromObject(*model)->commandStack()}, m_selectionDispatcher{iscore::IDocument::documentFromObject(*model)->selectionStack()} { // For each segment in the model, create a segment and relevant points in the view. // If the segment is linked to another, the point is shared. setupView(); setupContextMenu(); setupSignals(); m_sm = new CurveStateMachine{*this, this}; }
CallStackView::CallStackView(StdTable* parent) : StdTable(parent) { int charwidth = getCharWidth(); addColumnAt(8 + charwidth * sizeof(dsint) * 2, tr("Address"), true); //address in the stack addColumnAt(8 + charwidth * sizeof(dsint) * 2, tr("To"), true); //return to addColumnAt(8 + charwidth * sizeof(dsint) * 2, tr("From"), true); //return from addColumnAt(0, tr("Comment"), true); loadColumnFromConfig("CallStack"); connect(Bridge::getBridge(), SIGNAL(updateCallStack()), this, SLOT(updateCallStack())); connect(this, SIGNAL(contextMenuSignal(QPoint)), this, SLOT(contextMenuSlot(QPoint))); connect(this, SIGNAL(doubleClickedSignal()), this, SLOT(followTo())); setupContextMenu(); }
SpreadSheet::SpreadSheet(int rows, int cols, QWidget *parent) : QMainWindow(parent) { addToolBar(toolBar = new QToolBar()); formulaInput = new QLineEdit(); cellLabel = new QLabel(toolBar); cellLabel->setMinimumSize(80, 0); toolBar->addWidget(cellLabel); toolBar->addWidget(formulaInput); table = new QTableWidget(rows, cols, this); table->setSizeAdjustPolicy(QTableWidget::AdjustToContents); for (int c = 0; c < cols; ++c) { QString character(QChar('A' + c)); table->setHorizontalHeaderItem(c, new QTableWidgetItem(character)); } table->setItemPrototype(table->item(rows - 1, cols - 1)); table->setItemDelegate(new SpreadSheetDelegate()); createActions(); updateColor(0); setupMenuBar(); setupContents(); setupContextMenu(); setCentralWidget(table); statusBar(); connect(table, SIGNAL(currentItemChanged(QTableWidgetItem*,QTableWidgetItem*)), this, SLOT(updateStatus(QTableWidgetItem*))); connect(table, SIGNAL(currentItemChanged(QTableWidgetItem*,QTableWidgetItem*)), this, SLOT(updateColor(QTableWidgetItem*))); connect(table, SIGNAL(currentItemChanged(QTableWidgetItem*,QTableWidgetItem*)), this, SLOT(updateLineEdit(QTableWidgetItem*))); connect(table, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(updateStatus(QTableWidgetItem*))); connect(formulaInput, SIGNAL(returnPressed()), this, SLOT(returnPressed())); connect(table, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(updateLineEdit(QTableWidgetItem*))); setWindowTitle(tr("Spreadsheet")); }
//------------------------------------------------------------------------------ // Setup common to all constructors // void QEGenericEdit::setup() { // Set up data // This control used a single data source setNumVariables( 1 ); // Set variable index used to select write access cursor style. setControlPV( 0 ); // Set up default properties writeOnLoseFocus = false; writeOnEnter = true; writeOnFinish = true; confirmWrite = false; isFirstUpdate = false; setAllowDrop( false ); // Set the initial state isConnected = false; messageDialogPresent = false; writeFailMessageDialogPresent = false; // Use standard context menu setupContextMenu(); // Use line edit signals QObject::connect( this, SIGNAL( returnPressed () ), this, SLOT ( userReturnPressed () ) ); QObject::connect( this, SIGNAL( editingFinished () ), this, SLOT ( userEditingFinished () ) ); // Set up a connection to recieve variable name property changes // The variable name property manager class only delivers an updated // variable name after the user has stopped typing. // QObject::connect( &variableNamePropertyManager, SIGNAL( newVariableNameProperty( QString, QString, unsigned int ) ), this, SLOT( useNewVariableNameProperty( QString, QString, unsigned int) ) ); }
void Application::slotNoOwnCloudFound( QNetworkReply* reply ) { Q_UNUSED(reply) qDebug() << "** Application: NO ownCloud found! Going offline"; _actionAddFolder->setEnabled( false ); // Disconnect. disconnect( ownCloudInfo::instance(),SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)), this, SLOT(slotOwnCloudFound(QString,QString,QString,QString))); disconnect( ownCloudInfo::instance(),SIGNAL(noOwncloudFound(QNetworkReply*)), this, SLOT(slotNoOwnCloudFound(QNetworkReply*))); disconnect( ownCloudInfo::instance(),SIGNAL(ownCloudDirExists(QString,QNetworkReply*)), this,SLOT(slotAuthCheck(QString,QNetworkReply*))); setupContextMenu(); QTimer::singleShot( 30*1000, this, SLOT( slotStartFolderSetup() )); }
void KupDaemon::setupGuiStuff() { // timer to update logged time and also trigger warning if too long // time has now passed since last backup mUsageAccumulatorTimer = new QTimer(this); mUsageAccumulatorTimer->setInterval(KUP_USAGE_MONITOR_INTERVAL_S * 1000); mUsageAccumulatorTimer->start(); KIdleTime::instance()->addIdleTimeout(KUP_IDLE_TIMEOUT_S * 1000); connect(KIdleTime::instance(), SIGNAL(timeoutReached(int)), mUsageAccumulatorTimer, SLOT(stop())); connect(KIdleTime::instance(), SIGNAL(timeoutReached(int)), KIdleTime::instance(), SLOT(catchNextResumeEvent())); connect(KIdleTime::instance(), SIGNAL(resumingFromIdle()), mUsageAccumulatorTimer, SLOT(start())); setupTrayIcon(); setupExecutors(); setupContextMenu(); updateTrayIcon(); QDBusConnection lDBus = QDBusConnection::sessionBus(); if(lDBus.isConnected()) { if(lDBus.registerService(KUP_DBUS_SERVICE_NAME)) { lDBus.registerObject(KUP_DBUS_OBJECT_PATH, this, QDBusConnection::ExportAllSlots); } } }
void ownCloudGui::slotAccountStateChanged() { setupContextMenu(); slotComputeOverallSyncStatus(); }
ItemWidget::ItemWidget(QWidget *parent, QString itemPath, QString type, bool goback) : QFrame(parent){ createWidget(); //Now fill it appropriately bool inHome = type.endsWith("-home"); //internal code if(inHome){ type = type.remove("-home"); } if(itemPath.endsWith(".desktop") || type=="app"){ bool ok = false; XDGDesktop item = LXDG::loadDesktopFile(itemPath, ok); if(ok && LXDG::checkValidity(item) ){ icon->setPixmap( LXDG::findIcon(item.icon, "preferences-system-windows-actions").pixmap(32,32) ); iconPath = item.icon; text = item.name; if(!item.genericName.isEmpty() && item.name!=item.genericName){ text.append("<br><i> -- "+item.genericName+"</i>"); } name->setText(text); name->setToolTip(item.comment); setupActions(item); }else{ gooditem = false; return; } }else if(type=="dir"){ actButton->setVisible(false); if(itemPath.endsWith("/")){ itemPath.chop(1); } if(goback){ icon->setPixmap( LXDG::findIcon("go-previous","").pixmap(64,64) ); iconPath = "go-previous"; text = tr("Go Back"); name->setText( text ); }else{ icon->setPixmap( LXDG::findIcon("folder","").pixmap(64,64) ); iconPath = "folder"; name->setText( itemPath.section("/",-1)); text = itemPath.section("/",-1); } }else if(type.startsWith("chcat::::")){ //Category given actButton->setVisible(false); iconPath = LXDG::DesktopCatToIcon(type.section("::::",1,50)); if(goback){ iconPath = "go-previous"; type = "chcat::::"; itemPath = "<B>("+itemPath+")</B>"; } icon->setPixmap( LXDG::findIcon(iconPath,"applications-other").pixmap(64,64) ); name->setText(itemPath); text = itemPath; icon->setWhatsThis(type); linkPath = type; }else{ actButton->setVisible(false); if(itemPath.endsWith("/")){ itemPath.chop(1); } if(QFileInfo(itemPath).isDir()){ type = "dir"; icon->setPixmap( LXDG::findIcon("folder","").pixmap(64,64) ); iconPath = "folder"; }else if(LUtils::imageExtensions().contains(itemPath.section("/",-1).section(".",-1).toLower()) ){ icon->setPixmap( QIcon(itemPath).pixmap(64,64) ); }else{ icon->setPixmap( LXDG::findMimeIcon(itemPath.section("/",-1)).pixmap(64,64) ); } name->setText( itemPath.section("/",-1) ); //this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) ); text = itemPath.section("/",-1) ; } icon->setWhatsThis(itemPath); if(!goback){ this->setWhatsThis(name->text()); } isDirectory = (type=="dir"); //save this for later if(LUtils::isFavorite(itemPath)){ linkPath = itemPath; isShortcut=true; }else if( inHome ){//|| itemPath.section("/",0,-2)==QDir::homePath()+"/Desktop" ){ isShortcut = true; }else{ isShortcut = false; } if(isShortcut && name->toolTip().isEmpty()){ name->setToolTip(icon->whatsThis()); //also allow the user to see the full shortcut path } //Now setup the button appropriately setupContextMenu(); }
/* Setup common to all constructors */ void QEPeriodic::setup() { // Place element selection button to left, and readback label on right layout = new QHBoxLayout; layout->setContentsMargins(0, 0, 0, 0); setLayout(layout); // Note the variables associated with the write element button writeButtonData.variableIndex1 = 0; writeButtonData.variableIndex2 = 1; // Note the variables associated with the element readback label readbackLabelData.variableIndex1 = 2; readbackLabelData.variableIndex2 = 3; // Default to just a write element button writeButton = NULL; readbackLabel = NULL; presentationOption = PRESENTATION_BUTTON_ONLY; updatePresentationOptions(); // Set up data // This control uses: // A pair of values to read and write an 'element' set point // A pair of values to read 'element' readback setNumVariables(4); // Set variable indices used to select write access cursor style. ControlVariableIndicesSet controlPvs; controlPvs << 0 << 1; setControlPVs( controlPvs ); // Override default QEWidget and QPushButton properties subscribe = false; // Set up default properties localEnabled = true; variableTolerance1 = 0.1; variableTolerance2 = 0.1; setAllowDrop( false ); // Set the initial state isConnected = false; variableType1 = VARIABLE_TYPE_USER_VALUE_1; variableType2 = VARIABLE_TYPE_USER_VALUE_2; // Use standard context menu setupContextMenu(); // !! move this functionality into QEWidget??? // !! needs one for single variables and one for multiple variables, or just the multiple variable one for all // for each variable name property manager, set up an index to identify it when it signals and // set up a connection to recieve variable name property changes. // The variable name property manager class only delivers an updated variable name after the user has stopped typing for( int i = 0; i < QEPERIODIC_NUM_VARIABLES; i++ ) { variableNamePropertyManagers[i].setVariableIndex( i ); QObject::connect( &variableNamePropertyManagers[i], SIGNAL( newVariableNameProperty( QString, QString, unsigned int ) ), this, SLOT( useNewVariableNameProperty( QString, QString, unsigned int ) ) ); } }
bool Kludget::loadSettings(const KludgetInfo &i, bool loadPage) { info = i; #if 1 qDebug("path: %s", qPrintable(info.path)); qDebug("name: %s", qPrintable(info.name)); qDebug("config: %s", qPrintable(info.configFile)); qDebug("instance config: %s", qPrintable(info.instancePreferenceFile)); qDebug("storage: %s", qPrintable(info.storagePath)); qDebug("contentSrc: %s", qPrintable(info.contentSrc)); #endif if (!QFile::exists(info.configFile)) { KLog::log("Kludget::load fail"); KLog::log("config file not found"); return false; } window->setWindowTitle(info.id + ":" + QString::number(QApplication::applicationPid())); // access KDocument access; access.openDocument(info.storagePath + "/access.xml"); bool accessLocal = access.getValue("kludget/access/local", "0").toInt(); bool accessNetwork = access.getValue("kludget/access/network", "0").toInt(); bool accessPlugins = access.getValue("kludget/access/plugins", "0").toInt(); bool accessSystem = access.getValue("kludget/access/system", "0").toInt(); // engine KDocument engine; engine.openDocument(QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/" + ENGINE_CONFIG_FILE); // instance settings settings->setPath(info.instancePreferenceFile); #if defined(WIN32) settings->loadPreferences(":resources/xml/widgetPreferences.xml"); #else settings->loadPreferences(":resources/xml/widgetPreferences_linux.xml"); #endif settings->loadPreferences(info.configFile); settings->loadPreferences(info.path + "/" + PREFERENCE_FILE); // position int x = settings->read("kludget/x", window->x()).toInt(); int y = settings->read("kludget/y", window->y()).toInt(); window->move(x, y); resize(settings->read("kludget/width", info.width).toInt(), settings->read("kludget/height", info.height).toInt()); window->setOpacity(settings->read("kludget/opacity", 200).toInt()); window->setIgnoreDrag(settings->read("kludget/ignoreDrag", "0").toInt()); window->setIgnoreMouse(settings->read("kludget/ignoreMouse", "0").toInt()); window->setWindowLevel(settings->read("kludget/windowLevel", "0").toInt()); window->setSnapToScreen(settings->read("kludget/snapToScreen", "0").toInt()); window->view()->setGrayed(settings->read("kludget/grayScaled", "0").toInt()); #if 0 window->view()->setTinted(settings->read("kludget/tinted", "0").toInt()); window->view()->setTintColor(QColor(settings->read("kludget/tintColor", "#c0c0c0").toString())); window->view()->setTintMode(settings->read("kludget/tintMode", "14").toInt()); #endif // zoom window->setZoomFactor(settings->read("kludget/zoom", 1).toDouble()); window->view()->page()->setViewportSize(window->view()->page()->viewportSize()); window->autoSize(true); setProperty("identifier", info.id); setProperty("instance", info.instance); setupContextMenu(); QWebSettings *webSettings = window->view()->page()->settings(); #if 0 webSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); webSettings->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true); webSettings->setOfflineStoragePath(info.storagePath); webSettings->setOfflineStorageDefaultQuota(5000000); #endif webSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); webSettings->setAttribute(QWebSettings::PluginsEnabled, accessPlugins); webSettings->setWebGraphic(QWebSettings::MissingImageGraphic, QPixmap()); webSettings->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true); webSettings->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, true); webSettings->setUserStyleSheetUrl(QUrl::fromLocalFile(":resources/style/widget.css")); // network settings KNetwork *net = KNetwork::instance(); net->loadSettings(); net->setAccess(accessNetwork, accessLocal, QUrl::fromLocalFile(QFileInfo(info.contentSrc).absolutePath())); // system settings system->setEnableCommands(accessSystem); if (engine.getValue("kludget/general/runInShell", "0").toInt()) system->setShellPath(engine.getValue("kludget/general/shellPath", "")); // plugin KLog::log("plugin"); if (!plugin.isLoaded() && accessPlugins && info.pluginPath != "") { plugin.setFileName(info.pluginPath + "/" + info.pluginExecutable); KLog::log(QString("loading %1").arg(plugin.fileName())); if (plugin.load()) { typedef void (*initWithWebView)(QWebView*); initWithWebView init = (initWithWebView)plugin.resolve("initWithWebView"); if (init) { init((QWebView*)window->view()); KLog::log(QString("plugin loaded %1").arg(plugin.fileName())); } } else { KLog::log(QString("unable to load %1").arg(plugin.fileName())); } } // drop window->view()->setAcceptDrops(true); if (loadPage) { window->hide(); QUrl url = QUrl::fromLocalFile(info.contentSrc); if (!QFile::exists(info.contentSrc)) { url = QUrl(info.contentSrc); if (url.scheme().toLower() == "http") { window->view()->load(url); } else if (info.contentHtml == "") { KLog::log("Kludget::load fail"); KLog::log(QString("content source not found. ") + info.contentSrc); return false; } } if (info.contentHtml != "") window->view()->setHtml(info.contentHtml); else window->view()->load(url); KLog::log(QString("Kludget::load ") + info.id); #if 0 QString defaultBg = info.path + "/Default.png"; if (QFile::exists(defaultBg)) //window->view()->setTransitionLayer(QImage(defaultBg)); #endif } ipcClient.connectToServer(); return true; }
void ownCloudGui::slotFoldersChanged() { slotComputeOverallSyncStatus(); setupContextMenu(); }