Example #1
0
void SmallDeviceView::setAvailable(bool available, TransfertState)
{
    QString style;

    _available = available;
    setAcceptDrops(available);

    switch (_type)
    {
    case TYPE_ANDROID:
        updateWidgetStyle(ui->borderContainer, "androidContainer");
        break;
    case TYPE_WINDOWS:
        updateWidgetStyle(ui->borderContainer, "windowsContainer");
        break;
    case TYPE_MAC:
        updateWidgetStyle(ui->borderContainer, "macContainer");
        break;
    case TYPE_LINUX:
        updateWidgetStyle(ui->borderContainer, "linuxContainer");
        break;
    }

    if (available)
    {
        loadStyle(QString::number(WIDGET_OPACITY * 255), SettingsManager::availableDeviceColor());

    }
    else
    {
        loadStyle(QString::number(WIDGET_OPACITY * 255), SettingsManager::unavailableDeviceColor());
    }
}
Example #2
0
SmallDeviceView::SmallDeviceView(const QString &name, const QString &uid, DeviceType type, bool available, QWidget *parent) :
    AbstractDeviceView(name, uid, available, parent),
    ui(new Ui::SmallDeviceView),
    _horizontalSnap(false),
    _verticalSnap(false),
    _wasClosed(false),
    _type(type)
{
    ui->setupUi(this);

    setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
    setWindowOpacity(WIDGET_OPACITY);
    setAttribute(Qt::WA_TranslucentBackground);

    loadStyle(QString::number(WIDGET_OPACITY * 255), SettingsManager::availableDeviceColor());

    // Context menu
    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
            this, SLOT(onHistoryViewContextMenuRequested(const QPoint&)));

    setAvailable(available);
    setDeviceName(name);

    initAnimation();
    updateWindowFlags();
    createContextMenuActions();
}
void QgsFieldConditionalFormatWidget::editStyle( int editIndex, QgsConditionalStyle style )
{
  pages->setCurrentIndex( 1 );
  mEditIndex = editIndex;
  mEditing = true;
  mDeleteButton->show();
  loadStyle( style );
}
Example #4
0
Parser::Parser(QString type) :
    QObject()
{
    _textType = type;
    init();
    loadGrammar();
    loadStyle();
}
Example #5
0
squeeze::squeeze()
    : KXmlGuiWindow( ),
      m_view(new squeezeView(this)),
      m_printer(0)
{
    setObjectName(QLatin1String("squeeze"));
    // accept dnd
    setAcceptDrops(false);

    // tell the KXmlGuiWindow that this is indeed the main widget
    setCentralWidget(m_view);

    // then, setup our actions
    setupActions();
    //Add some widgets to status bar
    led = new KLed;
    led->off();
    statusBar()->addWidget(led); //FIXME: Que cuando se escriba algo en la barra de status, quede el LED ahi tambien.
    // add a status bar
    statusBar()->show();

    // Add typical actions and save size/toolbars/statusbar
    setupGUI();
    disableUI();
    // allow the view to change the statusbar and caption
    connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)),
            this,   SLOT(changeStatusbar(const QString&)));
    connect(m_view, SIGNAL(signalChangeCaption(const QString&)),
            this,   SLOT(changeCaption(const QString&)));

    connect(m_view, SIGNAL(signalDisconnected()), this, SLOT(setDisconnected()));
    connect(m_view, SIGNAL(signalConnected()), this, SLOT(setConnected()));

    connect(m_view, SIGNAL(signalShowPrefs()), SLOT(optionsPreferences()) );

    connect(m_view, SIGNAL(signalSalir() ), SLOT(salir() ));

    connect(m_view, SIGNAL(signalShowDbConfig()), this, SLOT(showDBConfigDialog()));


    connect(m_view, SIGNAL(signalAdminLoggedOn()), this, SLOT(enableUI()));
    connect(m_view, SIGNAL(signalAdminLoggedOff()), this, SLOT(disableUI()));
    connect(m_view, SIGNAL(signalSupervisorLoggedOn()), this, SLOT(enableUI()));


    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(fixGeom()));
    timer->setInterval(5000);
    timer->start();
    

    loadStyle();
}
Example #6
0
File: IDE.cpp Project: Alprog/Judy
IDE::IDE(int argc, char** argv)
    : QApplication(argc, argv)
{
    if (fileno(stdout) <= 0)
    {
        freopen("log.txt", "w", stdout);
    }

    Meta::getInstance()->init();

    loadStyle();
    loadSettings();
    start();
}
Example #7
0
bool init(const char *config)
{
  gfx::init();

  ///////////////////
  // initialize qsys

  qsys_regClasses();

  SysConfig::init();
  ViewInputConfig::init();
  ViewInputConfig *pVIC = ViewInputConfig::getInstance();
  pVIC->resetAllProps();

  LString confpath(config);
  if (confpath.isEmpty())
    return false;

  loadSysConfig(confpath);

  if (!RendererFactory::init())
    return false;

  RendererFactory *pRF = RendererFactory::getInstance();
  pRF->regist<RendGroup>();

  StyleMgr::init();

  ///////////////////
  // initialize other services

  loadStyle();

  StreamManager *pSM = StreamManager::getInstance();

  pSM->registReader<SceneXMLReader>();
  pSM->registReader<SceneXMLWriter>();

  SceneManager *pSceMgr = SceneManager::getInstance();

  LOG_DPRINTLN("CueMol2 version %s (%s) build %s\n",
               pSceMgr->getVersion().c_str(),
               pSceMgr->getVerArchName().c_str(),
               pSceMgr->getBuildID().c_str());

  //pVIC->applyStyle("DefaultViewInConf,UserViewConf");

  return true;
}
Example #8
0
void KCMStyle::load(bool useDefaults)
{
	TDEConfig config( "kdeglobals", true, false );

	config.setReadDefaults( useDefaults );

	// Page1 - Build up the Style ListBox
	loadStyle( config );

	// Page2 - Effects
	loadEffects( config );

	// Page3 - Misc.
	loadMisc( config );

	m_bEffectsDirty = false;
	m_bStyleDirty= false;
	m_bToolbarsDirty = false;

	emit changed( useDefaults );
}
Example #9
0
/**
 * Reads style data from a QSettings object for the given node and all its
 * children.
 * @param  settings The QSettings object to read from
 * @param  node     The style node
 */
void LexerStyleModel::loadStyle(QSettings& settings, Node* node)
{
	// Get the lexer and style ID from the node data.
	StyleData* data = static_cast<StyleData*>(node->data());
	QsciLexer* lexer = data->lexer_;
	int style = data->style_;

	// Create a key template for the settings object, of the form
	// LEXER\STYLE\%1, where %1 will be replaced by the property name.
	QString key = QString("Style/%1/%2/%3").arg(lexer->lexer()).arg(style);

	// Get the properties.
	for (uint i = 0; i != _LastProperty; i++) {
		StyleProperty prop = static_cast<StyleProperty>(i);
		setProperty(settings.value(key.arg(propertyKey(prop))), node, prop,
		            propertyDefaultValue(lexer, style, prop));
	}

	// Recursive call.
	for (int i = 0; i < node->childCount(); i++)
		loadStyle(settings, node->child(i));
}
Example #10
0
//For a frameless window: KMainWindow(0, Qt::FramelessWindowHint)
lemon::lemon()
  : KXmlGuiWindow(0,Qt::FramelessWindowHint),
      m_view(new lemonView(this))
{
    setObjectName(QLatin1String("lemon"));
    setAcceptDrops(false);
    // tell the KMainWindow that this is indeed the main widget
    setCentralWidget(m_view);
    // then, setup our actions
    setupActions();
    // Add typical actions and save size/toolbars/statusbar
    statusBar()->show();
    //add some info labels to status bar
    labelUserInfo = new QLabel("::user::");
    labelDate = new QLabel(" ::Date:: ");
    labelTime = new QLabel(" ::Time:: ");
    labelTransaction = new QLabel("");
    QLabel *imageUser = new QLabel("user");
    QLabel *imageDate = new QLabel("date");
    QLabel *imageTime = new QLabel("time");
    QLabel *imageTransaction = new QLabel("trans");
    imageUser->setPixmap(DesktopIcon("user-identity", 16));
    imageDate->setPixmap(DesktopIcon("view-pim-calendar", 16));
    imageTime->setPixmap(DesktopIcon("chronometer", 16));
    imageTransaction->setPixmap(DesktopIcon("wallet-open", 16));
    updateDate();
    statusBar()->addWidget(imageUser);
    statusBar()->addWidget(labelUserInfo);
    statusBar()->addWidget(imageDate);
    statusBar()->addWidget(labelDate);
    statusBar()->addWidget(imageTime);
    statusBar()->addWidget(labelTime);
    statusBar()->addWidget(imageTransaction);
    statusBar()->addWidget(labelTransaction);
    connect(m_view, SIGNAL(signalLoggedUser()), SLOT(updateUserName()) );
    connect(m_view, SIGNAL(signalNoLoggedUser()), SLOT(updateUserName())  );
    connect(m_view, SIGNAL(signalUpdateClock() ), SLOT(updateClock()) );
    QTimer::singleShot(500, this,  SLOT(hideMenuBar()));

    // apply the saved mainwindow settings, if any, and ask the mainwindow
    // to automatically save settings if changed: window size, toolbar
    // position, icon size, etc.
    setAutoSaveSettings();

    connect(m_view,SIGNAL(signalChangeStatusbar(const QString&)),this,SLOT(changeStatusbar(const QString&)));
    connect(m_view,SIGNAL(signalChangeCaption(const QString&)),this, SLOT(changeCaption(const QString&)));
    connect(m_view, SIGNAL(signalAdminLoggedOn()), this, SLOT(enableConfig()));
    connect(m_view, SIGNAL(signalAdminLoggedOff()), this, SLOT(disableConfig()));
    connect(m_view, SIGNAL(signalSupervisorLoggedOn()), this, SLOT(enableConfig())); //new
    connect(m_view, SIGNAL(signalSupervisorLoggedOff()), this, SLOT(disableConfig())); //new
    connect(m_view, SIGNAL(signalNoLoggedUser()), this, SLOT(disableUi()));
    connect(m_view, SIGNAL(signalLoggedUser()), this, SLOT(reactOnLogOn()));
    connect(m_view, SIGNAL(signalStartedOperation()), this, SLOT(reactOnStartedOp()) );
    connect(m_view, SIGNAL(signalUpdateTransactionInfo()), this, SLOT(updateTransaction()));
    connect(m_view, SIGNAL(signalShowProdGrid()), this, SLOT(triggerGridAction()));
    connect(m_view, SIGNAL(signalShowDbConfig()), this, SLOT(showDBConfigDialog()));

    connect(m_view, SIGNAL(signalEnableUI()), this, SLOT(enableUi()) );
    connect(m_view, SIGNAL(signalDisableUI()), this, SLOT(disableUi()) );

    connect(m_view, SIGNAL(signalEnableStartOperationAction()), this, SLOT(enableStartOp()) );

    loadStyle();
    disableConfig();
    disableUi();

}
Example #11
0
void StyleSheetEditor::init() 
{
	m_qSS_Actions.clear();
	loadStyle();
	loadStyleSheet();
}
Example #12
0
bool Settings::load()
{
	auto L = m_state;
	bool has_settings = PlatformInterface::fileExists(SETTINGS_PATH);
	bool errors = luaL_loadfile(L, has_settings ? SETTINGS_PATH : DEFAULT_SETTINGS_PATH) != LUA_OK;
	errors = errors || lua_pcall(L, 0, 0, 0) != LUA_OK;
	if (errors)
	{
		g_log_error.log("Editor") << SETTINGS_PATH << ": " << lua_tostring(L, -1);
		lua_pop(L, 1);
		return false;
	}

	if (lua_getglobal(L, "window") == LUA_TTABLE)
	{
		m_window.x = getIntegerField(L, "x", 0);
		m_window.y = getIntegerField(L, "y", 0);
		m_window.w = getIntegerField(L, "w", -1);
		m_window.h = getIntegerField(L, "h", -1);
	}
	lua_pop(L, 1);

	loadStyle(L);

	m_is_maximized = getBoolean(L, "maximized", true);
	
	m_is_open = getBoolean(L, "settings_opened", false);
	m_is_asset_browser_open = getBoolean(L, "asset_browser_opened", false);
	m_asset_browser_left_column_width = getFloat(L, "asset_browser_left_column_width", false);
	m_is_entity_list_open = getBoolean(L, "entity_list_opened", false);
	m_is_entity_template_list_open = getBoolean(L, "entity_template_list_opened", false);
	m_is_log_open = getBoolean(L, "log_opened", false);
	m_is_profiler_open = getBoolean(L, "profiler_opened", false);
	m_is_properties_open = getBoolean(L, "properties_opened", false);
	m_is_crash_reporting_enabled = getBoolean(L, "error_reporting_enabled", true);
	enableCrashReporting(m_is_crash_reporting_enabled && !m_force_no_crash_report);
	m_mouse_sensitivity.x = getFloat(L, "mouse_sensitivity_x", 200.0f);
	m_mouse_sensitivity.y = getFloat(L, "mouse_sensitivity_y", 200.0f);
	m_font_size = getInteger(L, "font_size", 13);

	if (!m_editor->getEngine().getPatchFileDevice())
	{
		if (lua_getglobal(L, "data_dir") == LUA_TSTRING) copyString(m_data_dir, lua_tostring(L, -1));
		lua_pop(L, 1);
		m_editor->getEngine().setPatchPath(m_data_dir);
	}

	auto& actions = m_app.getActions();
	if (lua_getglobal(L, "actions") == LUA_TTABLE)
	{
		for (int i = 0; i < actions.size(); ++i)
		{
			if (lua_getfield(L, -1, actions[i]->name) == LUA_TTABLE)
			{
				for (int j = 0; j < lengthOf(actions[i]->shortcut); ++j)
				{
					if (lua_rawgeti(L, -1, 1 + j) == LUA_TNUMBER)
					{
						actions[i]->shortcut[j] = (int)lua_tointeger(L, -1);
					}
					lua_pop(L, 1);
				}
			}
			lua_pop(L, 1);
		}
	}
	lua_pop(L, 1);

	m_app.getToolbarActions().clear();
	if (lua_getglobal(L, "toolbar") == LUA_TTABLE)
	{
		int len = (int)lua_rawlen(L, -1);
		for (int i = 0; i < len; ++i)
		{
			if (lua_rawgeti(L, -1, i + 1) == LUA_TSTRING)
			{
				const char* action_name = lua_tostring(L, -1);
				Action* action = m_app.getAction(action_name);
				if(action) m_app.getToolbarActions().push(action);
			}
			lua_pop(L, 1);
		}
	}
	lua_pop(L, 1);

	ImGui::LoadDock(L);
	return true;
}
Example #13
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
	ui->setupUi(this);
	setWindowIcon(QIcon(":icon.ico"));

	MainWindow::appPath = qApp->applicationDirPath();

	loadStyle();

	// member initialization
	dockWidget	 = new DockWidget;
	calWidget	= new BrowserWidget;
	crmWidget   = new BrowserWidget;

	toolBar		= new QToolBar(tr("Aktionen"));
	accountList = new AccountList(this);
	contactList = new ContactList(this);
	mainLayout	= new QStackedLayout();
	settings	= SugarSettings::getInstance();
	settingsDialog = new SettingsDialog;

	addDockWidget(Qt::BottomDockWidgetArea, dockWidget);
	dockWidget->hide();
	accountList->hide();
	calWidget->setAddress(QUrl(settings->calendarUrl));
	crmWidget->setAddress(QUrl(settings->crmUrl));
	mainLayout->addWidget(accountList);
	mainLayout->addWidget(contactList);
	//mainLayout->addWidget(projectList);
	mainLayout->addWidget(calWidget);
	mainLayout->addWidget(crmWidget);
	mainLayout->addWidget(settingsDialog);

	toolBar->setIconSize(QSize(14, 14));
	toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	toolBar->setMovable(false);

	QAction *accountsAct = new QAction(QIcon(":accounts.png"), tr("Firmen"), this);
	QAction *contactsAct = new QAction(QIcon(":contacts.png"), tr("Kontakte"), this);
	QAction *projectsAct = new QAction(QIcon(":projects.png"), tr("Projekte"), this);
	openCalAct			 = new QAction(QIcon(":calendar.png"), tr("Kalender"), this);
	openCrmAct			 = new QAction(QIcon(":calendar.png"), tr("SugarCrm"), this);

	addAccountAct			= new QAction(QIcon(":add-account.png"), tr("Neue Firma"), this);
	QAction *addContactAct	= new QAction(QIcon(":add-contact.png"), tr("Neuer Kontakt"), this);
	QAction *addProjectAct	= new QAction(QIcon(":add-project.png"), tr("Neues Projekt"), this);
	QAction *addTaskAct		= new QAction(QIcon(":add-task.png"),    tr("Neue Aufgabe"), this);
	pressViewAct			= new QAction(QIcon(":news.png"), tr("Pressekontakte"), this);

	connect(addAccountAct, SIGNAL(triggered()),
			this, SLOT(addAccount()));
	connect(openCalAct, SIGNAL(triggered()),
			this, SLOT(displayCalendar()));
	connect(openCrmAct, SIGNAL(triggered()),
			this, SLOT(displayCrm()));
	//connect(pressViewAct, SIGNAL(triggered()),
	//		this, SLOT(displayPressList()));
	connect(accountsAct, SIGNAL(triggered()),
			this, SLOT(displayAccounts()));
	connect(contactsAct, SIGNAL(triggered()),
			this, SLOT(displayContacts()));

	toolBar->addWidget(new QLabel(tr("Ansichten")));
	toolBar->addAction(accountsAct);
	toolBar->addAction(contactsAct);
	toolBar->addAction(projectsAct);
	toolBar->addAction(openCalAct);
	toolBar->addAction(openCrmAct);
	toolBar->addWidget(new QLabel(tr("Aktionen")));
	// TODO: fix this
	toolBar->addAction(addAccountAct);
	toolBar->addAction(addContactAct);
	toolBar->addAction(addProjectAct);
	toolBar->addAction(addTaskAct);
	//toolBar->addAction(pressViewAct);

	addToolBar(Qt::LeftToolBarArea, toolBar);
	toolBar->hide();

	QPushButton *loginBtn = new QPushButton(QIcon(":login.png"), tr("Login"), this);
	connect(loginBtn, SIGNAL(pressed()),
			this, SLOT(login()));
	QGridLayout *l = new QGridLayout(this);
	QWidget *c = new QWidget(this);
	QWidget *w = new QWidget(this);

	l->addWidget(loginBtn, 1, 1, Qt::AlignCenter);
	c->setLayout(l);
	mainLayout->addWidget(c);
	mainLayout->setCurrentWidget(c);
	w->setLayout(mainLayout);
	setCentralWidget(w);

	// initialize dialogs
	loadingDialog = new LoadingDialog(this);
	loginDialog   = new LoginDialog(this);
	loadingDialog->setVisible(false);
	loginDialog->setVisible(false);

	crm = SugarCrm::getInstance();
	accountModel = AccountModel::getInstance();
	contactModel = ContactModel::getInstance();

	accountsFilterModel = new AccountProxyModel(this);
	contactsFilterModel = new ContactProxyModel(this);

	//filterModel = new AccountProxyModel(this);
	//filterModel->setSourceModel(accountModel);

	accountsFilterModel->setSourceModel(accountModel);
	contactsFilterModel->setSourceModel(contactModel);

	restoreGeometry(settings->windowGeometry);

	// QML display
	//centerView = new QmlView(this);

	//centerView->setUrl(QUrl("SugarCrm.qml"));
	//centerView->setAttribute(Qt::WA_OpaquePaintEvent);
	//centerView->setAttribute(Qt::WA_NoSystemBackground);
	//centerView->setFocus();

	//contx = centerView->rootContext();
	//contx->addDefaultObject(this);
	//contx->setContextProperty("qmlViewer", this);
	//contx->setContextProperty("accountModel", proxyModel);

	// connecting ui actions
	connect(ui->actionLogin, SIGNAL(triggered()),
			this, SLOT(login()));
	connect(ui->actionEinstellungen, SIGNAL(triggered()),
			this, SLOT(displaySettings()));
	connect(ui->actionLogout, SIGNAL(triggered()),
			qApp, SLOT(quit()));
	connect(ui->actionServer_Zeit, SIGNAL(triggered()),
			crm, SLOT(getServerTime()));
	connect(ui->actionSugarFlavor, SIGNAL(triggered()),
			crm, SLOT(getSugarFlavor()));
	connect(ui->actionReloadStyle, SIGNAL(triggered()),
			this, SLOT(loadStyle()));
	connect(ui->actionAboutQt, SIGNAL(triggered()),
			qApp, SLOT(aboutQt()));
	connect(ui->actionWebsite, SIGNAL(triggered()),
			this, SLOT(openProjectHomepage()));
	connect(ui->actionSpenden, SIGNAL(triggered()),
			this, SLOT(openDonationWebsite()));
	connect(qApp, SIGNAL(aboutToQuit()),
			this, SLOT(cleanup()));

	// DEBUG XML COMMUNICATION
	//connect(crm, SIGNAL(sendingMessage(QString)),
	//		this, SLOT(debug(QString)));
	//connect(crm->trans, SIGNAL(newSoapMessage(QString)),
	//		this, SLOT(debug(QString)));

	connect(crm, SIGNAL(unknownAction(QString)),
			this, SLOT(unknownAction(QString)));

	// login response
	connect(crm, SIGNAL(loginFailed()),
			this, SLOT(loginResponse()));

	connect(crm, SIGNAL(loginSuccessful()),
			this, SLOT(loginResponse()));

	// soap error handling
	// TODO: improve!
	connect(crm, SIGNAL(returnedFaultyMessage(QString)),
			loadingDialog, SLOT(hide()));

	connect(crm, SIGNAL(returnedFaultyMessage(QString)),
			this, SLOT(setStatusMsg(QString)));

	connect(accountModel, SIGNAL(dataReady()),
			this, SLOT(displayAccounts()));

	//TODO: change this when it works
	//setCentralWidget(centerView);
	//centerView->execute();

	//rootComponent = centerView->root();
	//QVariant *tmp = new QVariant(contx->property("authView"));
	//QmlComponent authComponent((QObject *) tmp);  // centerView->engine(), QUrl("content/AuthView.qml"));
	//authView = authComponent.create(contx);
	//qDebug() << authView->dynamicPropertyN();

	//connect(rootComponent, SIGNAL(loggingIn()),
	//		this, SLOT(login()));
	//connect(rootComponent, SIGNAL(searching()),
	//		this, SLOT(doSearch()));
	/*connect(accountModel, SIGNAL(dataReady()),
			this, SLOT(assignData()));
	connect(this, SIGNAL(listReady()),
			rootComponent, SLOT(displayAccounts()));*/
	//connect(accountModel, SIGNAL(dataReady()),
	//		rootComponent, SLOT(displayAccounts()));

	setStatusMsg(tr("Bereit"), 2500);
}