mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-07 13:20:25 +00:00
Improve operation widget appearance
This commit is contained in:
parent
c3d02c0b41
commit
3d699bd533
@ -13,21 +13,21 @@ void CSVDoc::Operation::updateLabel(int threads)
|
|||||||
{
|
{
|
||||||
if (threads == -1 || ((threads == 0) != mStalling))
|
if (threads == -1 || ((threads == 0) != mStalling))
|
||||||
{
|
{
|
||||||
std::string name("unknown operation");
|
std::string name("Unknown operation");
|
||||||
|
|
||||||
switch (mType)
|
switch (mType)
|
||||||
{
|
{
|
||||||
case CSMDoc::State_Saving:
|
case CSMDoc::State_Saving:
|
||||||
name = "saving";
|
name = "Saving";
|
||||||
break;
|
break;
|
||||||
case CSMDoc::State_Verifying:
|
case CSMDoc::State_Verifying:
|
||||||
name = "verifying";
|
name = "Verifying";
|
||||||
break;
|
break;
|
||||||
case CSMDoc::State_Searching:
|
case CSMDoc::State_Searching:
|
||||||
name = "searching";
|
name = "Searching";
|
||||||
break;
|
break;
|
||||||
case CSMDoc::State_Merging:
|
case CSMDoc::State_Merging:
|
||||||
name = "merging";
|
name = "Merging";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ void CSVDoc::Operation::setBarColor(int type)
|
|||||||
"QProgressBar::chunk {"
|
"QProgressBar::chunk {"
|
||||||
"background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 %1, stop:.50 %2 stop: .51 %3 stop:1 %4);"
|
"background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 %1, stop:.50 %2 stop: .51 %3 stop:1 %4);"
|
||||||
"text-align: center;"
|
"text-align: center;"
|
||||||
"margin: 2px 1px 1p 2px;"
|
"margin: 2px 2px 2px 2px;"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
QString topColor = "#F2F6F8";
|
QString topColor = "#F2F6F8";
|
||||||
@ -121,10 +121,10 @@ void CSVDoc::Operation::setBarColor(int type)
|
|||||||
|
|
||||||
case CSMDoc::State_Searching:
|
case CSMDoc::State_Searching:
|
||||||
|
|
||||||
topColor = "#EBF1F6";
|
topColor = "#6DB3F2";
|
||||||
midTopColor = "#ABD3EE";
|
midTopColor = "#54A3EE";
|
||||||
midBottomColor = "#89C3EB";
|
midBottomColor = "#3690F0";
|
||||||
bottomColor = "#D5EBFB"; // blue gloss #4
|
bottomColor = "#1E69DE"; // blue gloss #3
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CSMDoc::State_Verifying:
|
case CSMDoc::State_Verifying:
|
||||||
@ -142,13 +142,6 @@ void CSVDoc::Operation::setBarColor(int type)
|
|||||||
midBottomColor = "#B68D4C";
|
midBottomColor = "#B68D4C";
|
||||||
bottomColor = "#E9D4B3"; // l Brown 3D
|
bottomColor = "#E9D4B3"; // l Brown 3D
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
|
|
||||||
topColor = "#F2F6F8";
|
|
||||||
bottomColor = "#E0EFF9";
|
|
||||||
midTopColor = "#D8E1E7";
|
|
||||||
midBottomColor = "#B5C6D0"; // gray gloss for undefined ops
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mProgressBar->setStyleSheet(style.arg(topColor).arg(midTopColor).arg(midBottomColor).arg(bottomColor));
|
mProgressBar->setStyleSheet(style.arg(topColor).arg(midTopColor).arg(midBottomColor).arg(bottomColor));
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
|
|
||||||
#include "operation.hpp"
|
#include "operation.hpp"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
constexpr int operationLineHeight = 40;
|
||||||
|
}
|
||||||
|
|
||||||
CSVDoc::Operations::Operations()
|
CSVDoc::Operations::Operations()
|
||||||
{
|
{
|
||||||
/// \todo make widget height fixed (exactly the height required to display all operations)
|
/// \todo make widget height fixed (exactly the height required to display all operations)
|
||||||
@ -20,7 +25,7 @@ CSVDoc::Operations::Operations()
|
|||||||
widgetContainer->setLayout(mLayout);
|
widgetContainer->setLayout(mLayout);
|
||||||
setWidget(widgetContainer);
|
setWidget(widgetContainer);
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
setFixedHeight(widgetContainer->height());
|
setFixedHeight(operationLineHeight);
|
||||||
setTitleBarWidget(new QWidget(this));
|
setTitleBarWidget(new QWidget(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,9 +38,6 @@ void CSVDoc::Operations::setProgress(int current, int max, int type, int threads
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int oldCount = static_cast<int>(mOperations.size());
|
|
||||||
int newCount = oldCount + 1;
|
|
||||||
|
|
||||||
Operation* operation = new Operation(type, this);
|
Operation* operation = new Operation(type, this);
|
||||||
connect(operation, qOverload<int>(&Operation::abortOperation), this, &Operations::abortOperation);
|
connect(operation, qOverload<int>(&Operation::abortOperation), this, &Operations::abortOperation);
|
||||||
|
|
||||||
@ -43,8 +45,8 @@ void CSVDoc::Operations::setProgress(int current, int max, int type, int threads
|
|||||||
mOperations.push_back(operation);
|
mOperations.push_back(operation);
|
||||||
operation->setProgress(current, max, threads);
|
operation->setProgress(current, max, threads);
|
||||||
|
|
||||||
if (oldCount > 0)
|
int newCount = static_cast<int>(mOperations.size());
|
||||||
setFixedHeight(height() / oldCount * newCount);
|
setFixedHeight(operationLineHeight * newCount);
|
||||||
|
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
}
|
}
|
||||||
@ -54,16 +56,14 @@ void CSVDoc::Operations::quitOperation(int type)
|
|||||||
for (std::vector<Operation*>::iterator iter(mOperations.begin()); iter != mOperations.end(); ++iter)
|
for (std::vector<Operation*>::iterator iter(mOperations.begin()); iter != mOperations.end(); ++iter)
|
||||||
if ((*iter)->getType() == type)
|
if ((*iter)->getType() == type)
|
||||||
{
|
{
|
||||||
int oldCount = static_cast<int>(mOperations.size());
|
|
||||||
int newCount = oldCount - 1;
|
|
||||||
|
|
||||||
mLayout->removeItem((*iter)->getLayout());
|
mLayout->removeItem((*iter)->getLayout());
|
||||||
|
|
||||||
(*iter)->deleteLater();
|
(*iter)->deleteLater();
|
||||||
mOperations.erase(iter);
|
mOperations.erase(iter);
|
||||||
|
|
||||||
if (oldCount > 1)
|
int newCount = static_cast<int>(mOperations.size());
|
||||||
setFixedHeight(height() / oldCount * newCount);
|
if (newCount > 0)
|
||||||
|
setFixedHeight(operationLineHeight * newCount);
|
||||||
else
|
else
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user