I want a custom toolbar with background color as gradient.
I tried with sass. But still it is not working.. What i did, i am writing it step by step:
I create on resources folder in my current project.
I kept themes and images folder there.
I created css and sass folder inside resources folder.
in the sass folder i created app.scss file which contains the below code:
$base-color: #588aad; // go big blue!$include_default_icons: false;
#import 'sencha-touch/default/all';
#include sencha-panel;
#include sencha-buttons;
#include sencha-sheet;
#include sencha-picker;
#include sencha-tabs;
#include sencha-toolbar;
#include sencha-toolbar-forms;
#include sencha-indexbar;
#include sencha-list;
#include sencha-layout;
#include sencha-form;
#include sencha-msgbox;
#include sencha-loading-spinner;
#include pictos-iconmask("bookmarks");
#include pictos-iconmask("compose");
#include pictos-iconmask("trash");
#include pictos-iconmask("search");
#include pictos-iconmask("bookmark2");
#include sencha-toolbar-ui('charcoal', #333333,'glossy');
Then i created config.rb file with this code:
dir = File.dirname(FILE)
load File.join(dir, '..', 'themes')
sass_path = dir
css_path = File.join(dir, "..", "css")
environment = :production
output_style = :compressed
then i run compass compile app.scss in the comand prompt
In css folder, app.css file has been created after running the command.
7.then i change the code for toolbar:
xtype: 'toolbar', docked: 'top',
ui: 'charcoal',
title: 'Set Compliance Goals'
But after that when i am running the project, in simulator, toolbar is coming with white background.... please help..
check in your web browser's inspector that the css is targeting x-toolbar.And empty your browser cache might help.
It's also possible that your config.rb is misconfigured- this is a good resource on config.rb setup for compass
Depending on the version of ST you are using you might want to use Sencha Cmd. Makes it a lot easier.
In Sencha Cmd you can create a starting point by building an empty app. After that is complete you can run the sencha app watch command from the app root folder and any sass changes will compile automatically along with many other processes.
MyApp/resources/sass/app.scss --> compiles to --> MyApp/resources/css/app.css
// THIS WILL OVERRIDE THE DEFAULT SENCHA TOOLBAR UI THEMES
#include sencha-toolbar-ui('normal', $base-color, 'glossy');
#include sencha-toolbar-ui('dark', $second-color, 'matte' );
// THIS ONE USES A CUSTOM UI. THERES COMPASS MIXINS IN THE INCLUDED
// TO MAKE A GRADIENT OUT OF THIS COLOR.
#include sencha-toolbar-ui('custom-ui-name', $third-color, 'glossy');
This works for me. If you want to control the gradient then you can check how here in the docs http://docs-origin.sencha.com/touch/2.4/2.4.1-apidocs/#!/api/Ext.Toolbar-css_mixin-sencha-toolbar-ui
Hope this helps!
Related
I am writing a bluez C program to read battery service. I am using CMake for building the code.
My Cmake File is :
# CMakeLists file for module-bluez project
cmake_minimum_required(VERSION 3.02)
project (bluez-module)
find_package(PkgConfig REQUIRED)
# Adding dbus library
pkg_check_modules(DBUS REQUIRED dbus-1>= 1.6)
include_directories(${DBUS_INCLUDE_DIRS})
link_directories(${DBUS_LIBRARY_DIRS})
#Adding glib library
pkg_check_modules(GLIB REQUIRED glib-2.0>=2.23)
include_directories(${GLIB_INCLUDE_DIRS})
link_directories(${GLIB_LIBRARY_DIRS})
pkg_check_modules (DBUSGLIB REQUIRED dbus-glib-1)
include_directories(${DBUSGLIB_INCLUDE_DIRS})
link_directories(${DBUSGLIB_LIBRARY_DIRS})
# Adding bluetooth using extra libs
list(APPEND EXTRA_LIBS "bluetooth")
# Expose 'gattlib.h' to all sub-directories
include_directories(include)
add_executable(bluez-module scantest.c)
# Linking libraries
message(${DBUSGLIB_LIBRARIES})
target_link_libraries(bluez-module ${EXTRA_LIBS})
#target_link_libraries(bluez-module ${DBUS_LIBRARIES})
target_link_libraries(bluez-module ${DBUSGLIB_LIBRARIES})
target_link_libraries(bluez-module ${GLIB_LIBRARIES})
I have to use g_main_loop in my code. But after building the source file I always get the below error :
[ 50%] Linking C executable bluez-module
CMakeFiles/bluez-module.dir/scantest.c.o: In function `read_battery_service':
scantest.c:(.text+0x5b8): undefined reference to `g_dbus_setup_bus'
collect2: error: ld returned 1 exit status
My read_battery function code is as below :
int read_battery_service(struct hci_state *current_hci_state , char *dev_addr)
{
GError *error = NULL;
GDBusClient *client;
GOptionContext *context;
context = g_option_context_new(NULL);
main_loop = g_main_loop_new(NULL, FALSE);
dbus_conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, NULL);
return 0;
}
Just trying to initialize for to access dbus apis.
I have included these headers in the code
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
#include <stdio.h>
#include <gdbus.h>
#include <glib/gmain.h>
What would be the issue ? Is glib.h contains the function g_main_loop_new ? Where should I find it ? Or Is CMake not linking glib properly ?
Looks like you are missing the gdbus linker flags. Try using
pkg_check_modules (DBUSGLIB REQUIRED dbus-glib-1) and add
target_link_libraries(module-bluez ${DBUS_LIBRARIES} ${DBUSGLIB_LIBRARIES})
and see if it helps.
I am trying to build a simple Qt5 application using CMake
The Qt5 project is the basic project generated when creating a new project with a Widget.
The project builds and runs successfully with QtCreator
widget.h
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
namespace Ui {
class Widget;
}
class Widget : public QWidget
{
Q_OBJECT
public:
explicit Widget(QWidget *parent = 0);
~Widget();
private:
Ui::Widget *ui;
};
#endif // WIDGET_H
widget.cpp
#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
}
Widget::~Widget()
{
delete ui;
}
main.cpp
#include "widget.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
return a.exec();
}
The CMakeLists file have been written according to the example given in the Qt5 documentation. The path to the Qt5 directory is given in the cache.
http://doc.qt.io/qt-5/cmake-manual.html
CMakeLists.txt
cmake_minimum_required(VERSION 2.8.11)
project(test0)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
# Find the QtWidgets library
find_package(Qt5Widgets)
# Tell CMake to create the executable
add_executable(test0 WIN32 main.cpp)
# Use the Widgets module from Qt 5.
target_link_libraries(test0 Qt5::Widgets)
The Cmake generation works fine.
I'm getting linking errors (undefined reference to methods belonging to the Widget class) when building the app using the Makfile generated by Cmake.
(here is a capture of the errors)
http://s31.postimg.org/edefl1m6j/Capturetest0.png
Any tips ?
System :
Windows 7
Compiler :
MinGW32
Versions :
QT 5.6.1 (mingw49_32)
CMake 3.6.0
Two mistakes in the CMakeLists
- widget.cpp has to be mentionend in add_executable as explained Tsyvarev
- use autouic in order to create the ui_widget.h associated with the widget.ui and widget.cpp
The working CMakeLists is the following :
cmake_minimum_required(VERSION 2.8.11)
project(test0)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
# Find the QtWidgets library
find_package(Qt5Widgets)
# Tell CMake to create the executable
add_executable(test0 WIN32 main.cpp widget.cpp widget.ui)
# Use the Widgets module from Qt 5.
target_link_libraries(test0 Qt5::Widgets)
I'm trying to build a basic FTP client using libftp. I've compiled and archived it as libftp.a and placed it in /usr/local/lib. All the necessary headers I've placed in /usr/local/include/ftp.
Under Build Settings, I've set "Header Search Paths" to /usr/local/include, and I've set "Library Search Paths" to /usr/local/lib. For "Other Linker Flags", I've added -lftp.
Here is the shell of my C++ class:
Connector.h:
#include <stdlib.h>
#include <ftp/ftp.h>
#include <stdio.h>
class Connector{
private:
FtpConnection *connection;
public:
Connector();
~Connector();
bool connect(const char *hostname, const char *port);
};
Connector.cc:
#include "Connector.h"
Connector::Connector(){
}
Connector::~Connector(){
}
bool Connector::connect(const char *hostname, const char *port){
ftpGetAddresses(hostname, port);
printf("Connected!\n");
return true;
}
Upon compiling, this is the error I get:
Undefined symbols for architecture x86_64: "ftpGetAddresses(char
const*, char const*)", referenced from:
Connector::connect(char const*, char const*) in Connector.o ld: symbol(s) not found for architecture x86_64 clang: error: linker
command failed with exit code 1 (use -v to see invocation)
It's probably worth noting that this is part of a Cocoa project, so the Connector class is #included in my AppDelegate, which is of course an Obj-C class. All of my Obj-C source files have the .mm extension.
I am certain that the lib is in working order, as I have no issue compiling a program on the command line with gcc ... -lftp. It's only a problem with Xcode.
Well, it appears I just talked myself through my own problem. As I was typing the last part of my question, I realized that the issue was linking a C library in a C++ source file. gcc would compile just fine on command line, but g++ gave me the same error as Xcode. One google search later I found this link, which solved my problem beautifully. Basically, if you want a C library to be compatible with C++, you need to add
#ifdef __cplusplus
extern "C" {
#endif
at the top of the library header file, and add
#ifdef __cplusplus
}
#endif
at the bottom of the file. I'll leave the question here hoping it will help someone else in the future.
I am trying to add a new customized theme to my app, but it is raising the following error when I am compiling on Compass:
_Class.scss: Undefined variable: "$font-family"
I tried to change the html,body font in _Class.scss to $font-family, but it doesn't work. My Sencha Touch version is 2.2.1. How can I solve this issue?
// Let's start with the basics
$base - color: #CC0000;
$active - color: #850000;
// Buttons
$button-gradient: 'bevel';
// Lists
$list-bg-color: # eee;
$list - color: #333;
$list-pressed-color: # ddd;
$list - active - gradient: 'recessed';
$list - header - bg - color: #990000;
$list-header:white;
$list-header-gradient: 'bevel';
// Tabs
$tabs_dark_color: #000;
#import 'sencha-touch/default/all';
#include sencha-panel;
#include sencha-buttons;
#include sencha-sheet;
#include sencha-picker;
#include sencha-msgbox;
#include sencha-loading-spinner;
#include sencha-button-ui('action', #ffc801);
#include sencha-button-ui('decline', desaturate(darken(#b8a7a7, 10%), 5%));
.x-tabbar-dark .x-tab {
color: white;
}
.x-list-header {
color: white !important;
}
.x-list-round .x-list-header {
color: #777 !important;
}
.x-tabbar-dark.x-docked-bottom .x-tab .x-button-icon {
background: white !important;
}
This is a rather old post but for the sake of completeness. I ran into this issue yesterday. It occurs because you did not import the default theme variables.
You did import
sencha-touch/default/all but these are not the variables. The variable reside in sencha-touch/default
#import 'sencha-touch/default'; should resolve the issue.
create folder named stylesheets where you placed config.rb
I have created folder styles where I placed config.rb file
copy folder fonts from touch\resources\themes\fonts to styles/stylesheets/ folder
I have a program that has successfully compiled in the past, but now I get a bunch of errors.The source code is just:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
int main()
{
int fd;
fd = creat("datafile.dat", S_IREAD | S_IWRITE);
if (fd == -1)
printf("Error in opening datafile.dat\n");
else
{
printf("datafile.dat opened for read/write access\n");
printf("datafile.dat is currently empty\n");
}
close(fd);
exit (0);
}
Now I get the errors:
cre.C:8:54: error: ‘creat’ was not declared in this scope
cre.C:16:17: error: ‘close’ was not declared in this scope
cre.C:17:16: error: ‘exit’ was not declared in this scope
Sometimes I get an error about gxx_personality_v0 instead, and sometimes I get no error at all! I've tried updating gcc, but the problem remains. What's going wrong?
OS UBUNTU 12.1 on vaio laptop
From your error messages I see that you called your file cre.C. gcc is case-sensitive for file names: try naming it cre.c and compiling it.
$ LANG=C cc -o foo foo.C
foo.C: In function 'int main()':
foo.C:8:54: error: 'creat' was not declared in this scope
foo.C:16:17: error: 'close' was not declared in this scope
foo.C:17:16: error: 'exit' was not declared in this scope
but
$ LANG=C cc -o foo foo.c
foo.c: In function 'main':
foo.c:17:9: warning: incompatible implicit declaration of built-in function 'exit' [enabled by default]
As noted in a comment, a file with .C extension is handled by the C++ compiler, thus you are seeing those errors.
Read the man pages for the creat, close, and exit functions.
On my system, creat() requires:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
close() requires:
#include <unistd.h>
and exit() requires:
#include <stdlib.h>
As for why the code was compiling before, it's hard to tell. Perhaps the compiler was being invoked in a more permissive mode that didn't complain about missing function declarations, or perhaps some of the headers you do include have #include directives for the headers you need.