[win-nix] refactoring

This commit is contained in:
Maxim Kadushkin
2018-09-28 19:12:26 +03:00
parent 5e56c5a48d
commit 9bcc71fe98
7 changed files with 264 additions and 151 deletions

View File

@ -0,0 +1,256 @@
/*
button
*/
button {
/*width: 135px;*/
height: 36px;
color: #fff;
font-size: 14px;
outline: 0;
border: none 0;
cursor: pointer;
border-radius: @border-radius;
background-color: @color-gray-4;
padding: 0 36px;
&.primary {
background-color: @color-blue-light;
&:hover {
background-color: @color-blue-3;
}
&:active {
background-color: @color-blue-2;
}
&:disabled {
background-color: @color-blue-light;
color: #a7cff8;
}
}
&:hover {
background-color: @color-gray-6;
}
&:active {
background-color: @color-gray-5;
}
&:disabled {
background-color: @color-gray-4;
cursor: default;
}
.btn-quick {
background-color: transparent;
}
}
/*
radio button style
*/
@color1: #f4f4f4;
@color2: #3197EE;
@rb-height: 18px;
input[type="radio"] {
position: absolute;
opacity: 0;
+ label:before {
content: '';
background: @color1;
border-radius: 100%;
border: 1px solid darken(@color1, 25%);
display: inline-block;
width: @rb-height;
height: @rb-height;
position: relative;
/*top: -0.1em;*/
margin-right: 1em;
vertical-align: top;
cursor: pointer;
text-align: center;
transition: all 250ms ease;
}
&:checked {
+ label:before {
background-color: @color2;
box-shadow: inset 0 0 0 3px @color1;
}
}
&:focus {
+ label:before {
outline: none;
border-color: @color2;
}
}
&:disabled {
+ label:before {
box-shadow: inset 0 0 0 3px @color1;
border-color: darken(@color1, 25%);
cursor: default;
}
&:checked {
+ label:before {
background: darken(@color1, 25%);
}
}
}
+ .label:empty:before {
margin-right: 0;
}
}
/*
check box style
*/
@switch-height: 20px;
@switch-width: 45px;
.switch-labeled {
.onoffswitch {
margin-right: 20px;
}
}
.onoffswitch {
/*display: none;*/
position: relative;
width: @switch-width;
-webkit-user-select:none;
}
.onoffswitch__checkbox {
display: none;
&:disabled {
+ label {
cursor: default;
pointer-events: none;
opacity: 0.7;
}
}
&:checked + .onoffswitch__label {
background-color: @color2;
}
&:checked + .onoffswitch__label {
border-color: @color2;
&:before {
border-color: @color2;
right: 0px;
}
}
}
.onoffswitch__label {
display: block;
overflow: hidden;
cursor: pointer;
height: @switch-height;
padding: 0;
line-height: @switch-height;
border: 2px solid darken(@color1, 25%);
border-radius: @switch-height;
background-color: darken(@color1, 25%);
transition: all 0.25s ease-in;
box-sizing: content-box;
&:before {
content: "";
display: block;
width: @switch-height;
margin: 0px;
background: #FFF;
position: absolute;
top: 0;
bottom: 0;
right: @switch-width - 24;
border: 2px solid darken(@color1, 25%);
border-radius: @switch-height;
transition: all 0.25s ease-in 0s;
}
}
/*
tooltip
*/
[tooltip] {
&:before {
position : absolute;
content : attr(tooltip);
opacity : 0;
color: #444;
border: 1px solid rgba(0, 0, 0, 0.15);
background: #fff;
border-radius: 4px;
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
padding: 5px 12px;
font-size: 11px;
z-index: 1;
transition: all .3s ease-in-out .25s;
pointer-events:none;
font-weight: normal;
}
&[tooltip-pos=top]:before {
margin: -40px 0 0 -10px;
}
}
[tooltip]:hover:before {
opacity : 1;
}
/*
combo-box
*/
.box-cmp-select {
display: inline-block;
&:after {
content: '';
border: solid @color-gray-light;
border-width: 0 2px 2px 0;
width: 8px;
height: 8px;
transform: rotate(45deg);
display: inline-block;
margin: 0 0 2px -30px;
cursor: pointer;
pointer-events:none;
}
&:hover:after {
border-color: @color-gray;
}
}
select {
-webkit-appearance: none;
height: 36px;
width: 150px;
outline: none;
border-radius: 3px;
color: @color-gray-dark;
border: 1px solid @color-gray-3;
padding: 0 15px;
font-size: 14px;
cursor: pointer;
option {
padding: 10px 4px;
}
}

View File

@ -21,6 +21,7 @@
@col-width: 287px;
@import 'component.less';
@import 'window.less';
@import '../vendor/bootstrap/variables.less';
@import '../vendor/bootstrap/dropdowns.less';
@ -115,55 +116,6 @@ h4 {
font-weight: 600;
}
button {
/*width: 135px;*/
height: 36px;
color: #fff;
font-size: 14px;
outline: 0;
border: none 0;
cursor: pointer;
border-radius: @border-radius;
background-color: @color-gray-4;
padding: 0 36px;
&:hover {
background-color: @color-gray-6;
}
&:active:not(:disabled) {
background-color: @color-gray-5;
}
&:disabled {
background-color: @color-gray-4;
cursor: default;
color: @color-gray-2;
opacity: 0.5;
}
&.primary {
background-color: @color-blue-light;
&:hover {
background-color: @color-blue-3;
}
&:active {
background-color: @color-blue-2;
}
&:disabled {
background-color: @color-blue-light;
color: #a7cff8;
}
}
.btn-quick {
background-color: transparent;
}
}
.text-sub {
color: @color-gray;
font-size: 12px;
@ -786,27 +738,6 @@ li.menu-item {
margin: 0 auto;
}
[tooltip]:before {
position : absolute;
content : attr(tooltip);
opacity : 0;
color: #444;
border: 1px solid rgba(0, 0, 0, 0.15);
background: #fff;
border-radius: 4px;
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
padding: 5px 12px;
font-size: 11px;
z-index: 1;
transition: all .3s ease-in-out .25s;
pointer-events:none;
}
[tooltip]:hover:before {
opacity : 1;
}
.logout {
position: relative;
@ -988,81 +919,7 @@ li.menu-item {
width: 18px;
height: 18px;
margin-right: 10px;
}
/*
* 'on/off' switch style
*/
@color1: #f4f4f4;
@color2: #3197EE;
@switch-height: 20px;
/*@switch-width: 60px;*/
@switch-width: 45px;
.switch-labeled {
.onoffswitch {
margin-right: 20px;
}
}
.onoffswitch {
/*display: none;*/
position: relative;
width: @switch-width;
-webkit-user-select:none;
}
.onoffswitch__checkbox {
display: none;
&:disabled {
+ label {
cursor: default;
pointer-events: none;
opacity: 0.7;
}
}
&:checked + .onoffswitch__label {
background-color: @color2;
}
&:checked + .onoffswitch__label {
border-color: @color2;
&:before {
border-color: @color2;
right: 0px;
}
}
}
.onoffswitch__label {
display: block;
overflow: hidden;
cursor: pointer;
height: @switch-height;
padding: 0;
line-height: @switch-height;
border: 2px solid darken(@color1, 25%);
border-radius: @switch-height;
background-color: darken(@color1, 25%);
transition: all 0.25s ease-in;
box-sizing: content-box;
&:before {
content: "";
display: block;
width: @switch-height;
margin: 0px;
background: #FFF;
position: absolute;
top: 0;
bottom: 0;
right: @switch-width - 24;
border: 2px solid darken(@color1, 25%);
border-radius: @switch-height;
transition: all 0.25s ease-in 0s;
}
}

View File

@ -122,7 +122,7 @@ void CLangater::init()
QCoreApplication::installTranslator(tr);
}
QString CLangater::getLanguageName()
QString CLangater::getCurrentLangCode()
{
return getInstance()->m_lang;
}

View File

@ -10,7 +10,7 @@ public:
static CLangater * getInstance();
static void init();
static QString getLanguageName();
static QString getCurrentLangCode();
static void addTranslation(const QString& dir, const QString& name);
static void addTranslation(const QString& dir);

View File

@ -225,7 +225,7 @@ CMainPanel::CMainPanel(QWidget *parent, bool isCustomWindow, uchar dpi_ratio)
// m_pTabs->updateIcons();
QString params = QString("lang=%1&username=%3&location=%2")
.arg(CLangater::getLanguageName(), Utils::systemLocationCode());
.arg(CLangater::getCurrentLangCode(), Utils::systemLocationCode());
wstring wparams = params.toStdWString();
wstring user_name = Utils::systemUserName();
@ -1037,7 +1037,7 @@ void CMainPanel::loadStartPage()
QString data_path = qApp->applicationDirPath() + "/index.html";
#endif
QString additional = "?waitingloader=yes&lang=" + CLangater::getLanguageName();
QString additional = "?waitingloader=yes&lang=" + CLangater::getCurrentLangCode();
QString _portal = _reg_user.value("portal").value<QString>();
if (!_portal.isEmpty()) {

View File

@ -39,8 +39,8 @@
#define VER_NUM_MAJOR 5
#define VER_NUM_MINOR 2
#define VER_NUM_BUILD 47
#define VER_NUM_REVISION 402
#define VER_NUM_BUILD 48
#define VER_NUM_REVISION 404
#define VER_NUMBER VER_NUM_MAJOR,VER_NUM_MINOR,VER_NUM_BUILD,VER_NUM_REVISION
#define VER_STRING VER_STR_LONG(VER_NUM_MAJOR,VER_NUM_MINOR,VER_NUM_BUILD,VER_NUM_REVISION)
#define VER_STRING_SHORT VER_STR_SHORT(VER_NUM_MAJOR,VER_NUM_MINOR)

View File

@ -721,7 +721,7 @@ void CMainWindow::slot_mainPageReady()
QString(VER_FILEVERSION_STR).toStdWString().c_str());
win_sparkle_set_appcast_url(URL_APPCAST_UPDATES);
win_sparkle_set_registry_path(QString("Software\\%1\\%2").arg(REG_GROUP_KEY).arg(REG_APP_NAME).toLatin1());
win_sparkle_set_lang(CLangater::getLanguageName().toLatin1());
win_sparkle_set_lang(CLangater::getCurrentLangCode().toLatin1());
win_sparkle_set_did_find_update_callback(&CMainWindow::updateFound);
win_sparkle_set_did_not_find_update_callback(&CMainWindow::updateNotFound);